OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CSSAnimationUpdate_h | 5 #ifndef CSSAnimationUpdate_h |
6 #define CSSAnimationUpdate_h | 6 #define CSSAnimationUpdate_h |
7 | 7 |
8 #include "core/animation/EffectStack.h" | 8 #include "core/animation/EffectStack.h" |
9 #include "core/animation/InertEffect.h" | 9 #include "core/animation/InertEffect.h" |
10 #include "core/animation/Interpolation.h" | 10 #include "core/animation/Interpolation.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 public: | 97 public: |
98 CSSAnimationUpdate() {} | 98 CSSAnimationUpdate() {} |
99 | 99 |
100 ~CSSAnimationUpdate() {} | 100 ~CSSAnimationUpdate() {} |
101 | 101 |
102 void Copy(const CSSAnimationUpdate& update) { | 102 void Copy(const CSSAnimationUpdate& update) { |
103 DCHECK(IsEmpty()); | 103 DCHECK(IsEmpty()); |
104 new_animations_ = update.NewAnimations(); | 104 new_animations_ = update.NewAnimations(); |
105 animations_with_updates_ = update.AnimationsWithUpdates(); | 105 animations_with_updates_ = update.AnimationsWithUpdates(); |
106 new_transitions_ = update.NewTransitions(); | 106 new_transitions_ = update.NewTransitions(); |
107 active_interpolations_for_animations_ = | 107 active_interpolations_for_custom_animations_ = |
108 update.ActiveInterpolationsForAnimations(); | 108 update.ActiveInterpolationsForCustomAnimations(); |
| 109 active_interpolations_for_standard_animations_ = |
| 110 update.ActiveInterpolationsForStandardAnimations(); |
109 active_interpolations_for_custom_transitions_ = | 111 active_interpolations_for_custom_transitions_ = |
110 update.ActiveInterpolationsForCustomTransitions(); | 112 update.ActiveInterpolationsForCustomTransitions(); |
111 active_interpolations_for_standard_transitions_ = | 113 active_interpolations_for_standard_transitions_ = |
112 update.ActiveInterpolationsForStandardTransitions(); | 114 update.ActiveInterpolationsForStandardTransitions(); |
113 cancelled_animation_indices_ = update.CancelledAnimationIndices(); | 115 cancelled_animation_indices_ = update.CancelledAnimationIndices(); |
114 animation_indices_with_pause_toggled_ = | 116 animation_indices_with_pause_toggled_ = |
115 update.AnimationIndicesWithPauseToggled(); | 117 update.AnimationIndicesWithPauseToggled(); |
116 cancelled_transitions_ = update.CancelledTransitions(); | 118 cancelled_transitions_ = update.CancelledTransitions(); |
117 finished_transitions_ = update.FinishedTransitions(); | 119 finished_transitions_ = update.FinishedTransitions(); |
118 updated_compositor_keyframes_ = update.UpdatedCompositorKeyframes(); | 120 updated_compositor_keyframes_ = update.UpdatedCompositorKeyframes(); |
119 } | 121 } |
120 | 122 |
121 void Clear() { | 123 void Clear() { |
122 new_animations_.clear(); | 124 new_animations_.clear(); |
123 animations_with_updates_.clear(); | 125 animations_with_updates_.clear(); |
124 new_transitions_.clear(); | 126 new_transitions_.clear(); |
125 active_interpolations_for_animations_.clear(); | 127 active_interpolations_for_custom_animations_.clear(); |
| 128 active_interpolations_for_standard_animations_.clear(); |
126 active_interpolations_for_custom_transitions_.clear(); | 129 active_interpolations_for_custom_transitions_.clear(); |
127 active_interpolations_for_standard_transitions_.clear(); | 130 active_interpolations_for_standard_transitions_.clear(); |
128 cancelled_animation_indices_.clear(); | 131 cancelled_animation_indices_.clear(); |
129 animation_indices_with_pause_toggled_.clear(); | 132 animation_indices_with_pause_toggled_.clear(); |
130 cancelled_transitions_.clear(); | 133 cancelled_transitions_.clear(); |
131 finished_transitions_.clear(); | 134 finished_transitions_.clear(); |
132 updated_compositor_keyframes_.clear(); | 135 updated_compositor_keyframes_.clear(); |
133 } | 136 } |
134 | 137 |
135 void StartAnimation(const AtomicString& animation_name, | 138 void StartAnimation(const AtomicString& animation_name, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 }; | 232 }; |
230 using NewTransitionMap = HeapHashMap<PropertyHandle, NewTransition>; | 233 using NewTransitionMap = HeapHashMap<PropertyHandle, NewTransition>; |
231 const NewTransitionMap& NewTransitions() const { return new_transitions_; } | 234 const NewTransitionMap& NewTransitions() const { return new_transitions_; } |
232 const HashSet<PropertyHandle>& CancelledTransitions() const { | 235 const HashSet<PropertyHandle>& CancelledTransitions() const { |
233 return cancelled_transitions_; | 236 return cancelled_transitions_; |
234 } | 237 } |
235 const HashSet<PropertyHandle>& FinishedTransitions() const { | 238 const HashSet<PropertyHandle>& FinishedTransitions() const { |
236 return finished_transitions_; | 239 return finished_transitions_; |
237 } | 240 } |
238 | 241 |
239 void AdoptActiveInterpolationsForAnimations( | 242 void AdoptActiveInterpolationsForCustomAnimations( |
240 ActiveInterpolationsMap& new_map) { | 243 ActiveInterpolationsMap& new_map) { |
241 new_map.swap(active_interpolations_for_animations_); | 244 new_map.swap(active_interpolations_for_custom_animations_); |
| 245 } |
| 246 void AdoptActiveInterpolationsForStandardAnimations( |
| 247 ActiveInterpolationsMap& new_map) { |
| 248 new_map.swap(active_interpolations_for_standard_animations_); |
242 } | 249 } |
243 void AdoptActiveInterpolationsForCustomTransitions( | 250 void AdoptActiveInterpolationsForCustomTransitions( |
244 ActiveInterpolationsMap& new_map) { | 251 ActiveInterpolationsMap& new_map) { |
245 new_map.swap(active_interpolations_for_custom_transitions_); | 252 new_map.swap(active_interpolations_for_custom_transitions_); |
246 } | 253 } |
247 void AdoptActiveInterpolationsForStandardTransitions( | 254 void AdoptActiveInterpolationsForStandardTransitions( |
248 ActiveInterpolationsMap& new_map) { | 255 ActiveInterpolationsMap& new_map) { |
249 new_map.swap(active_interpolations_for_standard_transitions_); | 256 new_map.swap(active_interpolations_for_standard_transitions_); |
250 } | 257 } |
251 const ActiveInterpolationsMap& ActiveInterpolationsForAnimations() const { | 258 const ActiveInterpolationsMap& ActiveInterpolationsForCustomAnimations() |
252 return active_interpolations_for_animations_; | 259 const { |
| 260 return active_interpolations_for_custom_animations_; |
| 261 } |
| 262 ActiveInterpolationsMap& ActiveInterpolationsForCustomAnimations() { |
| 263 return active_interpolations_for_custom_animations_; |
| 264 } |
| 265 const ActiveInterpolationsMap& ActiveInterpolationsForStandardAnimations() |
| 266 const { |
| 267 return active_interpolations_for_standard_animations_; |
| 268 } |
| 269 ActiveInterpolationsMap& ActiveInterpolationsForStandardAnimations() { |
| 270 return active_interpolations_for_standard_animations_; |
253 } | 271 } |
254 const ActiveInterpolationsMap& ActiveInterpolationsForCustomTransitions() | 272 const ActiveInterpolationsMap& ActiveInterpolationsForCustomTransitions() |
255 const { | 273 const { |
256 return active_interpolations_for_custom_transitions_; | 274 return active_interpolations_for_custom_transitions_; |
257 } | 275 } |
258 const ActiveInterpolationsMap& ActiveInterpolationsForStandardTransitions() | 276 const ActiveInterpolationsMap& ActiveInterpolationsForStandardTransitions() |
259 const { | 277 const { |
260 return active_interpolations_for_standard_transitions_; | 278 return active_interpolations_for_standard_transitions_; |
261 } | 279 } |
262 ActiveInterpolationsMap& ActiveInterpolationsForAnimations() { | |
263 return active_interpolations_for_animations_; | |
264 } | |
265 | 280 |
266 bool IsEmpty() const { | 281 bool IsEmpty() const { |
267 return new_animations_.IsEmpty() && | 282 return new_animations_.IsEmpty() && |
268 cancelled_animation_indices_.IsEmpty() && | 283 cancelled_animation_indices_.IsEmpty() && |
269 suppressed_animations_.IsEmpty() && | 284 suppressed_animations_.IsEmpty() && |
270 animation_indices_with_pause_toggled_.IsEmpty() && | 285 animation_indices_with_pause_toggled_.IsEmpty() && |
271 animations_with_updates_.IsEmpty() && new_transitions_.IsEmpty() && | 286 animations_with_updates_.IsEmpty() && new_transitions_.IsEmpty() && |
272 cancelled_transitions_.IsEmpty() && | 287 cancelled_transitions_.IsEmpty() && |
273 finished_transitions_.IsEmpty() && | 288 finished_transitions_.IsEmpty() && |
274 active_interpolations_for_animations_.IsEmpty() && | 289 active_interpolations_for_custom_animations_.IsEmpty() && |
| 290 active_interpolations_for_standard_animations_.IsEmpty() && |
275 active_interpolations_for_custom_transitions_.IsEmpty() && | 291 active_interpolations_for_custom_transitions_.IsEmpty() && |
276 active_interpolations_for_standard_transitions_.IsEmpty() && | 292 active_interpolations_for_standard_transitions_.IsEmpty() && |
277 updated_compositor_keyframes_.IsEmpty(); | 293 updated_compositor_keyframes_.IsEmpty(); |
278 } | 294 } |
279 | 295 |
280 DEFINE_INLINE_TRACE() { | 296 DEFINE_INLINE_TRACE() { |
281 visitor->Trace(new_transitions_); | 297 visitor->Trace(new_transitions_); |
282 visitor->Trace(new_animations_); | 298 visitor->Trace(new_animations_); |
283 visitor->Trace(suppressed_animations_); | 299 visitor->Trace(suppressed_animations_); |
284 visitor->Trace(animations_with_updates_); | 300 visitor->Trace(animations_with_updates_); |
285 visitor->Trace(updated_compositor_keyframes_); | 301 visitor->Trace(updated_compositor_keyframes_); |
286 } | 302 } |
287 | 303 |
288 private: | 304 private: |
289 // Order is significant since it defines the order in which new animations | 305 // Order is significant since it defines the order in which new animations |
290 // will be started. Note that there may be multiple animations present | 306 // will be started. Note that there may be multiple animations present |
291 // with the same name, due to the way in which we split up animations with | 307 // with the same name, due to the way in which we split up animations with |
292 // incomplete keyframes. | 308 // incomplete keyframes. |
293 HeapVector<NewCSSAnimation> new_animations_; | 309 HeapVector<NewCSSAnimation> new_animations_; |
294 Vector<size_t> cancelled_animation_indices_; | 310 Vector<size_t> cancelled_animation_indices_; |
295 HeapHashSet<Member<const Animation>> suppressed_animations_; | 311 HeapHashSet<Member<const Animation>> suppressed_animations_; |
296 Vector<size_t> animation_indices_with_pause_toggled_; | 312 Vector<size_t> animation_indices_with_pause_toggled_; |
297 HeapVector<UpdatedCSSAnimation> animations_with_updates_; | 313 HeapVector<UpdatedCSSAnimation> animations_with_updates_; |
298 HeapVector<Member<Animation>> updated_compositor_keyframes_; | 314 HeapVector<Member<Animation>> updated_compositor_keyframes_; |
299 | 315 |
300 NewTransitionMap new_transitions_; | 316 NewTransitionMap new_transitions_; |
301 HashSet<PropertyHandle> cancelled_transitions_; | 317 HashSet<PropertyHandle> cancelled_transitions_; |
302 HashSet<PropertyHandle> finished_transitions_; | 318 HashSet<PropertyHandle> finished_transitions_; |
303 | 319 |
304 ActiveInterpolationsMap active_interpolations_for_animations_; | 320 ActiveInterpolationsMap active_interpolations_for_custom_animations_; |
| 321 ActiveInterpolationsMap active_interpolations_for_standard_animations_; |
305 ActiveInterpolationsMap active_interpolations_for_custom_transitions_; | 322 ActiveInterpolationsMap active_interpolations_for_custom_transitions_; |
306 ActiveInterpolationsMap active_interpolations_for_standard_transitions_; | 323 ActiveInterpolationsMap active_interpolations_for_standard_transitions_; |
307 | 324 |
308 friend class PendingAnimationUpdate; | 325 friend class PendingAnimationUpdate; |
309 }; | 326 }; |
310 | 327 |
311 } // namespace blink | 328 } // namespace blink |
312 | 329 |
313 #endif | 330 #endif |
OLD | NEW |