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

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

Issue 8362006: Reland r107720 - Enable the new layer animation framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Enable framework for aura 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.h
diff --git a/ui/gfx/compositor/layer_animator.h b/ui/gfx/compositor/layer_animator.h
index a51079c46a8e205e73c5fa94eea84aa01c2fced0..6853f7c2f9f82efd8c3ec27795ee6fbb44fb68f6 100644
--- a/ui/gfx/compositor/layer_animator.h
+++ b/ui/gfx/compositor/layer_animator.h
@@ -24,11 +24,11 @@ namespace ui {
class Animation;
class Layer;
class LayerAnimationSequence;
+class LayerAnimatorDelegate;
class Transform;
// When a property of layer needs to be changed it is set by way of
-// LayerAnimator. This enables LayerAnimator to animate property
-// changes.
+// LayerAnimator. This enables LayerAnimator to animate property changes.
class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
public:
enum PreemptionStrategy {
@@ -50,16 +50,19 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
// Sets the transform on the delegate. May cause an implicit animation.
virtual void SetTransform(const Transform& transform);
+ Transform GetTargetTransform() const;
// Sets the bounds on the delegate. May cause an implicit animation.
virtual void SetBounds(const gfx::Rect& bounds);
+ gfx::Rect GetTargetBounds() const;
// Sets the opacity on the delegate. May cause an implicit animation.
virtual void SetOpacity(float opacity);
+ float GetTargetOpacity() const;
// Sets the layer animation delegate the animator is associated with. The
// animator does not own the delegate.
- void SetDelegate(LayerAnimationDelegate* delegate);
+ void SetDelegate(LayerAnimatorDelegate* delegate);
// Sets the animation preemption strategy. This determines the behaviour if
// a property is set during an animation. The default is
@@ -72,15 +75,18 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
// progress, it needs to be interrupted with the new animation. The animator
// takes ownership of this animation sequence.
void StartAnimation(LayerAnimationSequence* animation);
+ void StartAnimation(LayerAnimationElement* animation);
sky 2011/10/25 04:00:55 Style guide doesn't like methods with the same nam
// Schedule an animation to be run when possible. The animator takes ownership
// of this animation sequence.
void ScheduleAnimation(LayerAnimationSequence* animation);
+ void ScheduleAnimation(LayerAnimationElement* animation);
// Schedules the animations to be run together. Obviously will no work if
// they animate any common properties. The animator takes ownership of the
// animation sequences.
void ScheduleTogether(const std::vector<LayerAnimationSequence*>& animations);
+ void ScheduleTogether(const std::vector<LayerAnimationElement*>& animations);
// Returns true if there is an animation in the queue (animations remain in
// the queue until they complete).
@@ -101,10 +107,24 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
}
base::TimeTicks get_last_step_time_for_test() { return last_step_time_; }
+ class TransientSettings {
sky 2011/10/25 00:26:59 This name is confusing. Maybe ScopedSettings or so
+ public:
+ TransientSettings(LayerAnimator* animator);
sky 2011/10/25 00:26:59 explicit
+ ~TransientSettings();
+
+ void SetTransitionDuration(base::TimeDelta duration);
+
+ private:
+ LayerAnimator* animator_;
+ base::TimeDelta old_transition_duration_;
+ };
sky 2011/10/25 00:26:59 DISALLOW_COPY_AND_ASSIGN
+
protected:
- LayerAnimationDelegate* delegate() { return delegate_; }
+ LayerAnimatorDelegate* delegate() { return delegate_; }
private:
+ friend class TransientSettings;
+
// We need to keep track of the start time of every running animation.
struct RunningAnimation {
RunningAnimation(LayerAnimationSequence* sequence,
@@ -176,11 +196,15 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
// properties affected by |sequence|.
bool StartSequenceImmediately(LayerAnimationSequence* sequence);
+ // Sets the value of target as if all the running and queued animations were
+ // allowed to finish.
+ void GetTargetValue(LayerAnimationElement::TargetValue* target) const;
+
// This is the queue of animations to run.
AnimationQueue animation_queue_;
// The target of all layer animations.
- LayerAnimationDelegate* delegate_;
+ LayerAnimatorDelegate* delegate_;
// The currently running animations.
RunningAnimations running_animations_;

Powered by Google App Engine
This is Rietveld 408576698