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

Unified Diff: cc/input/scrollbar_animation_controller.cc

Issue 2611013002: Show Overlay Scrollbar when GestureScrollUpdate (Closed)
Patch Set: rebase & merge 2716453005 & fix tests 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 6927d0415738fc93435406bdeb0fcd3f8f30db1d..537b6cc22a9843f2c474828925c4512cdae5f836 100644
--- a/cc/input/scrollbar_animation_controller.cc
+++ b/cc/input/scrollbar_animation_controller.cc
@@ -162,10 +162,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();
@@ -173,7 +169,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;
@@ -185,7 +200,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;
}
@@ -198,19 +213,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