Chromium Code Reviews| Index: ui/gfx/compositor/layer.h |
| diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h |
| index d94d4e6feb5187af8458ac5a6b0500875654e04c..d9371d5c81819336d17db8c7891cc5cf0a208387 100644 |
| --- a/ui/gfx/compositor/layer.h |
| +++ b/ui/gfx/compositor/layer.h |
| @@ -18,7 +18,6 @@ |
| #include "ui/gfx/rect.h" |
| #include "ui/gfx/transform.h" |
| #include "ui/gfx/compositor/compositor.h" |
| -#include "ui/gfx/compositor/layer_animation_manager.h" |
| #include "ui/gfx/compositor/layer_animator_delegate.h" |
| #include "ui/gfx/compositor/layer_delegate.h" |
| @@ -26,8 +25,9 @@ class SkCanvas; |
| namespace ui { |
| -class Animation; |
| class Compositor; |
| +class LayerAnimator; |
| +class LayerAnimationSequence; |
| class Texture; |
| // Layer manages a texture, transform and a set of child Layers. Any View that |
| @@ -84,21 +84,22 @@ class COMPOSITOR_EXPORT Layer : |
| // Returns true if this Layer contains |other| somewhere in its children. |
| bool Contains(const Layer* other) const; |
| - // Sets the animation to use for changes to opacity, position or transform. |
| - // That is, if you invoke this with non-NULL |animation| is started and any |
| - // changes to opacity, position or transform are animated between the current |
| - // value and target value. If the current animation is NULL or completed, |
| - // changes are immediate. If the opacity, transform or bounds are changed |
| - // and the animation is part way through, the animation is canceled and |
| - // the bounds, opacity and transfrom and set to the target value. |
| - // Layer takes ownership of |animation| and installs it's own delegate on the |
| - // animation. |
| - void SetAnimation(Animation* animation); |
| - bool has_animation() const { return animator_.get() != NULL; } |
| + // The layer's animator is responsible for causing automatic animations when |
| + // properties are set. It also manages a queue of pending animations and |
| + // handles blending of animations. |
| + void SetAnimator(LayerAnimator* animator); |
|
sky
2011/10/25 04:00:55
document ownership.
|
| + |
| + // Returns the layer's animator. Creates a default animator of one has not |
| + // been set. Will not return NULL. |
| + LayerAnimator* GetAnimator(); |
| // The transform, relative to the parent. |
| - void SetTransform(const ui::Transform& transform); |
| - const ui::Transform& transform() const { return transform_; } |
| + void SetTransform(const Transform& transform); |
| + const Transform& transform() const { return transform_; } |
| + |
| + // Return the target transform if animator is running, or the current |
| + // transform otherwise. |
| + Transform GetTargetTransform() const; |
| // The bounds, relative to the parent. |
| void SetBounds(const gfx::Rect& bounds); |
| @@ -113,6 +114,10 @@ class COMPOSITOR_EXPORT Layer : |
| float opacity() const { return opacity_; } |
| void SetOpacity(float opacity); |
| + // Return the target opacity if animator is running, or the current bounds |
| + // otherwise. |
| + float GetTargetOpacity() const; |
| + |
| // Sets the visibility of the Layer. A Layer may be visible but not |
| // drawn. This happens if any ancestor of a Layer is not visible. |
| void SetVisible(bool visible); |
| @@ -240,22 +245,21 @@ class COMPOSITOR_EXPORT Layer : |
| // should have valid alpha. |
| bool has_valid_alpha_channel() const { return !layer_updated_externally_; } |
| - // If the animation is running and has progressed, it is stopped and all |
| - // properties that are animated (except |property|) are immediately set to |
| - // their target value. |
| - void StopAnimatingIfNecessary( |
| - LayerAnimationManager::AnimationProperty property); |
| - |
| // Following are invoked from the animation or if no animation exists to |
| // update the values immediately. |
| void SetBoundsImmediately(const gfx::Rect& bounds); |
| void SetTransformImmediately(const ui::Transform& transform); |
| void SetOpacityImmediately(float opacity); |
| - // LayerAnimatorDelegate overrides: |
| - virtual void SetBoundsFromAnimator(const gfx::Rect& bounds) OVERRIDE; |
| - virtual void SetTransformFromAnimator(const Transform& transform) OVERRIDE; |
| - virtual void SetOpacityFromAnimator(float opacity) OVERRIDE; |
| + // Implementation of LayerAnimatorDelegate |
| + virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; |
| + virtual void SetTransformFromAnimation(const Transform& transform) OVERRIDE; |
| + virtual void SetOpacityFromAnimation(float opacity) OVERRIDE; |
| + virtual void ScheduleDrawForAnimation() OVERRIDE; |
| + virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE; |
| + virtual const Transform& GetTransformForAnimation() const OVERRIDE; |
| + virtual float GetOpacityForAnimation() const OVERRIDE; |
| + virtual void OnLayerAnimationEnded(LayerAnimationSequence* sequence) OVERRIDE; |
| #if defined(USE_WEBKIT_COMPOSITOR) |
| void CreateWebLayer(); |
| @@ -293,7 +297,7 @@ class COMPOSITOR_EXPORT Layer : |
| LayerDelegate* delegate_; |
| - scoped_ptr<LayerAnimationManager> animator_; |
| + scoped_ptr<LayerAnimator> animator_; |
| #if defined(USE_WEBKIT_COMPOSITOR) |
| WebKit::WebContentLayer web_layer_; |