If we can't over scroll horizontally, set vx to 0 in
doFling. Otherwise if vx is greater than vy, as we
pin x later in onOverscrolled(), the fling doesn't
work as expected.
Fix http://b/issue?id=2507550
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index f60840b..390550f 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2301,15 +2301,18 @@
scrollBar.draw(canvas);
}
+ private boolean canOverscrollHorizontally() {
+ return (Math.abs(mMinZoomScale - mMaxZoomScale) >= MINIMUM_SCALE_INCREMENT)
+ && getSettings().supportZoom()
+ && getSettings().getUseWideViewPort();
+ }
+
@Override
protected void onOverscrolled(int scrollX, int scrollY, boolean clampedX,
boolean clampedY) {
mInOverScrollMode = false;
int maxX = computeMaxScrollX();
- if (maxX == 0 && (Math.abs(mMinZoomScale - mMaxZoomScale)
- < MINIMUM_SCALE_INCREMENT)
- || !getSettings().supportZoom()
- || !getSettings().getUseWideViewPort()) {
+ if (maxX == 0 && !canOverscrollHorizontally()) {
// do not over scroll x if the page just fits the screen and it
// can't zoom or the view doesn't use wide viewport
scrollX = pinLocX(scrollX);
@@ -5391,7 +5394,9 @@
vx = 0;
}
}
-
+ if (maxX == 0 && !canOverscrollHorizontally()) {
+ vx = 0;
+ }
if (true /* EMG release: make our fling more like Maps' */) {
// maps cuts their velocity in half
vx = vx * 3 / 4;