Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2007)

Unified Diff: cc/animation/scrollbar_animation_controller.cc

Issue 608223002: [Android]Increase Scrollbar fade delay on Resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/animation/scrollbar_animation_controller.cc
diff --git a/cc/animation/scrollbar_animation_controller.cc b/cc/animation/scrollbar_animation_controller.cc
index 910a7d8c1398be740afbd0971f7220f05ca36eda..ffb22870825618a4a9e6e4bff1b58c5eeebb0c1e 100644
--- a/cc/animation/scrollbar_animation_controller.cc
+++ b/cc/animation/scrollbar_animation_controller.cc
@@ -13,9 +13,11 @@ namespace cc {
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),
@@ -53,33 +55,34 @@ void ScrollbarAnimationController::DidScrollBegin() {
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() {
« no previous file with comments | « cc/animation/scrollbar_animation_controller.h ('k') | cc/animation/scrollbar_animation_controller_linear_fade.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698