diff options
author | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 21:38:08 +0000 |
---|---|---|
committer | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 21:38:08 +0000 |
commit | f5cd9e5d3c402226c8ff260eb63562df269f27ac (patch) | |
tree | 81f71523b4497cd576a469e8dd5383a7cefeee27 /ui/gfx/compositor/layer_animator.h | |
parent | 6cd8a30576416c6e28debe4c811a22aa670e88db (diff) | |
download | chromium_src-f5cd9e5d3c402226c8ff260eb63562df269f27ac.zip chromium_src-f5cd9e5d3c402226c8ff260eb63562df269f27ac.tar.gz chromium_src-f5cd9e5d3c402226c8ff260eb63562df269f27ac.tar.bz2 |
Setting a layer property immediately should cancel any current animations.
This CL depends on http://codereview.chromium.org/8395046/
The fix boils down to two changes to the layer animator:
1. When calling Set*** we must start a zero duration animation and not short circuit. The animator needs to be able to update its state, and the preemption strategy needs to be applied.
2. Always be aware that progressing or aborting animation may affect the list of running animation and take appropriate precautions.
I have added a unit test to make sure the fix for 102413 doesn't regress and updated the existing unit tests for the new behavior (specifically, we now get notified that a sequence has ended whenever we call Set*** because of 1. above).
BUG=102413
TEST=compositor_unittests
Review URL: http://codereview.chromium.org/8387051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108546 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/compositor/layer_animator.h')
-rw-r--r-- | ui/gfx/compositor/layer_animator.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/gfx/compositor/layer_animator.h b/ui/gfx/compositor/layer_animator.h index c7286b5..4b7de40 100644 --- a/ui/gfx/compositor/layer_animator.h +++ b/ui/gfx/compositor/layer_animator.h @@ -10,6 +10,7 @@ #include <set> #include <vector> +#include "base/compiler_specific.h" #include "base/memory/linked_ptr.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" @@ -140,6 +141,7 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement { protected: LayerAnimationDelegate* delegate() { return delegate_; } + const LayerAnimationDelegate* delegate() const { return delegate_; } private: friend class ScopedSettings; @@ -167,7 +169,10 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement { void UpdateAnimationState(); // Removes the sequences from both the running animations and the queue. - void RemoveAnimation(LayerAnimationSequence* sequence); + // Returns a pointer to the removed animation, if any. NOTE: the caller is + // responsible for deleting the returned pointer. + LayerAnimationSequence* RemoveAnimation( + LayerAnimationSequence* sequence) WARN_UNUSED_RESULT; // Progresses to the end of the sequence before removing it. void FinishAnimation(LayerAnimationSequence* sequence); |