Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2563ffb8 authored by Grace Kloba's avatar Grace Kloba
Browse files

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
parent 72611288
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -2301,15 +2301,18 @@ public class WebView extends AbsoluteLayout
        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 @@ public class WebView extends AbsoluteLayout
                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;