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..da3ba8a2e204235b935a5fa88d0dc97c5c5ff269 100644 |
--- a/cc/input/scrollbar_animation_controller.cc |
+++ b/cc/input/scrollbar_animation_controller.cc |
@@ -53,6 +53,7 @@ ScrollbarAnimationController::ScrollbarAnimationController( |
scroll_gesture_has_scrolled_(false), |
opacity_(0.0f), |
fade_out_duration_(fade_out_duration), |
+ show_scrollbars_on_scroll_gesture_(false), |
need_thinning_animation_(false), |
weak_factory_(this) { |
ApplyOpacityToScrollbars(0.0f); |
@@ -77,6 +78,7 @@ ScrollbarAnimationController::ScrollbarAnimationController( |
scroll_gesture_has_scrolled_(false), |
opacity_(0.0f), |
fade_out_duration_(fade_out_duration), |
+ show_scrollbars_on_scroll_gesture_(true), |
need_thinning_animation_(true), |
weak_factory_(this) { |
vertical_controller_ = SingleScrollbarAnimationControllerThinning::Create( |
@@ -166,10 +168,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 +175,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 +206,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 +219,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 (show_scrollbars_on_scroll_gesture_) |
+ 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() { |