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

Commit fd8d3ded authored by Ben Murdoch's avatar Ben Murdoch
Browse files

Don't redraw when not scrolling, even if finger is held down.

Signal the native side that we are not scrolling when a drag is
held motionless to stop screen updates.

Additionally, in the case that a drag is being held motionless,
send a timed message to keep the scroll bars on screen otherwise
they fade in and out, again causing repaints that shouldn't be
necessary.

Bug: 5440335
Change-Id: I94db0323879885fa48924b41d29e8af03e3b5e7f
parent 7a3ba4d7
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -4492,6 +4492,9 @@ public class WebView extends AbsoluteLayout
            if (mHeldMotionless == MOTIONLESS_FALSE) {
                mPrivateHandler.sendMessageDelayed(mPrivateHandler
                        .obtainMessage(DRAG_HELD_MOTIONLESS), MOTIONLESS_TIME);
                mPrivateHandler.sendMessageDelayed(mPrivateHandler
                        .obtainMessage(AWAKEN_SCROLL_BARS),
                            ViewConfiguration.getScrollDefaultDelay());
                mHeldMotionless = MOTIONLESS_PENDING;
            }
        }
@@ -5989,6 +5992,7 @@ public class WebView extends AbsoluteLayout
                    mTouchMode = TOUCH_DRAG_START_MODE;
                    mConfirmMove = true;
                    mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY);
                    nativeSetIsScrolling(false);
                } else if (mPrivateHandler.hasMessages(RELEASE_SINGLE_TAP)) {
                    mPrivateHandler.removeMessages(RELEASE_SINGLE_TAP);
                    if (USE_WEBKIT_RINGS || getSettings().supportTouchOnly()) {
@@ -6271,9 +6275,16 @@ public class WebView extends AbsoluteLayout
                    }
                    mLastTouchX = x;
                    mLastTouchY = y;
                    if ((deltaX | deltaY) != 0) {

                    if (deltaX * deltaX + deltaY * deltaY > mTouchSlopSquare) {
                        mHeldMotionless = MOTIONLESS_FALSE;
                        nativeSetIsScrolling(true);
                    } else {
                        mHeldMotionless = MOTIONLESS_TRUE;
                        nativeSetIsScrolling(false);
                        keepScrollBarsVisible = true;
                    }

                    mLastTouchTime = eventTime;
                }

@@ -6289,9 +6300,15 @@ public class WebView extends AbsoluteLayout
                    // keep the scrollbar on the screen even there is no scroll
                    awakenScrollBars(ViewConfiguration.getScrollDefaultDelay(),
                            false);
                    // Post a message so that we'll keep them alive while we're not scrolling.
                    mPrivateHandler.sendMessageDelayed(mPrivateHandler
                            .obtainMessage(AWAKEN_SCROLL_BARS),
                            ViewConfiguration.getScrollDefaultDelay());
                    // return false to indicate that we can't pan out of the
                    // view space
                    return !done;
                } else {
                    mPrivateHandler.removeMessages(AWAKEN_SCROLL_BARS);
                }
                break;
            }