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

Unified Diff: ui/compositor/layer_animator.cc

Issue 11316315: Remove ui::LayerAnimationSequence::duration and ui::LayerAnimationElement::duration. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Make unit tests use IsFinished() instead of duration() Created 8 years 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
« no previous file with comments | « ui/compositor/layer_animation_sequence_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animator.cc
diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc
index a6fcd7da224a9652803421f4f82ce9ab0ebd958e..98261fe539e1e287eb62f6cedcd082f70cc12c8a 100644
--- a/ui/compositor/layer_animator.cc
+++ b/ui/compositor/layer_animator.cc
@@ -333,7 +333,10 @@ void LayerAnimator::ProgressAnimation(LayerAnimationSequence* sequence,
}
void LayerAnimator::ProgressAnimationToEnd(LayerAnimationSequence* sequence) {
- ProgressAnimation(sequence, sequence->duration());
+ if (!delegate())
+ return;
+
+ sequence->ProgressToEnd(delegate());
}
@@ -365,8 +368,7 @@ void LayerAnimator::Step(base::TimeTicks now) {
continue;
base::TimeDelta delta = now - running_animations_copy[i].start_time();
- if (delta >= running_animations_copy[i].sequence()->duration() &&
- !running_animations_copy[i].sequence()->is_cyclic()) {
+ if (running_animations_copy[i].sequence()->IsFinished(delta)) {
SAFE_INVOKE_VOID(FinishAnimation, running_animations_copy[i]);
} else
SAFE_INVOKE_VOID(ProgressAnimation, running_animations_copy[i], delta);
@@ -423,8 +425,7 @@ LayerAnimationSequence* LayerAnimator::RemoveAnimation(
void LayerAnimator::FinishAnimation(LayerAnimationSequence* sequence) {
scoped_refptr<LayerAnimator> retain(this);
scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence));
- if (delegate())
- sequence->Progress(sequence->duration(), delegate());
+ ProgressAnimationToEnd(sequence);
ProcessQueue();
UpdateAnimationState();
}
@@ -439,8 +440,7 @@ void LayerAnimator::FinishAnyAnimationWithZeroDuration() {
if (!SAFE_INVOKE_BOOL(HasAnimation, running_animations_copy[i]))
continue;
- if (running_animations_copy[i].sequence()->duration() ==
- base::TimeDelta()) {
+ if (running_animations_copy[i].sequence()->IsFinished(base::TimeDelta())) {
SAFE_INVOKE_VOID(ProgressAnimationToEnd, running_animations_copy[i]);
scoped_ptr<LayerAnimationSequence> removed(
SAFE_INVOKE_PTR(RemoveAnimation, running_animations_copy[i]));
@@ -540,7 +540,7 @@ void LayerAnimator::ImmediatelySetNewTarget(LayerAnimationSequence* sequence) {
if (!weak_sequence_ptr)
return;
- ProgressAnimation(sequence, sequence->duration());
+ ProgressAnimationToEnd(sequence);
if (!weak_sequence_ptr)
return;
« no previous file with comments | « ui/compositor/layer_animation_sequence_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698