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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 void setPendingUpdate(const CSSAnimationUpdate& update) | 66 void setPendingUpdate(const CSSAnimationUpdate& update) |
67 { | 67 { |
68 clearPendingUpdate(); | 68 clearPendingUpdate(); |
69 m_pendingUpdate.copy(update); | 69 m_pendingUpdate.copy(update); |
70 } | 70 } |
71 void clearPendingUpdate() | 71 void clearPendingUpdate() |
72 { | 72 { |
73 m_pendingUpdate.clear(); | 73 m_pendingUpdate.clear(); |
74 } | 74 } |
75 void maybeApplyPendingUpdate(Element*); | 75 void maybeApplyPendingUpdate(Element*); |
76 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt
y() && m_pendingUpdate.isEmpty(); } | 76 bool isEmpty() const { return m_runningAnimations.isEmpty() && m_transitions
.isEmpty() && m_pendingUpdate.isEmpty(); } |
77 void cancel(); | 77 void cancel(); |
78 | 78 |
79 DECLARE_TRACE(); | 79 DECLARE_TRACE(); |
80 | 80 |
81 private: | 81 private: |
82 class RunningAnimation final : public GarbageCollectedFinalized<RunningAnima
tion> { | 82 class RunningAnimation final : public GarbageCollectedFinalized<RunningAnima
tion> { |
83 public: | 83 public: |
84 RunningAnimation(Animation* animation, CSSAnimationUpdate::NewAnimation
newAnimation) | 84 RunningAnimation(Animation* animation, CSSAnimationUpdate::NewAnimation
newAnimation) |
85 : animation(animation) | 85 : animation(animation) |
| 86 , name(newAnimation.name) |
| 87 , nameIndex(newAnimation.nameIndex) |
86 , specifiedTiming(newAnimation.timing) | 88 , specifiedTiming(newAnimation.timing) |
87 , styleRule(newAnimation.styleRule) | 89 , styleRule(newAnimation.styleRule) |
88 , styleRuleVersion(newAnimation.styleRuleVersion) | 90 , styleRuleVersion(newAnimation.styleRuleVersion) |
89 { | 91 { |
90 } | 92 } |
91 | 93 |
92 void update(CSSAnimationUpdate::UpdatedAnimation update) | 94 void update(CSSAnimationUpdate::UpdatedAnimation update) |
93 { | 95 { |
| 96 ASSERT(update.animation == animation); |
94 styleRule = update.styleRule; | 97 styleRule = update.styleRule; |
95 styleRuleVersion = update.styleRuleVersion; | 98 styleRuleVersion = update.styleRuleVersion; |
96 specifiedTiming = update.specifiedTiming; | 99 specifiedTiming = update.specifiedTiming; |
97 } | 100 } |
98 | 101 |
99 DEFINE_INLINE_TRACE() | 102 DEFINE_INLINE_TRACE() |
100 { | 103 { |
101 visitor->trace(animation); | 104 visitor->trace(animation); |
102 visitor->trace(styleRule); | 105 visitor->trace(styleRule); |
103 } | 106 } |
104 | 107 |
105 Member<Animation> animation; | 108 Member<Animation> animation; |
| 109 AtomicString name; |
| 110 size_t nameIndex; |
106 Timing specifiedTiming; | 111 Timing specifiedTiming; |
107 RefPtrWillBeMember<StyleRuleKeyframes> styleRule; | 112 RefPtrWillBeMember<StyleRuleKeyframes> styleRule; |
108 unsigned styleRuleVersion; | 113 unsigned styleRuleVersion; |
109 }; | 114 }; |
110 | 115 |
111 struct RunningTransition { | 116 struct RunningTransition { |
112 ALLOW_ONLY_INLINE_ALLOCATION(); | 117 ALLOW_ONLY_INLINE_ALLOCATION(); |
113 public: | 118 public: |
114 DEFINE_INLINE_TRACE() | 119 DEFINE_INLINE_TRACE() |
115 { | 120 { |
116 visitor->trace(animation); | 121 visitor->trace(animation); |
117 } | 122 } |
118 | 123 |
119 Member<Animation> animation; | 124 Member<Animation> animation; |
120 const AnimatableValue* from; | 125 const AnimatableValue* from; |
121 const AnimatableValue* to; | 126 const AnimatableValue* to; |
122 }; | 127 }; |
123 | 128 |
124 using AnimationMap = HeapHashMap<AtomicString, Member<RunningAnimation>>; | 129 HeapVector<Member<RunningAnimation>> m_runningAnimations; |
125 AnimationMap m_animations; | |
126 | 130 |
127 using TransitionMap = HeapHashMap<CSSPropertyID, RunningTransition>; | 131 using TransitionMap = HeapHashMap<CSSPropertyID, RunningTransition>; |
128 TransitionMap m_transitions; | 132 TransitionMap m_transitions; |
129 | 133 |
130 CSSAnimationUpdate m_pendingUpdate; | 134 CSSAnimationUpdate m_pendingUpdate; |
131 | 135 |
132 ActiveInterpolationsMap m_previousActiveInterpolationsForAnimations; | 136 ActiveInterpolationsMap m_previousActiveInterpolationsForAnimations; |
133 | 137 |
134 static void calculateCompositorAnimationUpdate(CSSAnimationUpdate&, const El
ement* animatingElement, Element&, const ComputedStyle&); | 138 static void calculateCompositorAnimationUpdate(CSSAnimationUpdate&, const El
ement* animatingElement, Element&, const ComputedStyle&); |
135 static void calculateAnimationUpdate(CSSAnimationUpdate&, const Element* ani
matingElement, Element&, const ComputedStyle&, ComputedStyle* parentStyle, Style
Resolver*); | 139 static void calculateAnimationUpdate(CSSAnimationUpdate&, const Element* ani
matingElement, Element&, const ComputedStyle&, ComputedStyle* parentStyle, Style
Resolver*); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 188 |
185 RawPtrWillBeMember<Element> m_transitionTarget; | 189 RawPtrWillBeMember<Element> m_transitionTarget; |
186 const CSSPropertyID m_property; | 190 const CSSPropertyID m_property; |
187 AnimationEffect::Phase m_previousPhase; | 191 AnimationEffect::Phase m_previousPhase; |
188 }; | 192 }; |
189 }; | 193 }; |
190 | 194 |
191 } // namespace blink | 195 } // namespace blink |
192 | 196 |
193 #endif | 197 #endif |
OLD | NEW |