Skip to content

Commit

Permalink
[TIMOB-25266] Fix WebView HW-acceleration for Android 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Sep 19, 2017
1 parent f6edd09 commit 48b2bd5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
defaultValues.put(TiC.PROPERTY_DISABLE_CONTEXT_MENU, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,10 @@ public boolean interceptOnBackPressed()
@Override
protected void disableHWAcceleration()
{
Log.d(TAG, "Do not disable HW acceleration for WebView.", Log.DEBUG_MODE);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN) {
super.disableHWAcceleration();
} else {
Log.d(TAG, "Do not disable HW acceleration for WebView.", Log.DEBUG_MODE);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,10 @@ private boolean hasGradient(KrollDict d)

private boolean hasBorder(KrollDict d)
{
return d.containsKeyAndNotNull(TiC.PROPERTY_BORDER_COLOR)
|| d.containsKeyAndNotNull(TiC.PROPERTY_BORDER_RADIUS)
|| d.containsKeyAndNotNull(TiC.PROPERTY_BORDER_WIDTH);
return (d.containsKeyAndNotNull(TiC.PROPERTY_BORDER_WIDTH)
&& TiConvert.toTiDimension(d.getString(TiC.PROPERTY_BORDER_WIDTH), TiDimension.TYPE_WIDTH).getValue() > 0f)
|| (d.containsKeyAndNotNull(TiC.PROPERTY_BORDER_RADIUS)
&& TiConvert.toTiDimension(d.getString(TiC.PROPERTY_BORDER_RADIUS), TiDimension.TYPE_WIDTH).getValue() > 0f);
}

private boolean hasColorState(KrollDict d)
Expand Down Expand Up @@ -1428,6 +1429,9 @@ private void initializeBorder(KrollDict d, Integer bgColor)
if (d.containsKey(TiC.PROPERTY_BORDER_WIDTH)) {
TiDimension width = TiConvert.toTiDimension(d.get(TiC.PROPERTY_BORDER_WIDTH), TiDimension.TYPE_WIDTH);
if (width != null) {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN) {
disableHWAcceleration();
}
borderView.setBorderWidth((float) width.getPixels(borderView));
}
}
Expand Down

0 comments on commit 48b2bd5

Please sign in to comment.