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

Unified Diff: ui/compositor/layer_animation_element.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_element.h ('k') | ui/compositor/layer_animation_element_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animation_element.cc
diff --git a/ui/compositor/layer_animation_element.cc b/ui/compositor/layer_animation_element.cc
index 2b41e84a912d5b84446c486f6cb8162b9cf66fab..ef18104e27ae4bc80c34a4bb04e385bbca57629f 100644
--- a/ui/compositor/layer_animation_element.cc
+++ b/ui/compositor/layer_animation_element.cc
@@ -405,15 +405,31 @@ LayerAnimationElement::LayerAnimationElement(
LayerAnimationElement::~LayerAnimationElement() {
}
-bool LayerAnimationElement::Progress(double t,
+bool LayerAnimationElement::Progress(base::TimeDelta elapsed,
LayerAnimationDelegate* delegate) {
if (first_frame_)
OnStart(delegate);
+ double t = 1.0;
+ if ((duration_ > base::TimeDelta()) && (elapsed < duration_))
+ t = elapsed.InMillisecondsF() / duration_.InMillisecondsF();
bool need_draw = OnProgress(Tween::CalculateValue(tween_type_, t), delegate);
first_frame_ = t == 1.0;
return need_draw;
}
+bool LayerAnimationElement::IsFinished(base::TimeDelta elapsed,
+ base::TimeDelta* total_duration) {
+ if (elapsed >= duration_) {
+ *total_duration = duration_;
+ return true;
+ }
+ return false;
+}
+
+bool LayerAnimationElement::ProgressToEnd(LayerAnimationDelegate* delegate) {
+ return Progress(duration_, delegate);
+}
+
void LayerAnimationElement::GetTargetValue(TargetValue* target) const {
OnGetTarget(target);
}
« no previous file with comments | « ui/compositor/layer_animation_element.h ('k') | ui/compositor/layer_animation_element_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698