Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1693)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 22849016: Implement clearView to match classic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Invalidating Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
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 1e7f88d16b5d9c8dba1c7717085b88bfbb4c9ad1..98a6b2a9b7400d932d4fbc877ac7e89490a0fcb5 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -180,6 +180,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 {
@@ -694,12 +697,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());
boliu 2013/09/20 20:55:49 Documentation says draws white background, not wha
Kristian Monsen 2013/09/20 21:15:17 Classic actually does the background color as well
+ } 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());
}
@@ -729,6 +734,12 @@ public class AwContents {
mScrollOffsetManager.computeVerticalScrollRange()));
}
+ public void clearView() {
+ mClearViewActive = true;
+ syncOnNewPictureStateToNative();
+ mContainerView.invalidate();
boliu 2013/08/16 23:04:55 Is this invalidate needed? Documentation only says
Kristian Monsen 2013/09/20 19:35:56 The behavior we are trying to match is pretty much
+ }
+
/**
* Enable the onNewPicture callback.
* @param enabled Flag to enable the callback.
@@ -745,7 +756,12 @@ public class AwContents {
}
};
}
- nativeEnableOnNewPicture(mNativeAwContents, enabled);
+ mPictureListenerEnabled = enabled;
+ syncOnNewPictureStateToNative();
+ }
+
+ private void syncOnNewPictureStateToNative() {
+ nativeEnableOnNewPicture(mNativeAwContents, mPictureListenerEnabled || mClearViewActive);
}
public void findAllAsync(String searchString) {
@@ -1685,6 +1701,13 @@ public class AwContents {
@CalledByNative
public void onNewPicture() {
+ // Clear up any results from a previous clearView call
+ if (mClearViewActive) {
+ mClearViewActive = false;
+ mContainerView.invalidate();
boliu 2013/08/16 23:04:55 Again is this needed? If cc activates, it should s
Kristian Monsen 2013/09/20 19:35:56 I think it is safe to keep it in? Remember this is
+ 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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698