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 4906ef4737db1921018b018ad1b8243652714805..bf61b62fedef8b42d450ca2e2dd7a17f91326e89 100644 |
| --- a/cc/input/scrollbar_animation_controller.cc |
| +++ b/cc/input/scrollbar_animation_controller.cc |
| @@ -166,10 +166,6 @@ float ScrollbarAnimationController::AnimationProgressAtTime( |
| return std::max(std::min(progress, 1.f), 0.f); |
| } |
| -void ScrollbarAnimationController::DidScrollBegin() { |
| - currently_scrolling_ = true; |
| -} |
| - |
| void ScrollbarAnimationController::RunAnimationFrame(float progress) { |
| ApplyOpacityToScrollbars(1.f - progress); |
| client_->SetNeedsRedrawForScrollbarAnimation(); |
| @@ -177,7 +173,26 @@ void ScrollbarAnimationController::RunAnimationFrame(float progress) { |
| StopAnimation(); |
| } |
| -void ScrollbarAnimationController::DidScrollUpdate(bool on_resize) { |
| +void ScrollbarAnimationController::DidScrollBegin() { |
| + currently_scrolling_ = true; |
| +} |
| + |
| +void ScrollbarAnimationController::DidScrollEnd() { |
| + bool has_scrolled = scroll_gesture_has_scrolled_; |
| + scroll_gesture_has_scrolled_ = false; |
| + |
| + currently_scrolling_ = false; |
| + |
| + // We don't fade out scrollbar if they need thinning animation and mouse is |
| + // near. |
| + if (need_thinning_animation_ && MouseIsNearAnyScrollbar()) |
| + return; |
| + |
| + if (has_scrolled) |
| + PostDelayedFadeOut(false); |
| +} |
| + |
| +void ScrollbarAnimationController::DidScrollUpdate() { |
| if (need_thinning_animation_ && Captured()) |
| return; |
| @@ -189,7 +204,7 @@ void ScrollbarAnimationController::DidScrollUpdate(bool on_resize) { |
| // We don't fade out scrollbar if they need thinning animation and mouse is |
| // near. |
| if (!need_thinning_animation_ || !MouseIsNearAnyScrollbar()) |
| - PostDelayedFadeOut(on_resize); |
| + PostDelayedFadeOut(false); |
| } else { |
| scroll_gesture_has_scrolled_ = true; |
| } |
| @@ -202,19 +217,17 @@ void ScrollbarAnimationController::DidScrollUpdate(bool on_resize) { |
| } |
| } |
| -void ScrollbarAnimationController::DidScrollEnd() { |
| - bool has_scrolled = scroll_gesture_has_scrolled_; |
| - scroll_gesture_has_scrolled_ = false; |
| - |
| - currently_scrolling_ = false; |
| - |
| - // We don't fade out scrollbar if they need thinning animation and mouse is |
| - // near. |
| - if (need_thinning_animation_ && MouseIsNearAnyScrollbar()) |
| - return; |
| +void ScrollbarAnimationController::WillUpdateScroll() { |
| + if (need_thinning_animation_) |
|
bokan
2017/03/09 15:57:58
Instead of using need_thinning_animation_, add a b
|
| + DidScrollUpdate(); |
| +} |
| - if (has_scrolled) |
| - PostDelayedFadeOut(false); |
| +void ScrollbarAnimationController::DidResize() { |
| + StopAnimation(); |
| + Show(); |
| + // We should use the gesture delay rather than the resize delay if we're in a |
| + // gesture scroll, even if it is resizing. |
| + PostDelayedFadeOut(!currently_scrolling_); |
| } |
| void ScrollbarAnimationController::DidMouseDown() { |