diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-11-18 16:35:47 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-11-18 15:45:54 +0000 |
commit | 32f5a1c56531e4210bc4cf8d8c7825d66e081888 (patch) | |
tree | eeeec6822f4d738d8454525233fd0e2e3a659e6d /chromium/cc/input/scrollbar_controller.cc | |
parent | 99677208ff3b216fdfec551fbe548da5520cd6fb (diff) |
BASELINE: Update Chromium to 87.0.4280.67
Change-Id: Ib157360be8c2ffb2c73125751a89f60e049c1d54
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/cc/input/scrollbar_controller.cc')
-rw-r--r-- | chromium/cc/input/scrollbar_controller.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/chromium/cc/input/scrollbar_controller.cc b/chromium/cc/input/scrollbar_controller.cc index 3a3f008082a..b7df237891f 100644 --- a/chromium/cc/input/scrollbar_controller.cc +++ b/chromium/cc/input/scrollbar_controller.cc @@ -99,7 +99,11 @@ InputHandlerPointerResult ScrollbarController::HandlePointerDown( scrollbar_scroll_is_active_ = true; scroll_result.scroll_units = Granularity(scrollbar_part, perform_jump_click_on_track); - if (scrollbar_part == ScrollbarPart::THUMB) { + + // Initialize drag state if either the scrollbar thumb is being dragged OR the + // user has initiated a jump click (since the thumb would have jumped under + // the pointer). + if (scrollbar_part == ScrollbarPart::THUMB || perform_jump_click_on_track) { drag_state_ = DragState(); bool clipped = false; drag_state_->drag_origin = @@ -109,13 +113,21 @@ InputHandlerPointerResult ScrollbarController::HandlePointerDown( // Record the current scroller offset. This will be needed to snap the // thumb back to its original position if the pointer moves too far away - // from the track during a thumb drag. - drag_state_->scroll_position_at_start_ = scrollbar->current_pos(); + // from the track during a thumb drag. Additionally, if a thumb drag is + // being initiated *after* a jump click, scroll_position_at_start_ needs + // to account for that. + const float jump_click_thumb_drag_offset = + scrollbar->orientation() == ScrollbarOrientation::HORIZONTAL + ? scroll_result.scroll_offset.x() + : scroll_result.scroll_offset.y(); + drag_state_->scroll_position_at_start_ = + scrollbar->current_pos() + + (perform_jump_click_on_track ? jump_click_thumb_drag_offset : 0); drag_state_->scroller_length_at_previous_move = scrollbar->scroll_layer_length(); } - if (!scroll_result.scroll_offset.IsZero()) { + if (!scroll_result.scroll_offset.IsZero() && !perform_jump_click_on_track) { // Thumb drag is the only scrollbar manipulation that cannot produce an // autoscroll. All other interactions like clicking on arrows/trackparts // have the potential of initiating an autoscroll (if held down for long @@ -686,6 +698,8 @@ int ScrollbarController::GetScrollDeltaForScrollbarPart( scroll_delta = GetScrollDeltaForAbsoluteJump(); break; } + // TODO(savella) Use snapport length instead of viewport length to match + // main thread behaviour. See https://crbug.com/1098383. scroll_delta = GetViewportLength() * kMinFractionToStepWhenPaging; break; } |