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

Commit 83d4ba83 authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Do not attempt to retry a scrollTo with a negative position.

Fixes http://b/issue?id=2093435

Change-Id: If938c8f6e5d74b91e39a06a5736967663c9800b7
parent 6ed525ec
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -2484,8 +2484,11 @@ public class WebView extends AbsoluteLayout
    }
    }


    // scale from content to view coordinates, and pin
    // scale from content to view coordinates, and pin
    // return true if pin caused the final x/y different than the request cx/cy;
    // return true if pin caused the final x/y different than the request cx/cy,
    // return false if the view scroll to the exact position as it is requested.
    // and a future scroll may reach the request cx/cy after our size has
    // changed
    // return false if the view scroll to the exact position as it is requested,
    // where negative numbers are taken to mean 0
    private boolean setContentScrollTo(int cx, int cy) {
    private boolean setContentScrollTo(int cx, int cy) {
        if (mDrawHistory) {
        if (mDrawHistory) {
            // disallow WebView to change the scroll position as History Picture
            // disallow WebView to change the scroll position as History Picture
@@ -2500,7 +2503,9 @@ public class WebView extends AbsoluteLayout
//        Log.d(LOGTAG, "content scrollTo [" + cx + " " + cy + "] view=[" +
//        Log.d(LOGTAG, "content scrollTo [" + cx + " " + cy + "] view=[" +
//                      vx + " " + vy + "]");
//                      vx + " " + vy + "]");
        pinScrollTo(vx, vy, false, 0);
        pinScrollTo(vx, vy, false, 0);
        if (mScrollX != vx || mScrollY != vy) {
        // If the request was to scroll to a negative coordinate, treat it as if
        // it was a request to scroll to 0
        if ((mScrollX != vx && cx >= 0) || (mScrollY != vy && cy >= 0)) {
            return true;
            return true;
        } else {
        } else {
            return false;
            return false;