diff options
author | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-09 12:46:27 +0000 |
---|---|---|
committer | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-09 12:46:27 +0000 |
commit | 5d263aa46055ff3badd6511eacbad3332ff0467c (patch) | |
tree | 60dc8a76561c952dc65b1491803107f51b5af6d7 /android_webview/java | |
parent | 5587a7faa03542da45482245490c0e3b7166026c (diff) | |
download | chromium_src-5d263aa46055ff3badd6511eacbad3332ff0467c.zip chromium_src-5d263aa46055ff3badd6511eacbad3332ff0467c.tar.gz chromium_src-5d263aa46055ff3badd6511eacbad3332ff0467c.tar.bz2 |
[android] Implement scrollbar support.
This change adds the scrollbar-related public API to AwContents.
It also moves the code to disable scrollbars from ContentViewCore
to ContentView as that bit of code is Chrome/ContentShell specific.
BUG=internal, b/6702676 b/4591822
TEST=None
Java only change. Ran through Android trybots.
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/22456002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216674 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/java')
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContents.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index 46989c0..493e75b 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -11,6 +11,7 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Picture; import android.graphics.Rect; +import android.graphics.drawable.Drawable; import android.net.http.SslCertificate; import android.os.AsyncTask; import android.os.Build; @@ -124,6 +125,11 @@ public class AwContents { void setMeasuredDimension(int measuredWidth, int measuredHeight); /** + * @see View#getScrollBarStyle() + */ + int super_getScrollBarStyle(); + + /** * Requests a callback on the native DrawGL method (see getAwDrawGLFunction) * if called from within onDraw, |canvas| will be non-null and hardware accelerated. * otherwise, |canvas| will be null, and the container view itself will be hardware @@ -500,6 +506,7 @@ public class AwContents { new OverScroller(mContainerView.getContext())); setOverScrollMode(mContainerView.getOverScrollMode()); + setScrollBarStyle(mInternalAccessAdapter.super_getScrollBarStyle()); setNewAwContents(nativeInit(browserContext)); } @@ -892,6 +899,54 @@ public class AwContents { } } + // TODO(mkosiba): In WebViewClassic these appear in some of the scroll extent calculation + // methods but toggling them has no visiual effect on the content (in other words the scrolling + // code behaves as if the scrollbar-related padding is in place but the onDraw code doesn't + // take that into consideration). + // http://crbug.com/269032 + private boolean mOverlayHorizontalScrollbar = true; + private boolean mOverlayVerticalScrollbar = false; + + /** + * @see View#setScrollBarStyle(int) + */ + public void setScrollBarStyle(int style) { + if (style == View.SCROLLBARS_INSIDE_OVERLAY + || style == View.SCROLLBARS_OUTSIDE_OVERLAY) { + mOverlayHorizontalScrollbar = mOverlayVerticalScrollbar = true; + } else { + mOverlayHorizontalScrollbar = mOverlayVerticalScrollbar = false; + } + } + + /** + * @see View#setHorizontalScrollbarOverlay(boolean) + */ + public void setHorizontalScrollbarOverlay(boolean overlay) { + mOverlayHorizontalScrollbar = overlay; + } + + /** + * @see View#setVerticalScrollbarOverlay(boolean) + */ + public void setVerticalScrollbarOverlay(boolean overlay) { + mOverlayVerticalScrollbar = overlay; + } + + /** + * @see View#overlayHorizontalScrollbar() + */ + public boolean overlayHorizontalScrollbar() { + return mOverlayVerticalScrollbar; + } + + /** + * @see View#overlayVerticalScrollbar() + */ + public boolean overlayVerticalScrollbar() { + return mOverlayVerticalScrollbar; + } + /** * Called by the embedder when the scroll offset of the containing view has changed. * @see View#onScrollChanged(int,int) |