Chromium Code Reviews| Index: cc/input/scrollbar_animation_controller.cc |
| diff --git a/cc/input/scrollbar_animation_controller.cc b/cc/input/scrollbar_animation_controller.cc |
| index 6d504cecdc40903608d9b35336909c739504fdc4..d961afc8ffa760be4e5136faa9a6c0e3caf577d4 100644 |
| --- a/cc/input/scrollbar_animation_controller.cc |
| +++ b/cc/input/scrollbar_animation_controller.cc |
| @@ -102,6 +102,7 @@ ScrollbarAnimationController::GetScrollbarAnimationController( |
| void ScrollbarAnimationController::StartAnimation() { |
| DCHECK(animation_change_ != NONE); |
| delayed_scrollbar_animation_.Cancel(); |
| + need_trigger_scrollbar_fade_in_ = false; |
| is_animating_ = true; |
| last_awaken_time_ = base::TimeTicks(); |
| client_->SetNeedsAnimateForScrollbarAnimation(); |
| @@ -109,6 +110,7 @@ void ScrollbarAnimationController::StartAnimation() { |
| void ScrollbarAnimationController::StopAnimation() { |
| delayed_scrollbar_animation_.Cancel(); |
| + need_trigger_scrollbar_fade_in_ = false; |
| is_animating_ = false; |
| animation_change_ = NONE; |
| } |
| @@ -224,22 +226,39 @@ void ScrollbarAnimationController::DidRequestShowFromMainThread() { |
| } |
| void ScrollbarAnimationController::DidMouseDown() { |
| - if (!need_thinning_animation_ || ScrollbarsHidden()) |
| + if (!need_thinning_animation_) |
| + return; |
| + |
| + if (ScrollbarsHidden()) { |
| + if (need_trigger_scrollbar_fade_in_) { |
| + delayed_scrollbar_animation_.Cancel(); |
| + need_trigger_scrollbar_fade_in_ = false; |
| + } |
| return; |
| + } |
| vertical_controller_->DidMouseDown(); |
| horizontal_controller_->DidMouseDown(); |
| } |
| void ScrollbarAnimationController::DidMouseUp() { |
| - if (!need_thinning_animation_ || !Captured()) |
| + if (!need_thinning_animation_) |
| return; |
| + if (!Captured()) { |
| + if (MouseIsNearAnyScrollbar() && ScrollbarsHidden()) { |
| + PostDelayedAnimation(FADE_IN); |
| + need_trigger_scrollbar_fade_in_ = true; |
| + } |
| + return; |
| + } |
| + |
| vertical_controller_->DidMouseUp(); |
| horizontal_controller_->DidMouseUp(); |
| - if (!MouseIsNearAnyScrollbar()) |
| + if (!MouseIsNearAnyScrollbar() && !ScrollbarsHidden()) { |
|
bokan
2017/06/08 14:02:38
Nit: no braces
|
| PostDelayedAnimation(FADE_OUT); |
| + } |
| } |
| void ScrollbarAnimationController::DidMouseLeave() { |
| @@ -259,7 +278,8 @@ void ScrollbarAnimationController::DidMouseLeave() { |
| } |
| void ScrollbarAnimationController::DidMouseMove( |
| - const gfx::PointF& device_viewport_point) { |
| + const gfx::PointF& device_viewport_point, |
| + bool is_mouse_down) { |
| if (!need_thinning_animation_) |
| return; |
| @@ -268,12 +288,15 @@ void ScrollbarAnimationController::DidMouseMove( |
| vertical_controller_->DidMouseMove(device_viewport_point); |
| horizontal_controller_->DidMouseMove(device_viewport_point); |
| - need_trigger_scrollbar_fade_in_ = MouseIsNearAnyScrollbar(); |
| - |
| if (Captured()) |
|
bokan
2017/06/08 14:02:38
Could you add a DCHECK that if we're Captured() th
|
| return; |
| if (ScrollbarsHidden()) { |
| + // Do not fade in scrollbar when user interacting with the content below |
| + // scrollbar. |
| + if (is_mouse_down) |
| + return; |
| + need_trigger_scrollbar_fade_in_ = MouseIsNearAnyScrollbar(); |
| if (need_trigger_scrollbar_fade_in_before != |
| need_trigger_scrollbar_fade_in_) { |
| if (need_trigger_scrollbar_fade_in_) { |