| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 const Timing& specifiedTiming, | 155 const Timing& specifiedTiming, |
| 156 StyleRuleKeyframes* styleRule) { | 156 StyleRuleKeyframes* styleRule) { |
| 157 m_animationsWithUpdates.push_back(UpdatedCSSAnimation( | 157 m_animationsWithUpdates.push_back(UpdatedCSSAnimation( |
| 158 index, animation, effect, specifiedTiming, styleRule)); | 158 index, animation, effect, specifiedTiming, styleRule)); |
| 159 m_suppressedAnimations.insert(animation); | 159 m_suppressedAnimations.insert(animation); |
| 160 } | 160 } |
| 161 void updateCompositorKeyframes(Animation* animation) { | 161 void updateCompositorKeyframes(Animation* animation) { |
| 162 m_updatedCompositorKeyframes.push_back(animation); | 162 m_updatedCompositorKeyframes.push_back(animation); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void startTransition(CSSPropertyID id, | 165 void startTransition(const PropertyHandle& property, |
| 166 RefPtr<AnimatableValue> from, | 166 RefPtr<AnimatableValue> from, |
| 167 RefPtr<AnimatableValue> to, | 167 RefPtr<AnimatableValue> to, |
| 168 PassRefPtr<AnimatableValue> reversingAdjustedStartValue, | 168 PassRefPtr<AnimatableValue> reversingAdjustedStartValue, |
| 169 double reversingShorteningFactor, | 169 double reversingShorteningFactor, |
| 170 const InertEffect& effect) { | 170 const InertEffect& effect) { |
| 171 NewTransition newTransition; | 171 NewTransition newTransition; |
| 172 newTransition.id = id; | 172 newTransition.property = property; |
| 173 newTransition.from = std::move(from); | 173 newTransition.from = std::move(from); |
| 174 newTransition.to = std::move(to); | 174 newTransition.to = std::move(to); |
| 175 newTransition.reversingAdjustedStartValue = reversingAdjustedStartValue; | 175 newTransition.reversingAdjustedStartValue = reversingAdjustedStartValue; |
| 176 newTransition.reversingShorteningFactor = reversingShorteningFactor; | 176 newTransition.reversingShorteningFactor = reversingShorteningFactor; |
| 177 newTransition.effect = &effect; | 177 newTransition.effect = &effect; |
| 178 m_newTransitions.set(id, newTransition); | 178 m_newTransitions.set(property, newTransition); |
| 179 } | 179 } |
| 180 bool isCancelledTransition(CSSPropertyID id) const { | 180 bool isCancelledTransition(const PropertyHandle& property) const { |
| 181 return m_cancelledTransitions.contains(id); | 181 return m_cancelledTransitions.contains(property); |
| 182 } | 182 } |
| 183 void cancelTransition(CSSPropertyID id) { m_cancelledTransitions.insert(id); } | 183 void cancelTransition(const PropertyHandle& property) { |
| 184 void finishTransition(CSSPropertyID id) { m_finishedTransitions.insert(id); } | 184 m_cancelledTransitions.insert(property); |
| 185 } |
| 186 void finishTransition(const PropertyHandle& property) { |
| 187 m_finishedTransitions.insert(property); |
| 188 } |
| 185 | 189 |
| 186 const HeapVector<NewCSSAnimation>& newAnimations() const { | 190 const HeapVector<NewCSSAnimation>& newAnimations() const { |
| 187 return m_newAnimations; | 191 return m_newAnimations; |
| 188 } | 192 } |
| 189 const Vector<size_t>& cancelledAnimationIndices() const { | 193 const Vector<size_t>& cancelledAnimationIndices() const { |
| 190 return m_cancelledAnimationIndices; | 194 return m_cancelledAnimationIndices; |
| 191 } | 195 } |
| 192 const HeapHashSet<Member<const Animation>>& suppressedAnimations() const { | 196 const HeapHashSet<Member<const Animation>>& suppressedAnimations() const { |
| 193 return m_suppressedAnimations; | 197 return m_suppressedAnimations; |
| 194 } | 198 } |
| 195 const Vector<size_t>& animationIndicesWithPauseToggled() const { | 199 const Vector<size_t>& animationIndicesWithPauseToggled() const { |
| 196 return m_animationIndicesWithPauseToggled; | 200 return m_animationIndicesWithPauseToggled; |
| 197 } | 201 } |
| 198 const HeapVector<UpdatedCSSAnimation>& animationsWithUpdates() const { | 202 const HeapVector<UpdatedCSSAnimation>& animationsWithUpdates() const { |
| 199 return m_animationsWithUpdates; | 203 return m_animationsWithUpdates; |
| 200 } | 204 } |
| 201 const HeapVector<Member<Animation>>& updatedCompositorKeyframes() const { | 205 const HeapVector<Member<Animation>>& updatedCompositorKeyframes() const { |
| 202 return m_updatedCompositorKeyframes; | 206 return m_updatedCompositorKeyframes; |
| 203 } | 207 } |
| 204 | 208 |
| 205 struct NewTransition { | 209 struct NewTransition { |
| 206 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 210 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 207 | 211 |
| 208 public: | 212 public: |
| 209 DEFINE_INLINE_TRACE() { visitor->trace(effect); } | 213 DEFINE_INLINE_TRACE() { visitor->trace(effect); } |
| 210 | 214 |
| 211 CSSPropertyID id; | 215 PropertyHandle property = HashTraits<blink::PropertyHandle>::emptyValue(); |
| 212 RefPtr<AnimatableValue> from; | 216 RefPtr<AnimatableValue> from; |
| 213 RefPtr<AnimatableValue> to; | 217 RefPtr<AnimatableValue> to; |
| 214 RefPtr<AnimatableValue> reversingAdjustedStartValue; | 218 RefPtr<AnimatableValue> reversingAdjustedStartValue; |
| 215 double reversingShorteningFactor; | 219 double reversingShorteningFactor; |
| 216 Member<const InertEffect> effect; | 220 Member<const InertEffect> effect; |
| 217 }; | 221 }; |
| 218 using NewTransitionMap = HeapHashMap<CSSPropertyID, NewTransition>; | 222 using NewTransitionMap = HeapHashMap<PropertyHandle, NewTransition>; |
| 219 const NewTransitionMap& newTransitions() const { return m_newTransitions; } | 223 const NewTransitionMap& newTransitions() const { return m_newTransitions; } |
| 220 const HashSet<CSSPropertyID>& cancelledTransitions() const { | 224 const HashSet<PropertyHandle>& cancelledTransitions() const { |
| 221 return m_cancelledTransitions; | 225 return m_cancelledTransitions; |
| 222 } | 226 } |
| 223 const HashSet<CSSPropertyID>& finishedTransitions() const { | 227 const HashSet<PropertyHandle>& finishedTransitions() const { |
| 224 return m_finishedTransitions; | 228 return m_finishedTransitions; |
| 225 } | 229 } |
| 226 | 230 |
| 227 void adoptActiveInterpolationsForAnimations(ActiveInterpolationsMap& newMap) { | 231 void adoptActiveInterpolationsForAnimations(ActiveInterpolationsMap& newMap) { |
| 228 newMap.swap(m_activeInterpolationsForAnimations); | 232 newMap.swap(m_activeInterpolationsForAnimations); |
| 229 } | 233 } |
| 230 void adoptActiveInterpolationsForTransitions( | 234 void adoptActiveInterpolationsForTransitions( |
| 231 ActiveInterpolationsMap& newMap) { | 235 ActiveInterpolationsMap& newMap) { |
| 232 newMap.swap(m_activeInterpolationsForTransitions); | 236 newMap.swap(m_activeInterpolationsForTransitions); |
| 233 } | 237 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // with the same name, due to the way in which we split up animations with | 271 // with the same name, due to the way in which we split up animations with |
| 268 // incomplete keyframes. | 272 // incomplete keyframes. |
| 269 HeapVector<NewCSSAnimation> m_newAnimations; | 273 HeapVector<NewCSSAnimation> m_newAnimations; |
| 270 Vector<size_t> m_cancelledAnimationIndices; | 274 Vector<size_t> m_cancelledAnimationIndices; |
| 271 HeapHashSet<Member<const Animation>> m_suppressedAnimations; | 275 HeapHashSet<Member<const Animation>> m_suppressedAnimations; |
| 272 Vector<size_t> m_animationIndicesWithPauseToggled; | 276 Vector<size_t> m_animationIndicesWithPauseToggled; |
| 273 HeapVector<UpdatedCSSAnimation> m_animationsWithUpdates; | 277 HeapVector<UpdatedCSSAnimation> m_animationsWithUpdates; |
| 274 HeapVector<Member<Animation>> m_updatedCompositorKeyframes; | 278 HeapVector<Member<Animation>> m_updatedCompositorKeyframes; |
| 275 | 279 |
| 276 NewTransitionMap m_newTransitions; | 280 NewTransitionMap m_newTransitions; |
| 277 HashSet<CSSPropertyID> m_cancelledTransitions; | 281 HashSet<PropertyHandle> m_cancelledTransitions; |
| 278 HashSet<CSSPropertyID> m_finishedTransitions; | 282 HashSet<PropertyHandle> m_finishedTransitions; |
| 279 | 283 |
| 280 ActiveInterpolationsMap m_activeInterpolationsForAnimations; | 284 ActiveInterpolationsMap m_activeInterpolationsForAnimations; |
| 281 ActiveInterpolationsMap m_activeInterpolationsForTransitions; | 285 ActiveInterpolationsMap m_activeInterpolationsForTransitions; |
| 282 | 286 |
| 283 friend class PendingAnimationUpdate; | 287 friend class PendingAnimationUpdate; |
| 284 }; | 288 }; |
| 285 | 289 |
| 286 } // namespace blink | 290 } // namespace blink |
| 287 | 291 |
| 288 #endif | 292 #endif |
| OLD | NEW |