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 24 matching lines...) Expand all Loading... |
35 #include "core/animation/css/CSSAnimations.h" | 35 #include "core/animation/css/CSSAnimations.h" |
36 #include "wtf/HashCountedSet.h" | 36 #include "wtf/HashCountedSet.h" |
37 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
39 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class CSSAnimations; | 43 class CSSAnimations; |
44 | 44 |
45 using AnimationCountedSet = WillBeHeapHashCountedSet<RawPtrWillBeWeakMember<Anim
ation>>; | 45 using AnimationCountedSet = HeapHashCountedSet<WeakMember<Animation>>; |
46 | 46 |
47 class ElementAnimations : public NoBaseWillBeGarbageCollectedFinalized<ElementAn
imations> { | 47 class ElementAnimations : public GarbageCollectedFinalized<ElementAnimations> { |
48 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(ElementAnimations); | |
49 WTF_MAKE_NONCOPYABLE(ElementAnimations); | 48 WTF_MAKE_NONCOPYABLE(ElementAnimations); |
50 public: | 49 public: |
51 ElementAnimations(); | 50 ElementAnimations(); |
52 ~ElementAnimations(); | 51 ~ElementAnimations(); |
53 | 52 |
54 // Animations that are currently active for this element, their effects will
be applied | 53 // Animations that are currently active for this element, their effects will
be applied |
55 // during a style recalc. CSS Transitions are included in this stack. | 54 // during a style recalc. CSS Transitions are included in this stack. |
56 AnimationStack& defaultStack() { return m_defaultStack; } | 55 AnimationStack& defaultStack() { return m_defaultStack; } |
57 const AnimationStack& defaultStack() const { return m_defaultStack; } | 56 const AnimationStack& defaultStack() const { return m_defaultStack; } |
58 // Tracks the state of active CSS Animations and Transitions. The individual
animations | 57 // Tracks the state of active CSS Animations and Transitions. The individual
animations |
59 // will also be part of the default stack, but the mapping betwen animation
name and | 58 // will also be part of the default stack, but the mapping betwen animation
name and |
60 // animation is kept here. | 59 // animation is kept here. |
61 CSSAnimations& cssAnimations() { return m_cssAnimations; } | 60 CSSAnimations& cssAnimations() { return m_cssAnimations; } |
62 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } | 61 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } |
63 | 62 |
64 // Animations which have effects targeting this element. | 63 // Animations which have effects targeting this element. |
65 AnimationCountedSet& animations() { return m_animations; } | 64 AnimationCountedSet& animations() { return m_animations; } |
66 | 65 |
67 bool isEmpty() const { return m_defaultStack.isEmpty() && m_cssAnimations.is
Empty() && m_animations.isEmpty(); } | 66 bool isEmpty() const { return m_defaultStack.isEmpty() && m_cssAnimations.is
Empty() && m_animations.isEmpty(); } |
68 | 67 |
69 void restartAnimationOnCompositor(); | 68 void restartAnimationOnCompositor(); |
70 | 69 |
71 void updateAnimationFlags(ComputedStyle&); | 70 void updateAnimationFlags(ComputedStyle&); |
72 void setAnimationStyleChange(bool animationStyleChange) { m_animationStyleCh
ange = animationStyleChange; } | 71 void setAnimationStyleChange(bool animationStyleChange) { m_animationStyleCh
ange = animationStyleChange; } |
73 | 72 |
74 const ComputedStyle* baseComputedStyle() const; | 73 const ComputedStyle* baseComputedStyle() const; |
75 void updateBaseComputedStyle(const ComputedStyle*); | 74 void updateBaseComputedStyle(const ComputedStyle*); |
76 void clearBaseComputedStyle(); | 75 void clearBaseComputedStyle(); |
77 | 76 |
78 #if !ENABLE(OILPAN) | |
79 void addEffect(KeyframeEffect* effect) { m_effects.append(effect); } | |
80 void notifyEffectDestroyed(KeyframeEffect* effect) { m_effects.remove(m_effe
cts.find(effect)); } | |
81 #endif | |
82 | |
83 DECLARE_TRACE(); | 77 DECLARE_TRACE(); |
84 | 78 |
85 private: | 79 private: |
86 bool isAnimationStyleChange() const; | 80 bool isAnimationStyleChange() const; |
87 | 81 |
88 AnimationStack m_defaultStack; | 82 AnimationStack m_defaultStack; |
89 CSSAnimations m_cssAnimations; | 83 CSSAnimations m_cssAnimations; |
90 AnimationCountedSet m_animations; | 84 AnimationCountedSet m_animations; |
91 bool m_animationStyleChange; | 85 bool m_animationStyleChange; |
92 RefPtr<ComputedStyle> m_baseComputedStyle; | 86 RefPtr<ComputedStyle> m_baseComputedStyle; |
93 | 87 |
94 #if !ENABLE(OILPAN) | |
95 // FIXME: Oilpan: This is to avoid a reference cycle that keeps Elements ali
ve | |
96 // and won't be needed once the Node hierarchy becomes traceable. | |
97 Vector<KeyframeEffect*> m_effects; | |
98 #endif | |
99 | |
100 // CSSAnimations and DeferredLegacyStyleInterpolation checks if a style chan
ge is due to animation. | 88 // CSSAnimations and DeferredLegacyStyleInterpolation checks if a style chan
ge is due to animation. |
101 friend class CSSAnimations; | 89 friend class CSSAnimations; |
102 friend class DeferredLegacyStyleInterpolation; | 90 friend class DeferredLegacyStyleInterpolation; |
103 }; | 91 }; |
104 | 92 |
105 } // namespace blink | 93 } // namespace blink |
106 | 94 |
107 #endif // ElementAnimations_h | 95 #endif // ElementAnimations_h |
OLD | NEW |