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

Unified Diff: ui/gfx/compositor/layer_animator.cc

Issue 8362006: Reland r107720 - Enable the new layer animation framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with parent patch Created 9 years, 2 months 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: ui/gfx/compositor/layer_animator.cc
diff --git a/ui/gfx/compositor/layer_animator.cc b/ui/gfx/compositor/layer_animator.cc
index e737377c86c600ca0674470eba190fc75b18ee7f..7bb84c965dd5e1b155d39c3bc27de91398e44b8d 100644
--- a/ui/gfx/compositor/layer_animator.cc
+++ b/ui/gfx/compositor/layer_animator.cc
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "ui/base/animation/animation_container.h"
#include "ui/gfx/compositor/compositor.h"
+#include "ui/gfx/compositor/dummy_layer_animation_delegate.h"
#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/layer_animation_delegate.h"
#include "ui/gfx/compositor/layer_animation_sequence.h"
@@ -60,6 +61,12 @@ void LayerAnimator::SetTransform(const Transform& transform) {
transition_duration_)));
}
+Transform LayerAnimator::GetTargetTransform() const {
+ DummyLayerAnimationDelegate dummy(*delegate_);
+ SetTarget(&dummy);
+ return dummy.GetTransformForAnimation();
+}
+
void LayerAnimator::SetBounds(const gfx::Rect& bounds) {
if (transition_duration_ == base::TimeDelta())
delegate_->SetBoundsFromAnimation(bounds);
@@ -69,6 +76,12 @@ void LayerAnimator::SetBounds(const gfx::Rect& bounds) {
transition_duration_)));
}
+gfx::Rect LayerAnimator::GetTargetBounds() const {
+ DummyLayerAnimationDelegate dummy(*delegate_);
+ SetTarget(&dummy);
+ return dummy.GetBoundsForAnimation();
+}
+
void LayerAnimator::SetOpacity(float opacity) {
if (transition_duration_ == base::TimeDelta())
delegate_->SetOpacityFromAnimation(opacity);
@@ -78,6 +91,12 @@ void LayerAnimator::SetOpacity(float opacity) {
transition_duration_)));
}
+float LayerAnimator::GetTargetOpacity() const {
+ DummyLayerAnimationDelegate dummy(*delegate_);
+ SetTarget(&dummy);
+ return dummy.GetOpacityForAnimation();
+}
+
void LayerAnimator::SetDelegate(LayerAnimationDelegate* delegate) {
DCHECK(delegate);
delegate_ = delegate;
@@ -440,4 +459,16 @@ bool LayerAnimator::StartSequenceImmediately(LayerAnimationSequence* sequence) {
return true;
}
+void LayerAnimator::SetTarget(LayerAnimationDelegate* delegate) const {
+ for (RunningAnimations::const_iterator iter = running_animations_.begin();
+ iter != running_animations_.end(); ++iter) {
+ (*iter).sequence->SetTarget(delegate);
+ }
+
+ for (AnimationQueue::const_iterator iter = animation_queue_.begin();
+ iter != animation_queue_.end(); ++iter) {
+ (*iter)->SetTarget(delegate);
+ }
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698