| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ElementAnimations_h | 31 #ifndef ElementAnimations_h |
| 32 #define ElementAnimations_h | 32 #define ElementAnimations_h |
| 33 | 33 |
| 34 #include "core/animation/AnimationStack.h" | |
| 35 #include "core/animation/CustomCompositorAnimations.h" | 34 #include "core/animation/CustomCompositorAnimations.h" |
| 35 #include "core/animation/EffectStack.h" |
| 36 #include "core/animation/css/CSSAnimations.h" | 36 #include "core/animation/css/CSSAnimations.h" |
| 37 #include "wtf/HashCountedSet.h" | 37 #include "wtf/HashCountedSet.h" |
| 38 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
| 39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 40 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 class CSSAnimations; | 44 class CSSAnimations; |
| 45 | 45 |
| 46 using AnimationCountedSet = HeapHashCountedSet<WeakMember<Animation>>; | 46 using AnimationCountedSet = HeapHashCountedSet<WeakMember<Animation>>; |
| 47 | 47 |
| 48 class ElementAnimations : public GarbageCollectedFinalized<ElementAnimations> { | 48 class ElementAnimations : public GarbageCollectedFinalized<ElementAnimations> { |
| 49 WTF_MAKE_NONCOPYABLE(ElementAnimations); | 49 WTF_MAKE_NONCOPYABLE(ElementAnimations); |
| 50 | 50 |
| 51 public: | 51 public: |
| 52 ElementAnimations(); | 52 ElementAnimations(); |
| 53 ~ElementAnimations(); | 53 ~ElementAnimations(); |
| 54 | 54 |
| 55 // Animations that are currently active for this element, their effects will | 55 // Animations that are currently active for this element, their effects will |
| 56 // be applied during a style recalc. CSS Transitions are included in this | 56 // be applied during a style recalc. CSS Transitions are included in this |
| 57 // stack. | 57 // stack. |
| 58 AnimationStack& animationStack() { return m_animationStack; } | 58 EffectStack& effectStack() { return m_effectStack; } |
| 59 const AnimationStack& animationStack() const { return m_animationStack; } | 59 const EffectStack& effectStack() const { return m_effectStack; } |
| 60 // Tracks long running animations that are responsible for applying mutations | 60 // Tracks long running animations that are responsible for applying mutations |
| 61 // from compositor worker. | 61 // from compositor worker. |
| 62 CustomCompositorAnimations& customCompositorAnimations() { | 62 CustomCompositorAnimations& customCompositorAnimations() { |
| 63 return m_customCompositorAnimations; | 63 return m_customCompositorAnimations; |
| 64 } | 64 } |
| 65 const CustomCompositorAnimations& customCompositorAnimations() const { | 65 const CustomCompositorAnimations& customCompositorAnimations() const { |
| 66 return m_customCompositorAnimations; | 66 return m_customCompositorAnimations; |
| 67 } | 67 } |
| 68 // Tracks the state of active CSS Animations and Transitions. The individual | 68 // Tracks the state of active CSS Animations and Transitions. The individual |
| 69 // animations will also be part of the animation stack, but the mapping | 69 // animations will also be part of the animation stack, but the mapping |
| 70 // between animation name and animation is kept here. | 70 // between animation name and animation is kept here. |
| 71 CSSAnimations& cssAnimations() { return m_cssAnimations; } | 71 CSSAnimations& cssAnimations() { return m_cssAnimations; } |
| 72 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } | 72 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } |
| 73 | 73 |
| 74 // Animations which have effects targeting this element. | 74 // Animations which have effects targeting this element. |
| 75 AnimationCountedSet& animations() { return m_animations; } | 75 AnimationCountedSet& animations() { return m_animations; } |
| 76 | 76 |
| 77 bool isEmpty() const { | 77 bool isEmpty() const { |
| 78 return m_animationStack.isEmpty() && m_cssAnimations.isEmpty() && | 78 return m_effectStack.isEmpty() && m_cssAnimations.isEmpty() && |
| 79 m_animations.isEmpty(); | 79 m_animations.isEmpty(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void restartAnimationOnCompositor(); | 82 void restartAnimationOnCompositor(); |
| 83 | 83 |
| 84 void updateAnimationFlags(ComputedStyle&); | 84 void updateAnimationFlags(ComputedStyle&); |
| 85 void setAnimationStyleChange(bool animationStyleChange) { | 85 void setAnimationStyleChange(bool animationStyleChange) { |
| 86 m_animationStyleChange = animationStyleChange; | 86 m_animationStyleChange = animationStyleChange; |
| 87 } | 87 } |
| 88 | 88 |
| 89 const ComputedStyle* baseComputedStyle() const; | 89 const ComputedStyle* baseComputedStyle() const; |
| 90 void updateBaseComputedStyle(const ComputedStyle*); | 90 void updateBaseComputedStyle(const ComputedStyle*); |
| 91 void clearBaseComputedStyle(); | 91 void clearBaseComputedStyle(); |
| 92 | 92 |
| 93 DECLARE_TRACE(); | 93 DECLARE_TRACE(); |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 bool isAnimationStyleChange() const; | 96 bool isAnimationStyleChange() const; |
| 97 | 97 |
| 98 AnimationStack m_animationStack; | 98 EffectStack m_effectStack; |
| 99 CustomCompositorAnimations m_customCompositorAnimations; | 99 CustomCompositorAnimations m_customCompositorAnimations; |
| 100 CSSAnimations m_cssAnimations; | 100 CSSAnimations m_cssAnimations; |
| 101 AnimationCountedSet m_animations; | 101 AnimationCountedSet m_animations; |
| 102 bool m_animationStyleChange; | 102 bool m_animationStyleChange; |
| 103 RefPtr<ComputedStyle> m_baseComputedStyle; | 103 RefPtr<ComputedStyle> m_baseComputedStyle; |
| 104 | 104 |
| 105 // CSSAnimations checks if a style change is due to animation. | 105 // CSSAnimations checks if a style change is due to animation. |
| 106 friend class CSSAnimations; | 106 friend class CSSAnimations; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 } // namespace blink | 109 } // namespace blink |
| 110 | 110 |
| 111 #endif // ElementAnimations_h | 111 #endif // ElementAnimations_h |
| OLD | NEW |