Index: cc/animation/animation.cc |
diff --git a/cc/animation/animation.cc b/cc/animation/animation.cc |
index 47ebaa3a358f5c7581c3151485e80823b9b800e9..a317d03ff9878517ee91eafce301829c33eb2df2 100644 |
--- a/cc/animation/animation.cc |
+++ b/cc/animation/animation.cc |
@@ -66,6 +66,7 @@ Animation::Animation(scoped_ptr<AnimationCurve> curve, |
iterations_(1), |
direction_(Normal), |
playback_rate_(1), |
+ fill_mode_(FillModeNone), |
needs_synchronized_start_time_(false), |
received_finished_event_(false), |
suspended_(false), |
@@ -158,12 +159,13 @@ bool Animation::IsFinishedAt(base::TimeTicks monotonic_time) const { |
.InSecondsF(); |
} |
-double Animation::TrimTimeToCurrentIteration( |
- base::TimeTicks monotonic_time) const { |
- base::TimeTicks trimmed = monotonic_time + time_offset_; |
+bool Animation::NoEffectBeforeAnimation(base::TimeTicks monotonic_time) const { |
dstockwell
2014/09/18 00:14:29
This method name is a little strange, perhaps just
samli
2014/09/18 00:59:55
Done.
|
+ return ConvertToActiveTime(monotonic_time) < 0 && |
+ (fill_mode_ == FillModeNone || fill_mode_ == FillModeForwards); |
+} |
- // Zero playback rate not supported |
- DCHECK(playback_rate_); |
+double Animation::ConvertToActiveTime(base::TimeTicks monotonic_time) const { |
+ base::TimeTicks trimmed = monotonic_time + time_offset_; |
// If we're paused, time is 'stuck' at the pause time. |
if (run_state_ == Paused) |
@@ -179,7 +181,15 @@ double Animation::TrimTimeToCurrentIteration( |
needs_synchronized_start_time()) |
trimmed = base::TimeTicks() + time_offset_; |
- double active_time = (trimmed - base::TimeTicks()).InSecondsF(); |
+ return (trimmed - base::TimeTicks()).InSecondsF(); |
+} |
+ |
+double Animation::TrimTimeToCurrentIteration( |
+ base::TimeTicks monotonic_time) const { |
+ // Zero playback rate not supported |
+ DCHECK(playback_rate_); |
+ |
+ double active_time = ConvertToActiveTime(monotonic_time); |
// Return 0 if we are before the start of the animation |
if (active_time < 0) |
@@ -256,6 +266,7 @@ scoped_ptr<Animation> Animation::CloneAndInitialize( |
to_return->time_offset_ = time_offset_; |
to_return->direction_ = direction_; |
to_return->playback_rate_ = playback_rate_; |
+ to_return->fill_mode_ = fill_mode_; |
DCHECK(!to_return->is_controlling_instance_); |
to_return->is_controlling_instance_ = true; |
return to_return.Pass(); |