diff options
| author | Chris Craik <ccraik@google.com> | 2011-07-28 11:34:31 -0700 |
|---|---|---|
| committer | Chris Craik <ccraik@google.com> | 2011-07-28 15:42:58 -0700 |
| commit | 5cf78f7bd87d1382fde42bf81fef6b16fe130985 (patch) | |
| tree | f3ed958f27f5cfe448b8ed3411907a4e6d474d70 /core/java/android/webkit/WebView.java | |
| parent | a7ffaee29892cc38ae2327017b6670adafef711b (diff) | |
| download | frameworks_base-5cf78f7bd87d1382fde42bf81fef6b16fe130985.zip frameworks_base-5cf78f7bd87d1382fde42bf81fef6b16fe130985.tar.gz frameworks_base-5cf78f7bd87d1382fde42bf81fef6b16fe130985.tar.bz2 | |
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
Diffstat (limited to 'core/java/android/webkit/WebView.java')
| -rw-r--r-- | core/java/android/webkit/WebView.java | 29 |
1 files changed, 22 insertions, 7 deletions
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); |
