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

Unified Diff: cc/input/top_controls_manager.cc

Issue 719453007: Make Keyframe use TimeTicks/TimeDelta to represent time instead of double. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/top_controls_manager.cc
diff --git a/cc/input/top_controls_manager.cc b/cc/input/top_controls_manager.cc
index cd3534c17647ab305480bc82ef99c44c6ad5816c..dade329972a62b34c635bc54c93063d3e1176c38 100644
--- a/cc/input/top_controls_manager.cc
+++ b/cc/input/top_controls_manager.cc
@@ -167,7 +167,7 @@ gfx::Vector2dF TopControlsManager::Animate(base::TimeTicks monotonic_time) {
if (!top_controls_animation_ || !client_->HaveRootScrollLayer())
return gfx::Vector2dF();
- double time = (monotonic_time - base::TimeTicks()).InMillisecondsF();
+ base::TimeDelta time = monotonic_time - base::TimeTicks();
ajuma 2014/11/14 15:12:33 The existing code treats time as a value in millis
patro 2014/11/17 13:26:47 No tests are not failing in top_controls_manager_u
float old_offset = client_->ControlsTopOffset();
SetControlsTopOffset(top_controls_animation_->GetValue(time));
@@ -199,16 +199,15 @@ void TopControlsManager::SetupAnimation(AnimationDirection direction) {
return;
top_controls_animation_ = KeyframedFloatAnimationCurve::Create();
- double start_time =
- (gfx::FrameTime::Now() - base::TimeTicks()).InMillisecondsF();
+ base::TimeDelta start_time = gfx::FrameTime::Now() - base::TimeTicks();
ajuma 2014/11/14 15:12:33 Same comment as above.
patro 2014/11/17 13:26:47 Done.
top_controls_animation_->AddKeyframe(
FloatKeyframe::Create(start_time, client_->ControlsTopOffset(), nullptr));
float max_ending_offset =
(direction == SHOWING_CONTROLS ? 1 : -1) * top_controls_height_;
- top_controls_animation_->AddKeyframe(
- FloatKeyframe::Create(start_time + kShowHideMaxDurationMs,
- client_->ControlsTopOffset() + max_ending_offset,
- EaseTimingFunction::Create()));
+ top_controls_animation_->AddKeyframe(FloatKeyframe::Create(
+ start_time + base::TimeDelta::FromMilliseconds(kShowHideMaxDurationMs),
+ client_->ControlsTopOffset() + max_ending_offset,
+ EaseTimingFunction::Create()));
animation_direction_ = direction;
client_->DidChangeTopControlsPosition();
}
@@ -241,7 +240,7 @@ bool TopControlsManager::IsAnimationCompleteAtTime(base::TimeTicks time) {
if (!top_controls_animation_)
return true;
- double time_ms = (time - base::TimeTicks()).InMillisecondsF();
+ base::TimeDelta time_ms = time - base::TimeTicks();
ajuma 2014/11/14 15:12:33 Here too.
patro 2014/11/17 13:26:47 Done.
float new_offset = top_controls_animation_->GetValue(time_ms);
if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) ||

Powered by Google App Engine
This is Rietveld 408576698