Index: cc/input/page_scale_animation.cc |
diff --git a/cc/input/page_scale_animation.cc b/cc/input/page_scale_animation.cc |
index 7df0244ec0907a1466bc2ab9625c147fe075d754..a216cfd2c60f4568938b58fdd3cd19e2a6cbbb3a 100644 |
--- a/cc/input/page_scale_animation.cc |
+++ b/cc/input/page_scale_animation.cc |
@@ -166,33 +166,34 @@ bool PageScaleAnimation::IsAnimationStarted() const { |
return start_time_ >= 0; |
} |
-void PageScaleAnimation::StartAnimation(double time) { |
+void PageScaleAnimation::StartAnimation(base::TimeTicks time) { |
DCHECK_GT(0, start_time_); |
- start_time_ = time; |
+ start_time_ = (time - base::TimeTicks()).InSecondsF(); |
} |
-gfx::Vector2dF PageScaleAnimation::ScrollOffsetAtTime(double time) const { |
+gfx::Vector2dF PageScaleAnimation::ScrollOffsetAtTime( |
+ base::TimeTicks time) const { |
DCHECK_GE(start_time_, 0); |
return ScrollOffsetAt(InterpAtTime(time)); |
} |
-float PageScaleAnimation::PageScaleFactorAtTime(double time) const { |
+float PageScaleAnimation::PageScaleFactorAtTime(base::TimeTicks time) const { |
DCHECK_GE(start_time_, 0); |
return PageScaleFactorAt(InterpAtTime(time)); |
} |
-bool PageScaleAnimation::IsAnimationCompleteAtTime(double time) const { |
+bool PageScaleAnimation::IsAnimationCompleteAtTime(base::TimeTicks time) const { |
DCHECK_GE(start_time_, 0); |
- return time >= end_time(); |
+ return (time - base::TimeTicks()).InSecondsF() >= end_time(); |
} |
-float PageScaleAnimation::InterpAtTime(double time) const { |
+float PageScaleAnimation::InterpAtTime(base::TimeTicks time) const { |
DCHECK_GE(start_time_, 0); |
- DCHECK_GE(time, start_time_); |
+ DCHECK_GE((time - base::TimeTicks()).InSecondsF(), start_time_); |
if (IsAnimationCompleteAtTime(time)) |
return 1.f; |
- |
- const double normalized_time = (time - start_time_) / duration_; |
+ double monotonic_time = (time - base::TimeTicks()).InSecondsF(); |
+ const double normalized_time = (monotonic_time - start_time_) / duration_; |
return timing_function_->GetValue(normalized_time); |
} |