From 5cf78f7bd87d1382fde42bf81fef6b16fe130985 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Thu, 28 Jul 2011 11:34:31 -0700 Subject: use pageswap callback to sync WebTextView with drawing of page bug:5008210 Redraw the WebTextView when the page swaps (and thus the background is updated) That way it updates at (approximately) the same time as the page. In software rendering, do as before. Depends on following external/webkit change: https://android-git.corp.google.com/g/#change,124606 Change-Id: I59d7266a49d0ba734efdb88fef5fafe68aecfbce --- core/java/android/webkit/WebView.java | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'core/java/android/webkit/WebView.java') diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index a935a67..5946ae4 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2285,7 +2285,7 @@ public class WebView extends AbsoluteLayout checkThread(); mContentWidth = 0; mContentHeight = 0; - setBaseLayer(0, null, false, false); + setBaseLayer(0, null, false, false, false); mWebViewCore.sendMessage(EventHub.CLEAR_CONTENT); } @@ -4268,11 +4268,11 @@ public class WebView extends AbsoluteLayout } void setBaseLayer(int layer, Region invalRegion, boolean showVisualIndicator, - boolean isPictureAfterFirstLayout) { + boolean isPictureAfterFirstLayout, boolean registerPageSwapCallback) { if (mNativeClass == 0) return; nativeSetBaseLayer(layer, invalRegion, showVisualIndicator, - isPictureAfterFirstLayout); + isPictureAfterFirstLayout, registerPageSwapCallback); if (mHTML5VideoViewProxy != null) { mHTML5VideoViewProxy.setBaseLayer(layer); } @@ -4420,8 +4420,9 @@ public class WebView extends AbsoluteLayout mFocusSizeChanged = false; // If we are zooming, this will get handled above, when the zoom // finishes. We also do not need to do this unless the WebTextView - // is showing. - if (!animateZoom && inEditingMode()) { + // is showing. With hardware acceleration, the pageSwapCallback() + // updates the WebTextView position in sync with page swapping + if (!canvas.isHardwareAccelerated() && !animateZoom && inEditingMode()) { didUpdateWebTextViewDimensions(ANYWHERE); } } @@ -8395,6 +8396,14 @@ public class WebView extends AbsoluteLayout } } + // Called by JNI to invalidate the View, given rectangle coordinates in + // content space + private void pageSwapCallback() { + if (inEditingMode()) { + didUpdateWebTextViewDimensions(ANYWHERE); + } + } + void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) { if (mNativeClass == 0) { if (mDelaySetPicture != null) { @@ -8407,10 +8416,15 @@ public class WebView extends AbsoluteLayout } WebViewCore.ViewState viewState = draw.mViewState; boolean isPictureAfterFirstLayout = viewState != null; + + // Request a callback on pageSwap (to reposition the webtextview) + boolean registerPageSwapCallback = + !mZoomManager.isFixedLengthAnimationInProgress() && inEditingMode(); + if (updateBaseLayer) { setBaseLayer(draw.mBaseLayer, draw.mInvalRegion, getSettings().getShowVisualIndicator(), - isPictureAfterFirstLayout); + isPictureAfterFirstLayout, registerPageSwapCallback); } final Point viewSize = draw.mViewSize; if (isPictureAfterFirstLayout) { @@ -9209,7 +9223,8 @@ public class WebView extends AbsoluteLayout private native void nativeSetFindIsUp(boolean isUp); private native void nativeSetHeightCanMeasure(boolean measure); private native void nativeSetBaseLayer(int layer, Region invalRegion, - boolean showVisualIndicator, boolean isPictureAfterFirstLayout); + boolean showVisualIndicator, boolean isPictureAfterFirstLayout, + boolean registerPageSwapCallback); private native int nativeGetBaseLayer(); private native void nativeShowCursorTimed(); private native void nativeReplaceBaseContent(int content); -- cgit v1.1