• Rahul Arakeri's avatar
    Fix for pointermove arriving before a GSB is dispatched. · 4019383a
    Rahul Arakeri authored
    When a user clicks and drags the thumb, the sequence of events that
    gets generated is pointerdown, pointermoves(s), pointerup. The very
    first pointerdown sets up the state necessary for the scrollbar thumb
    drag. The pointerdown also injects a synthetic GestureScrollBegin in
    the CompositorThreadEventQueue. However, this GSB won't get dispatched
    until the next VSync. Sometimes, a pointerdown and the following
    pointermove can arrive at the ScrollbarController before the GSB is
    dispatched at the VSync. When this happens, the value of the
    currently_scrolling_node is null (since the GSB wasn't dispatched yet).
    This in turn causes the drag_state_ to be nullopt and we get stuck in
    a state where thumb drag doesn't work (because we keep early'ing out in
    ScrollbarController::HandlePointerMove).
    
    The fix here is to use ScrollbarLayerImplBase::scroll_element_id() to
    look up the target node. That way, even tough the pointermove arrives
    before the GSB, the node to be scrolled can still be queried by
    ScrollbarController::HandlePointerMove.
    
    Bug: 1057929
    Change-Id: I5cd584b9298c97fc2feb058aa6b46d264f0cdc17
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2085533
    Commit-Queue: Rahul Arakeri <arakeri@microsoft.com>
    Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#747411}
    4019383a
scrollbar_controller.cc 31.1 KB