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

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: Merge 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
« no previous file with comments | « ui/gfx/compositor/layer_animation_sequence_unittest.cc ('k') | ui/gfx/compositor/layer_animator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e6751ffc12c69c1e3e27221cdd31ed887418db58 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
@@ -82,6 +85,14 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
// animation sequences.
void ScheduleTogether(const std::vector<LayerAnimationSequence*>& animations);
+ // These are cover functions that create sequences for you to wrap the given
+ // elements. These sequences are then passed to the corresponding function
+ // above.
+ void StartAnimationElement(LayerAnimationElement* element);
+ void ScheduleAnimationElement(LayerAnimationElement* element);
+ void ScheduleElementsTogether(
+ const std::vector<LayerAnimationElement*>& element);
+
// Returns true if there is an animation in the queue (animations remain in
// the queue until they complete).
bool is_animating() const { return !animation_queue_.empty(); }
@@ -101,10 +112,30 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
}
base::TimeTicks get_last_step_time_for_test() { return last_step_time_; }
+ // Scoped settings allow you to temporarily change the animator's settings and
+ // these changes are reverted when the object is destroyed. NOTE: when the
+ // settings object is created, it applies the default transition duration
+ // (200ms).
+ class ScopedSettings {
+ public:
+ explicit ScopedSettings(LayerAnimator* animator);
+ virtual ~ScopedSettings();
+
+ void SetTransitionDuration(base::TimeDelta duration);
+
+ private:
+ LayerAnimator* animator_;
+ base::TimeDelta old_transition_duration_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedSettings);
+ };
+
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 +207,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_;
« no previous file with comments | « ui/gfx/compositor/layer_animation_sequence_unittest.cc ('k') | ui/gfx/compositor/layer_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698