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

Unified Diff: cc/input/scrollbar_animation_controller.cc

Issue 2611013002: Show Overlay Scrollbar when GestureScrollUpdate (Closed)
Patch Set: bokan comments addressed Created 3 years, 10 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/input/scrollbar_animation_controller.cc
diff --git a/cc/input/scrollbar_animation_controller.cc b/cc/input/scrollbar_animation_controller.cc
index c32a1e3b278200334a585a4053f0b4c05e0cc3b8..53014f1d7893623e3a8d8d01dd39973b50857a40 100644
--- a/cc/input/scrollbar_animation_controller.cc
+++ b/cc/input/scrollbar_animation_controller.cc
@@ -169,10 +169,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();
@@ -180,7 +176,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_ && mouse_is_near_any_scrollbar())
+ return;
+
+ if (has_scrolled)
+ PostDelayedFadeOut(false);
+}
+
+void ScrollbarAnimationController::WillUpdateScroll() {
if (need_thinning_animation_ && Captured())
return;
@@ -192,7 +207,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_ || !mouse_is_near_any_scrollbar())
- PostDelayedFadeOut(on_resize);
+ PostDelayedFadeOut(false);
} else {
scroll_gesture_has_scrolled_ = true;
}
@@ -205,19 +220,12 @@ 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_ && mouse_is_near_any_scrollbar())
- return;
-
- if (has_scrolled)
- PostDelayedFadeOut(false);
+void ScrollbarAnimationController::DidResize() {
+ StopAnimation();
+ FadeIn();
+ // 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() {

Powered by Google App Engine
This is Rietveld 408576698