ScrollbarAnimationController::ScrollbarAnimationController(
ScrollbarAnimationControllerClient* client,
base::TimeDelta delay_before_starting,
+ base::TimeDelta resize_delay_before_starting,
base::TimeDelta duration)
: client_(client),
delay_before_starting_(delay_before_starting),
+ resize_delay_before_starting_(resize_delay_before_starting),
duration_(duration),
is_animating_(false),
currently_scrolling_(false),
currently_scrolling_ = true;
}
-void ScrollbarAnimationController::DidScrollUpdate() {
+void ScrollbarAnimationController::DidScrollUpdate(bool on_resize) {
StopAnimation();
delayed_scrollbar_fade_.Cancel();
// As an optimization, we avoid spamming fade delay tasks during active fast
// scrolls. But if we're not within one, we need to post every scroll update.
if (!currently_scrolling_)
- PostDelayedFade();
+ PostDelayedFade(on_resize);
else
scroll_gesture_has_scrolled_ = true;
}
void ScrollbarAnimationController::DidScrollEnd() {
if (scroll_gesture_has_scrolled_) {
- PostDelayedFade();
+ PostDelayedFade(false);
scroll_gesture_has_scrolled_ = false;
}
currently_scrolling_ = false;
}
-void ScrollbarAnimationController::PostDelayedFade() {
+void ScrollbarAnimationController::PostDelayedFade(bool on_resize) {
+ base::TimeDelta delay =
+ on_resize ? resize_delay_before_starting_ : delay_before_starting_;
delayed_scrollbar_fade_.Reset(
base::Bind(&ScrollbarAnimationController::StartAnimation,
weak_factory_.GetWeakPtr()));
- client_->PostDelayedScrollbarFade(delayed_scrollbar_fade_.callback(),
- delay_before_starting_);
+ client_->PostDelayedScrollbarFade(delayed_scrollbar_fade_.callback(), delay);
}
void ScrollbarAnimationController::StartAnimation() {