Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25266] Android: Fix WebView HW-acceleration for Android 4.1 #9432

Merged
merged 2 commits into from Oct 3, 2017

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Sep 14, 2017

  • Disable HW-acceleration on Android 4.1 Titanium.UI.WebView when a borderWidth is defined
  • Fix hasBorder() to only be true when a borderWidth and borderRadius is defined
NOTE: I found anomalies when attempting to play HTML5 content back with HW-acceleration enabled and a border defined
TEST CASE #1
var window = Ti.UI.createWindow(),
    webView = Ti.UI.createWebView({
	    url: 'https://appcelerator.com',
	    borderWidth: 5,
	    borderColor: 'red',
	    borderRadius: 3
    });
window.add(webView);
window.open();
TEST CASE #2
var window = Ti.UI.createWindow(),
    webView = Ti.UI.createWebView({
	    url: 'https://www.quirksmode.org/html5/tests/video.html',
	    borderWidth: '20',
	    borderColor: 'red',
	    width: '66%', height: '66%',
	    borderRadius: '20'
    }),
    circle = Ti.UI.createView({
        top: 10,
        backgroundColor: 'blue',
        width: 50, height: 50,
        borderRadius: 25
    });
window.add([webView, circle]);
window.open();

JIRA Ticket

@@ -73,7 +73,6 @@ public WebViewProxy()
defaultValues.put(TiC.PROPERTY_OVER_SCROLL_MODE, 0);
defaultValues.put(TiC.PROPERTY_LIGHT_TOUCH_ENABLED, true);
defaultValues.put(TiC.PROPERTY_ENABLE_JAVASCRIPT_INTERFACE, true);
defaultValues.put(TiC.PROPERTY_BORDER_RADIUS, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed that this border radius zero line was added to resolve an HTML5 video issue (see PR #8681). Do we need to re-test this? Or have you confirmed that this issue was resolved somewhere else, like in TiUIView?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has already been resolved.

|| d.containsKeyAndNotNull(TiC.PROPERTY_BORDER_RADIUS)
|| d.containsKeyAndNotNull(TiC.PROPERTY_BORDER_WIDTH);
return d.containsKeyAndNotNull(TiC.PROPERTY_BORDER_WIDTH)
&& d.getDouble(TiC.PROPERTY_BORDER_WIDTH) > 0f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we still need to do an -or- check to see if radius is > 0f because it'll "clip" the view with rounded corners, even if the border width is zero, right?

@garymathews
Copy link
Contributor Author

garymathews commented Sep 19, 2017

@jquick-axway Good catch! Updated PR.

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: Pass

@lokeshchdhry
Copy link
Contributor

FR Passed.

Loading url in a webview does not crash the app on Android 4.1

Studio Ver: 4.10.0.201709271713
SDK Ver: 7.0.0 local build
OS Ver: 10.12.3
Xcode Ver: Xcode 8.3.3
Appc NPM: 4.2.9
Appc CLI: 6.2.4
Ti CLI Ver: 5.0.14
Alloy Ver: 1.9.14
Node Ver: 7.10.1
Java Ver: 1.8.0_101
Device : Android 4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants