diff options
author | Nicolas Roard <nicolas@android.com> | 2010-11-01 15:08:03 -0700 |
---|---|---|
committer | Nicolas Roard <nicolas@android.com> | 2010-11-01 16:55:41 -0700 |
commit | fb7bc34b23f37d10be2c778ddc5ce86542b6573c (patch) | |
tree | 4ed1506720d1d17a01fa0768d6ae092372427444 /core | |
parent | 03476ddba607a4b1fbb7e7ad08f40f8142b20580 (diff) | |
download | frameworks_base-fb7bc34b23f37d10be2c778ddc5ce86542b6573c.zip frameworks_base-fb7bc34b23f37d10be2c778ddc5ce86542b6573c.tar.gz frameworks_base-fb7bc34b23f37d10be2c778ddc5ce86542b6573c.tar.bz2 |
Update layers only
Java counterpart to https://android-git.corp.google.com/g/#change,77334
Bug:2975990
Change-Id: I428944c30cedddc47a2c4f8c772167dd4ce2a78d
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/webkit/WebViewCore.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 9a873b6..9edb267 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -472,6 +472,11 @@ final class WebViewCore { */ private native int nativeRecordContent(Region invalRegion, Point wh); + /** + * Update the layers' content + */ + private native int nativeUpdateLayers(); + private native boolean nativeFocusBoundsChanged(); /** @@ -798,6 +803,7 @@ final class WebViewCore { "FREE_MEMORY", // = 145 "VALID_NODE_BOUNDS", // = 146 "SAVE_WEBARCHIVE", // = 147 + "WEBKIT_DRAW_LAYERS", // = 148; }; class EventHub { @@ -868,6 +874,9 @@ final class WebViewCore { // Load and save web archives static final int SAVE_WEBARCHIVE = 147; + // Update layers + static final int WEBKIT_DRAW_LAYERS = 148; + // Network-based messaging static final int CLEAR_SSL_PREF_TABLE = 150; @@ -953,6 +962,10 @@ final class WebViewCore { webkitDraw(); break; + case WEBKIT_DRAW_LAYERS: + webkitDrawLayers(); + break; + case DESTROY: // Time to take down the world. Cancel all pending // loads and destroy the native view and frame. @@ -1800,6 +1813,7 @@ final class WebViewCore { // Used to avoid posting more than one draw message. private boolean mDrawIsScheduled; + private boolean mDrawLayersIsScheduled; // Used to avoid posting more than one split picture message. private boolean mSplitPictureIsScheduled; @@ -1839,6 +1853,20 @@ final class WebViewCore { boolean mFocusSizeChanged; } + // Only update the layers' content, not the base surface + // PictureSet. + private void webkitDrawLayers() { + mDrawLayersIsScheduled = false; + if (mDrawIsScheduled) { + removeMessages(EventHub.WEBKIT_DRAW); + webkitDraw(); + return; + } + DrawData draw = new DrawData(); + draw.mBaseLayer = nativeUpdateLayers(); + webkitDraw(draw); + } + private void webkitDraw() { mDrawIsScheduled = false; DrawData draw = new DrawData(); @@ -1848,6 +1876,10 @@ final class WebViewCore { if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw abort"); return; } + webkitDraw(draw); + } + + private void webkitDraw(DrawData draw) { if (mWebView != null) { draw.mFocusSizeChanged = nativeFocusBoundsChanged(); draw.mViewSize = new Point(mCurrentViewWidth, mCurrentViewHeight); @@ -1957,6 +1989,15 @@ final class WebViewCore { } } + // called from JNI + void layersDraw() { + synchronized (this) { + if (mDrawLayersIsScheduled) return; + mDrawLayersIsScheduled = true; + mEventHub.sendMessage(Message.obtain(null, EventHub.WEBKIT_DRAW_LAYERS)); + } + } + // called by JNI private void contentScrollBy(int dx, int dy, boolean animate) { if (!mBrowserFrame.firstLayoutDone()) { |