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..fe1d0d35b161f0e6b33bb1f0178a6700629a359f 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()); |
+ } 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,11 @@ public class AwContents { |
mScrollOffsetManager.computeVerticalScrollRange())); |
} |
+ public void clearView() { |
+ mClearViewActive = true; |
+ nativeEnableOnNewPicture(mNativeAwContents, true); |
joth
2013/08/16 21:41:04
invalidate();
Kristian Monsen
2013/08/16 22:57:10
Done.
|
+ } |
+ |
/** |
* Enable the onNewPicture callback. |
* @param enabled Flag to enable the callback. |
@@ -745,6 +755,10 @@ public class AwContents { |
} |
}; |
} |
+ mPictureListenerEnabled = enabled; |
+ if (mClearViewActive) { |
+ enabled = true; |
+ } |
nativeEnableOnNewPicture(mNativeAwContents, enabled); |
joth
2013/08/16 21:41:04
suggest collecting all three nativeEnableOnNewPict
Kristian Monsen
2013/08/16 22:57:10
Done.
|
} |
@@ -1685,6 +1699,10 @@ public class AwContents { |
@CalledByNative |
public void onNewPicture() { |
+ // Clear up any results from a previous clearView call |
+ mClearViewActive = false; |
joth
2013/08/16 21:41:04
if (mClearViewActive) {
invalidate();
mClearVi
Kristian Monsen
2013/08/16 22:57:10
Done.
|
+ nativeEnableOnNewPicture(mNativeAwContents, mPictureListenerEnabled); |
+ |
// 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. |