summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/WebView.java
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2011-01-28 00:20:04 -0800
committerChet Haase <chet@google.com>2011-01-28 00:20:04 -0800
commit91fc3cf3b62833515a48ceb59546200994c6af5c (patch)
treeaae11cf852e941dad1796316b4b05b1382de49aa /core/java/android/webkit/WebView.java
parent270cbcc16a72f982d84afeb5e3fd3f166936394a (diff)
downloadframeworks_base-91fc3cf3b62833515a48ceb59546200994c6af5c.zip
frameworks_base-91fc3cf3b62833515a48ceb59546200994c6af5c.tar.gz
frameworks_base-91fc3cf3b62833515a48ceb59546200994c6af5c.tar.bz2
Fix artifact with clipped webview content
We were incorrectly calculating the webview viewport in cases where the viewport was clipped. We now pass down null for the viewport, which is an indicator for the native code to noop drawGL calls with a null viewport. Change-Id: Iecf191eb447869819e357a15a360f0f08c47c273
Diffstat (limited to 'core/java/android/webkit/WebView.java')
-rw-r--r--core/java/android/webkit/WebView.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 6363299..baa37b5 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -350,6 +350,7 @@ public class WebView extends AbsoluteLayout
private ZoomManager mZoomManager;
private Rect mGLRectViewport = new Rect();
+ private boolean mGLViewportEmpty = false;
/**
* Transportation object for returning WebView across thread boundaries.
@@ -4071,7 +4072,8 @@ public class WebView extends AbsoluteLayout
}
if (canvas.isHardwareAccelerated()) {
- int functor = nativeGetDrawGLFunction(mGLRectViewport, getScale(), extras);
+ int functor = nativeGetDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport,
+ getScale(), extras);
((HardwareCanvas) canvas).callDrawGLFunction(functor);
} else {
DrawFilter df = null;
@@ -5155,16 +5157,21 @@ public class WebView extends AbsoluteLayout
void setGLRectViewport() {
// Use the getGlobalVisibleRect() to get the intersection among the parents
- getGlobalVisibleRect(mGLRectViewport);
-
- // Then need to invert the Y axis, just for GL
- View rootView = getRootView();
- int rootViewHeight = rootView.getHeight();
- int savedWebViewBottom = mGLRectViewport.bottom;
- mGLRectViewport.bottom = rootViewHeight - mGLRectViewport.top - getVisibleTitleHeight();
- mGLRectViewport.top = rootViewHeight - savedWebViewBottom;
-
- nativeUpdateDrawGLFunction(mGLRectViewport);
+ // visible == false means we're clipped - send a null rect down to indicate that
+ // we should not draw
+ boolean visible = getGlobalVisibleRect(mGLRectViewport);
+ if (visible) {
+ // Then need to invert the Y axis, just for GL
+ View rootView = getRootView();
+ int rootViewHeight = rootView.getHeight();
+ int savedWebViewBottom = mGLRectViewport.bottom;
+ mGLRectViewport.bottom = rootViewHeight - mGLRectViewport.top - getVisibleTitleHeight();
+ mGLRectViewport.top = rootViewHeight - savedWebViewBottom;
+ mGLViewportEmpty = false;
+ } else {
+ mGLViewportEmpty = true;
+ }
+ nativeUpdateDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport);
}
/**