| 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 14 matching lines...) Expand all Loading... |
| 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" | 34 #include "core/animation/AnimationStack.h" |
| 35 #include "core/animation/CustomCompositorAnimations.h" |
| 35 #include "core/animation/css/CSSAnimations.h" | 36 #include "core/animation/css/CSSAnimations.h" |
| 36 #include "wtf/HashCountedSet.h" | 37 #include "wtf/HashCountedSet.h" |
| 37 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
| 38 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 39 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 class CSSAnimations; | 44 class CSSAnimations; |
| 44 | 45 |
| 45 using AnimationCountedSet = HeapHashCountedSet<WeakMember<Animation>>; | 46 using AnimationCountedSet = HeapHashCountedSet<WeakMember<Animation>>; |
| 46 | 47 |
| 47 class ElementAnimations : public GarbageCollectedFinalized<ElementAnimations> { | 48 class ElementAnimations : public GarbageCollectedFinalized<ElementAnimations> { |
| 48 WTF_MAKE_NONCOPYABLE(ElementAnimations); | 49 WTF_MAKE_NONCOPYABLE(ElementAnimations); |
| 49 public: | 50 public: |
| 50 ElementAnimations(); | 51 ElementAnimations(); |
| 51 ~ElementAnimations(); | 52 ~ElementAnimations(); |
| 52 | 53 |
| 53 // Animations that are currently active for this element, their effects will
be applied | 54 // Animations that are currently active for this element, their effects will
be applied |
| 54 // during a style recalc. CSS Transitions are included in this stack. | 55 // during a style recalc. CSS Transitions are included in this stack. |
| 55 AnimationStack& animationStack() { return m_animationStack; } | 56 AnimationStack& animationStack() { return m_animationStack; } |
| 56 const AnimationStack& animationStack() const { return m_animationStack; } | 57 const AnimationStack& animationStack() const { return m_animationStack; } |
| 58 // Tracks long running animations that are responsible for applying mutation
s |
| 59 // from compositor worker. |
| 60 CustomCompositorAnimations& customCompositorAnimations() { return m_customCo
mpositorAnimations; } |
| 61 const CustomCompositorAnimations& customCompositorAnimations() const { retur
n m_customCompositorAnimations; } |
| 57 // Tracks the state of active CSS Animations and Transitions. The individual
animations | 62 // Tracks the state of active CSS Animations and Transitions. The individual
animations |
| 58 // will also be part of the animation stack, but the mapping betwen animatio
n name and | 63 // will also be part of the animation stack, but the mapping betwen animatio
n name and |
| 59 // animation is kept here. | 64 // animation is kept here. |
| 60 CSSAnimations& cssAnimations() { return m_cssAnimations; } | 65 CSSAnimations& cssAnimations() { return m_cssAnimations; } |
| 61 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } | 66 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } |
| 62 | 67 |
| 63 // Animations which have effects targeting this element. | 68 // Animations which have effects targeting this element. |
| 64 AnimationCountedSet& animations() { return m_animations; } | 69 AnimationCountedSet& animations() { return m_animations; } |
| 65 | 70 |
| 66 bool isEmpty() const { return m_animationStack.isEmpty() && m_cssAnimations.
isEmpty() && m_animations.isEmpty(); } | 71 bool isEmpty() const { return m_animationStack.isEmpty() && m_cssAnimations.
isEmpty() && m_animations.isEmpty(); } |
| 67 | 72 |
| 68 void restartAnimationOnCompositor(); | 73 void restartAnimationOnCompositor(); |
| 69 | 74 |
| 70 void updateAnimationFlags(ComputedStyle&); | 75 void updateAnimationFlags(ComputedStyle&); |
| 71 void setAnimationStyleChange(bool animationStyleChange) { m_animationStyleCh
ange = animationStyleChange; } | 76 void setAnimationStyleChange(bool animationStyleChange) { m_animationStyleCh
ange = animationStyleChange; } |
| 72 | 77 |
| 73 const ComputedStyle* baseComputedStyle() const; | 78 const ComputedStyle* baseComputedStyle() const; |
| 74 void updateBaseComputedStyle(const ComputedStyle*); | 79 void updateBaseComputedStyle(const ComputedStyle*); |
| 75 void clearBaseComputedStyle(); | 80 void clearBaseComputedStyle(); |
| 76 | 81 |
| 77 DECLARE_TRACE(); | 82 DECLARE_TRACE(); |
| 78 | 83 |
| 79 private: | 84 private: |
| 80 bool isAnimationStyleChange() const; | 85 bool isAnimationStyleChange() const; |
| 81 | 86 |
| 82 AnimationStack m_animationStack; | 87 AnimationStack m_animationStack; |
| 88 CustomCompositorAnimations m_customCompositorAnimations; |
| 83 CSSAnimations m_cssAnimations; | 89 CSSAnimations m_cssAnimations; |
| 84 AnimationCountedSet m_animations; | 90 AnimationCountedSet m_animations; |
| 85 bool m_animationStyleChange; | 91 bool m_animationStyleChange; |
| 86 RefPtr<ComputedStyle> m_baseComputedStyle; | 92 RefPtr<ComputedStyle> m_baseComputedStyle; |
| 87 | 93 |
| 88 // CSSAnimations and DeferredLegacyStyleInterpolation checks if a style chan
ge is due to animation. | 94 // CSSAnimations and DeferredLegacyStyleInterpolation checks if a style chan
ge is due to animation. |
| 89 friend class CSSAnimations; | 95 friend class CSSAnimations; |
| 90 friend class DeferredLegacyStyleInterpolation; | 96 friend class DeferredLegacyStyleInterpolation; |
| 91 }; | 97 }; |
| 92 | 98 |
| 93 } // namespace blink | 99 } // namespace blink |
| 94 | 100 |
| 95 #endif // ElementAnimations_h | 101 #endif // ElementAnimations_h |
| OLD | NEW |