diff options
| author | 2011-02-16 11:25:03 -0800 | |
|---|---|---|
| committer | 2011-02-16 14:35:28 -0800 | |
| commit | da7378e86e6d6e7522dfd1e83091545fa93aa84d (patch) | |
| tree | a154e98a8b4a6736bdcc2efef07a341382f95a66 | |
| parent | 6c0dc5a5c1b0b8edd0706f97ed9e8c5d486afdc2 (diff) | |
Adding a debug setting to enable visual indicator for GL
[This is the WebView part]
The idea is to turn on the visual indicator without building the code.
The implementation included:
1. Setup the UI on browser side to check whether or not this is enabled.
2. Transfer the info from browser setting to web setting.
3. Send this info down from WebView to webkit.
4. In the webkit, we save this info in TilesManager.
5. At texture generation time, we query this info to decide whether or
not add the visual indicator on the texture.
One design decision we made is we don't want to restart the browser for
debugging purpose. This is better preserving the browser current activity,
the only pitfall is that the visual indicator is NOT updated on different
textures simultaneously.
The corresponding browser change is: #change,97058
The dependent webkit change is: #change,97052
bug:3458721
Change-Id: I34a0514048df61b414c3386b292f2586efbde74e
| -rw-r--r-- | core/java/android/webkit/WebSettings.java | 21 | ||||
| -rw-r--r-- | core/java/android/webkit/WebView.java | 14 |
2 files changed, 29 insertions, 6 deletions
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index 0bf0eabdd419..71d6080287c4 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -174,6 +174,7 @@ public class WebSettings { private boolean mBlockNetworkImage = false; private boolean mBlockNetworkLoads; private boolean mJavaScriptEnabled = false; + private boolean mShowVisualIndicator = false; private PluginState mPluginState = PluginState.OFF; private boolean mJavaScriptCanOpenWindowsAutomatically = false; private boolean mUseDoubleTree = false; @@ -1191,6 +1192,26 @@ public class WebSettings { } /** + * Tell the WebView to show the visual indicator + * @param flag True if the WebView should show the visual indicator + * @hide + */ + public synchronized void setShowVisualIndicator(boolean flag) { + if (mShowVisualIndicator != flag) { + mShowVisualIndicator = flag; + postSync(); + } + } + + /** + * @return True if the WebView is showing the visual indicator + * @hide + */ + public synchronized boolean getShowVisualIndicator() { + return mShowVisualIndicator; + } + + /** * Tell the WebView to enable plugins. * @param flag True if the WebView should load plugins. * @deprecated This method has been deprecated in favor of diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 7d8289acf7ec..69e658f1572c 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2089,7 +2089,7 @@ public class WebView extends AbsoluteLayout public void clearView() { mContentWidth = 0; mContentHeight = 0; - setBaseLayer(0, null); + setBaseLayer(0, null, false); mWebViewCore.sendMessage(EventHub.CLEAR_CONTENT); } @@ -3996,14 +3996,14 @@ public class WebView extends AbsoluteLayout } } - void setBaseLayer(int layer, Rect invalRect) { + void setBaseLayer(int layer, Rect invalRect, boolean showVisualIndciator) { if (mNativeClass == 0) return; if (invalRect == null) { Rect rect = new Rect(0, 0, mContentWidth, mContentHeight); - nativeSetBaseLayer(layer, rect); + nativeSetBaseLayer(layer, rect, showVisualIndciator); } else { - nativeSetBaseLayer(layer, invalRect); + nativeSetBaseLayer(layer, invalRect, showVisualIndciator); } } @@ -7205,7 +7205,8 @@ public class WebView extends AbsoluteLayout case NEW_PICTURE_MSG_ID: { // called for new content final WebViewCore.DrawData draw = (WebViewCore.DrawData) msg.obj; - setBaseLayer(draw.mBaseLayer, draw.mInvalRegion.getBounds()); + setBaseLayer(draw.mBaseLayer, draw.mInvalRegion.getBounds(), + getSettings().getShowVisualIndicator()); final Point viewSize = draw.mViewSize; WebViewCore.ViewState viewState = draw.mViewState; boolean isPictureAfterFirstLayout = viewState != null; @@ -8337,7 +8338,8 @@ public class WebView extends AbsoluteLayout private native void nativeSetFindIsEmpty(); private native void nativeSetFindIsUp(boolean isUp); private native void nativeSetHeightCanMeasure(boolean measure); - private native void nativeSetBaseLayer(int layer, Rect invalRect); + private native void nativeSetBaseLayer(int layer, Rect invalRect, + boolean showVisualIndciator); private native void nativeShowCursorTimed(); private native void nativeReplaceBaseContent(int content); private native void nativeCopyBaseContentToPicture(Picture pict); |