diff options
author | Grace Kloba <klobag@google.com> | 2010-04-14 16:33:27 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-04-14 16:33:27 -0700 |
commit | 8579f2114a08475e55eb5d8095ce52a4e4b2f691 (patch) | |
tree | 31558ee3e4e4f375b34e531b3bb8f7f8d04ea934 /core/java | |
parent | 5c14f2d08fb01be02b4952904c0f07464882653d (diff) | |
parent | e35a45b761ee38c04181bff0a72a6501101bf181 (diff) | |
download | frameworks_base-8579f2114a08475e55eb5d8095ce52a4e4b2f691.zip frameworks_base-8579f2114a08475e55eb5d8095ce52a4e4b2f691.tar.gz frameworks_base-8579f2114a08475e55eb5d8095ce52a4e4b2f691.tar.bz2 |
am e35a45b7: am 8a878dde: Merge "Pass WebKit scrollbar mode to Java. When scrollbar is alwaysOff, don\'t trigger scroll." into froyo
Merge commit 'e35a45b761ee38c04181bff0a72a6501101bf181' into kraken
* commit 'e35a45b761ee38c04181bff0a72a6501101bf181':
Pass WebKit scrollbar mode to Java. When scrollbar
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/webkit/WebView.java | 28 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewCore.java | 9 |
2 files changed, 33 insertions, 4 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 7bd83e7..602eedf 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -540,10 +540,10 @@ public class WebView extends AbsoluteLayout static final int FIND_AGAIN = 126; static final int CENTER_FIT_RECT = 127; static final int REQUEST_KEYBOARD_WITH_SELECTION_MSG_ID = 128; + static final int SET_SCROLLBAR_MODES = 129; private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID; - private static final int LAST_PACKAGE_MSG_ID - = REQUEST_KEYBOARD_WITH_SELECTION_MSG_ID; + private static final int LAST_PACKAGE_MSG_ID = SET_SCROLLBAR_MODES; static final String[] HandlerPrivateDebugString = { "REMEMBER_PASSWORD", // = 1; @@ -586,7 +586,8 @@ public class WebView extends AbsoluteLayout "RETURN_LABEL", // = 125; "FIND_AGAIN", // = 126; "CENTER_FIT_RECT", // = 127; - "REQUEST_KEYBOARD_WITH_SELECTION_MSG_ID" // = 128; + "REQUEST_KEYBOARD_WITH_SELECTION_MSG_ID", // = 128; + "SET_SCROLLBAR_MODES" // = 129; }; // If the site doesn't use the viewport meta tag to specify the viewport, @@ -657,6 +658,14 @@ public class WebView extends AbsoluteLayout private static final int DRAW_EXTRAS_SELECTION = 2; private static final int DRAW_EXTRAS_CURSOR_RING = 3; + // keep this in sync with WebCore:ScrollbarMode in WebKit + private static final int SCROLLBAR_AUTO = 0; + private static final int SCROLLBAR_ALWAYSOFF = 1; + // as we auto fade scrollbar, this is ignored. + private static final int SCROLLBAR_ALWAYSON = 2; + private int mHorizontalScrollBarMode = SCROLLBAR_AUTO; + private int mVerticalScrollBarMode = SCROLLBAR_AUTO; + // Used to match key downs and key ups private boolean mGotKeyDown; @@ -2277,6 +2286,8 @@ public class WebView extends AbsoluteLayout protected int computeHorizontalScrollRange() { if (mDrawHistory) { return mHistoryWidth; + } else if (mHorizontalScrollBarMode == SCROLLBAR_ALWAYSOFF) { + return computeHorizontalScrollExtent(); } else { // to avoid rounding error caused unnecessary scrollbar, use floor return (int) Math.floor(mContentWidth * mActualScale); @@ -2287,6 +2298,8 @@ public class WebView extends AbsoluteLayout protected int computeVerticalScrollRange() { if (mDrawHistory) { return mHistoryHeight; + } else if (mVerticalScrollBarMode == SCROLLBAR_ALWAYSOFF) { + return computeVerticalScrollExtent(); } else { // to avoid rounding error caused unnecessary scrollbar, use floor return (int) Math.floor(mContentHeight * mActualScale); @@ -5024,7 +5037,9 @@ public class WebView extends AbsoluteLayout if (settings.supportZoom() && settings.getBuiltInZoomControls() && !getZoomButtonsController().isVisible() - && mMinZoomScale < mMaxZoomScale) { + && mMinZoomScale < mMaxZoomScale + && (mHorizontalScrollBarMode != SCROLLBAR_ALWAYSOFF + || mVerticalScrollBarMode != SCROLLBAR_ALWAYSOFF)) { mZoomButtonsController.setVisible(true); int count = settings.getDoubleTapToastCount(); if (mInZoomOverview && count > 0) { @@ -6641,6 +6656,11 @@ public class WebView extends AbsoluteLayout centerFitRect(r.left, r.top, r.width(), r.height()); break; + case SET_SCROLLBAR_MODES: + mHorizontalScrollBarMode = msg.arg1; + mVerticalScrollBarMode = msg.arg2; + break; + default: super.handleMessage(msg); break; diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 0175aed..4118119 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -2453,6 +2453,15 @@ final class WebViewCore { new Rect(x, y, x + width, y + height)).sendToTarget(); } + // called by JNI + private void setScrollbarModes(int hMode, int vMode) { + if (mWebView == null) { + return; + } + mWebView.mPrivateHandler.obtainMessage(WebView.SET_SCROLLBAR_MODES, + hMode, vMode).sendToTarget(); + } + private native void nativePause(); private native void nativeResume(); private native void nativeFreeMemory(); |