summaryrefslogtreecommitdiffstats
path: root/android_webview/java
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-26 06:16:19 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-26 06:16:19 +0000
commit9e70b5725059f16de3d39f4e4937d1e7d8dfc6cb (patch)
treef047700496ebd4afa28374f498249f7b34aeffb4 /android_webview/java
parent8afef4d952fd28183612c26b143d321eed2e59a7 (diff)
downloadchromium_src-9e70b5725059f16de3d39f4e4937d1e7d8dfc6cb.zip
chromium_src-9e70b5725059f16de3d39f4e4937d1e7d8dfc6cb.tar.gz
chromium_src-9e70b5725059f16de3d39f4e4937d1e7d8dfc6cb.tar.bz2
[Android WebView] Invalidate whole visible rect
Before this, we were only invalidating the clip rect in DrawGL, which may not be the whole viewport. Now always invalidate the global visible rect instead. Also make physical backing size match view size, since we are no longer using browser compositor. BUG=264275 NOTRY=true R=joth@chromium.org Review URL: https://codereview.chromium.org/20388002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/java')
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwContents.java31
1 files changed, 10 insertions, 21 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 00dc0ab..347bd75 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -169,6 +169,7 @@ public class AwContents {
// picture listener API has not yet been enabled, or if it is using invalidation-only mode.
private Callable<Picture> mPictureListenerContentProvider;
+ private final Rect mLastGlobalVisibleBounds = new Rect();
private int mLastGlobalVisibleWidth;
private int mLastGlobalVisibleHeight;
@@ -401,7 +402,7 @@ public class AwContents {
// more of the containing view becomes visible (i.e. a containing view
// with a width/height of "wrap_content" and dimensions greater than
// that of the screen).
- AwContents.this.updatePhysicalBackingSizeIfNeeded();
+ AwContents.this.updateGlobalVisibleBounds();
}
};
@@ -620,23 +621,8 @@ public class AwContents {
return nativeGetAwDrawGLViewContext(mNativeAwContents);
}
- // Only valid within updatePhysicalBackingSizeIfNeeded().
- private final Rect mGlobalVisibleBoundsTemporary = new Rect();
-
- private void updatePhysicalBackingSizeIfNeeded() {
- // We musn't let the physical backing size get too big, otherwise we
- // will try to allocate a SurfaceTexture beyond what the GL driver can
- // cope with. In most cases, limiting the SurfaceTexture size to that
- // of the visible bounds of the WebView will be good enough i.e. the maximum
- // SurfaceTexture dimensions will match the screen dimensions).
- mContainerView.getGlobalVisibleRect(mGlobalVisibleBoundsTemporary);
- int width = mGlobalVisibleBoundsTemporary.width();
- int height = mGlobalVisibleBoundsTemporary.height();
- if (width != mLastGlobalVisibleWidth || height != mLastGlobalVisibleHeight) {
- mLastGlobalVisibleWidth = width;
- mLastGlobalVisibleHeight = height;
- mContentViewCore.onPhysicalBackingSizeChanged(width, height);
- }
+ private void updateGlobalVisibleBounds() {
+ mContainerView.getGlobalVisibleRect(mLastGlobalVisibleBounds);
}
//--------------------------------------------------------------------------------------------
@@ -658,7 +644,9 @@ public class AwContents {
if (!nativeOnDraw(mNativeAwContents, canvas, canvas.isHardwareAccelerated(),
mContainerView.getScrollX(), mContainerView.getScrollY(),
mClipBoundsTemporary.left, mClipBoundsTemporary.top,
- mClipBoundsTemporary.right, mClipBoundsTemporary.bottom )) {
+ mClipBoundsTemporary.right, mClipBoundsTemporary.bottom,
+ mLastGlobalVisibleBounds.left, mLastGlobalVisibleBounds.top,
+ mLastGlobalVisibleBounds.right, mLastGlobalVisibleBounds.bottom)) {
Log.w(TAG, "nativeOnDraw failed; clearing to background color.");
canvas.drawColor(getEffectiveBackgroundColor());
}
@@ -1370,7 +1358,7 @@ public class AwContents {
public void onSizeChanged(int w, int h, int ow, int oh) {
if (mNativeAwContents == 0) return;
mScrollOffsetManager.setContainerViewSize(w, h);
- updatePhysicalBackingSizeIfNeeded();
+ mContentViewCore.onPhysicalBackingSizeChanged(w, h);
mContentViewCore.onSizeChanged(w, h, ow, oh);
nativeOnSizeChanged(mNativeAwContents, w, h, ow, oh);
}
@@ -1751,7 +1739,8 @@ public class AwContents {
private native void nativeAddVisitedLinks(int nativeAwContents, String[] visitedLinks);
private native boolean nativeOnDraw(int nativeAwContents, Canvas canvas,
boolean isHardwareAccelerated, int scrollX, int ScrollY,
- int clipLeft, int clipTop, int clipRight, int clipBottom);
+ int clipLeft, int clipTop, int clipRight, int clipBottom,
+ int visibleLeft, int visibleTop, int visibleRight, int visibleBottom);
private native void nativeFindAllAsync(int nativeAwContents, String searchString);
private native void nativeFindNext(int nativeAwContents, boolean forward);
private native void nativeClearMatches(int nativeAwContents);