diff options
author | kristianm@chromium.org <kristianm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-20 23:02:51 +0000 |
---|---|---|
committer | kristianm@chromium.org <kristianm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-20 23:02:51 +0000 |
commit | 83b343693eafc995241c8dedca8cafe77b34ad42 (patch) | |
tree | d344ccdb7eb5a4911b3eb0866ee2449ceb401d8a | |
parent | 9326e648be3b0860db98e9d0db97659ad73236f6 (diff) | |
download | chromium_src-83b343693eafc995241c8dedca8cafe77b34ad42.zip chromium_src-83b343693eafc995241c8dedca8cafe77b34ad42.tar.gz chromium_src-83b343693eafc995241c8dedca8cafe77b34ad42.tar.bz2 |
Implement clearView to match classic
Note that it needs a separate CL downstream to actually call this
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/22849016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224511 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContents.java | 35 |
1 files changed, 29 insertions, 6 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 6ee6098..2805af2 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -182,6 +182,9 @@ public class AwContents { private boolean mContainerViewFocused; private boolean mWindowFocused; + private boolean mClearViewActive; + private boolean mPictureListenerEnabled; + private AwAutofillManagerDelegate mAwAutofillManagerDelegate; private static final class DestroyRunnable implements Runnable { @@ -729,12 +732,14 @@ public class AwContents { } mScrollOffsetManager.syncScrollOffsetFromOnDraw(); - canvas.getClipBounds(mClipBoundsTemporary); - if (!nativeOnDraw(mNativeAwContents, canvas, canvas.isHardwareAccelerated(), - mContainerView.getScrollX(), mContainerView.getScrollY(), - mClipBoundsTemporary.left, mClipBoundsTemporary.top, - mClipBoundsTemporary.right, mClipBoundsTemporary.bottom)) { + + if (mClearViewActive) { + canvas.drawColor(getEffectiveBackgroundColor()); + } else if (!nativeOnDraw(mNativeAwContents, canvas, canvas.isHardwareAccelerated(), + mContainerView.getScrollX(), mContainerView.getScrollY(), + mClipBoundsTemporary.left, mClipBoundsTemporary.top, + mClipBoundsTemporary.right, mClipBoundsTemporary.bottom)) { Log.w(TAG, "nativeOnDraw failed; clearing to background color."); canvas.drawColor(getEffectiveBackgroundColor()); } @@ -765,6 +770,12 @@ public class AwContents { mScrollOffsetManager.computeVerticalScrollRange())); } + public void clearView() { + mClearViewActive = true; + syncOnNewPictureStateToNative(); + mContainerView.invalidate(); + } + /** * Enable the onNewPicture callback. * @param enabled Flag to enable the callback. @@ -782,7 +793,12 @@ public class AwContents { } }; } - nativeEnableOnNewPicture(mNativeAwContents, enabled); + mPictureListenerEnabled = enabled; + syncOnNewPictureStateToNative(); + } + + private void syncOnNewPictureStateToNative() { + nativeEnableOnNewPicture(mNativeAwContents, mPictureListenerEnabled || mClearViewActive); } public void findAllAsync(String searchString) { @@ -1746,6 +1762,13 @@ public class AwContents { @CalledByNative public void onNewPicture() { + // Clear up any results from a previous clearView call + if (mClearViewActive) { + mClearViewActive = false; + mContainerView.invalidate(); + syncOnNewPictureStateToNative(); + } + // Don't call capturePicture() here but instead defer it until the posted task runs within // the callback helper, to avoid doubling back into the renderer compositor in the middle // of the notification it is sending up to here. |