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

Unified Diff: cc/scrollbar_animation_controller_linear_fade.cc

Issue 12408028: cc: Delay start of scrollbar animation setNeedsRedraw. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to 187970 and update test Created 7 years, 9 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/scrollbar_animation_controller_linear_fade.cc
diff --git a/cc/scrollbar_animation_controller_linear_fade.cc b/cc/scrollbar_animation_controller_linear_fade.cc
index 89e998def9fda05f61fc404c2f82caaa17e3c18b..cb01b4974ab056c5ca96998494363c27f03173a8 100644
--- a/cc/scrollbar_animation_controller_linear_fade.cc
+++ b/cc/scrollbar_animation_controller_linear_fade.cc
@@ -28,34 +28,38 @@ ScrollbarAnimationControllerLinearFade::~ScrollbarAnimationControllerLinearFade(
{
}
+double ScrollbarAnimationControllerLinearFade::secondsBeforeStart(base::TimeTicks now) const
+{
+ if (m_lastAwakenTime.is_null())
+ return -1;
+
+ double delta = (now - m_lastAwakenTime).InSecondsF();
+ return std::max(0.0, m_fadeoutDelay - delta);
+}
+
bool ScrollbarAnimationControllerLinearFade::animate(base::TimeTicks now)
{
float opacity = opacityAtTime(now);
m_scrollLayer->SetScrollbarOpacity(opacity);
- return opacity;
+ if (!opacity)
+ m_lastAwakenTime = base::TimeTicks();
+ return secondsBeforeStart(now) == 0;
}
void ScrollbarAnimationControllerLinearFade::didPinchGestureUpdate(base::TimeTicks now)
{
- m_pinchGestureInEffect = true;
-}
-
-void ScrollbarAnimationControllerLinearFade::didPinchGestureEnd(base::TimeTicks now)
-{
- m_pinchGestureInEffect = false;
m_lastAwakenTime = now;
+ m_scrollLayer->SetScrollbarOpacity(1);
}
void ScrollbarAnimationControllerLinearFade::didUpdateScrollOffset(base::TimeTicks now)
{
m_lastAwakenTime = now;
+ m_scrollLayer->SetScrollbarOpacity(1);
}
float ScrollbarAnimationControllerLinearFade::opacityAtTime(base::TimeTicks now)
{
- if (m_pinchGestureInEffect)
- return 1;
-
if (m_lastAwakenTime.is_null())
return 0;

Powered by Google App Engine
This is Rietveld 408576698