Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: third_party/WebKit/Source/core/animation/css/CSSAnimationUpdate.h

Issue 2719083005: Use PropertyHandle instead of CSSPropertyID to identify CSS Transitions (Closed)
Patch Set: Rebasedagainaaaa Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 void unstartTransition(CSSPropertyID id) { m_newTransitions.remove(id); } 180 void unstartTransition(const PropertyHandle& property) {
181 bool isCancelledTransition(CSSPropertyID id) const { 181 m_newTransitions.remove(property);
182 return m_cancelledTransitions.contains(id);
183 } 182 }
184 void cancelTransition(CSSPropertyID id) { m_cancelledTransitions.insert(id); } 183 bool isCancelledTransition(const PropertyHandle& property) const {
185 void finishTransition(CSSPropertyID id) { m_finishedTransitions.insert(id); } 184 return m_cancelledTransitions.contains(property);
185 }
186 void cancelTransition(const PropertyHandle& property) {
187 m_cancelledTransitions.insert(property);
188 }
189 void finishTransition(const PropertyHandle& property) {
190 m_finishedTransitions.insert(property);
191 }
186 192
187 const HeapVector<NewCSSAnimation>& newAnimations() const { 193 const HeapVector<NewCSSAnimation>& newAnimations() const {
188 return m_newAnimations; 194 return m_newAnimations;
189 } 195 }
190 const Vector<size_t>& cancelledAnimationIndices() const { 196 const Vector<size_t>& cancelledAnimationIndices() const {
191 return m_cancelledAnimationIndices; 197 return m_cancelledAnimationIndices;
192 } 198 }
193 const HeapHashSet<Member<const Animation>>& suppressedAnimations() const { 199 const HeapHashSet<Member<const Animation>>& suppressedAnimations() const {
194 return m_suppressedAnimations; 200 return m_suppressedAnimations;
195 } 201 }
196 const Vector<size_t>& animationIndicesWithPauseToggled() const { 202 const Vector<size_t>& animationIndicesWithPauseToggled() const {
197 return m_animationIndicesWithPauseToggled; 203 return m_animationIndicesWithPauseToggled;
198 } 204 }
199 const HeapVector<UpdatedCSSAnimation>& animationsWithUpdates() const { 205 const HeapVector<UpdatedCSSAnimation>& animationsWithUpdates() const {
200 return m_animationsWithUpdates; 206 return m_animationsWithUpdates;
201 } 207 }
202 const HeapVector<Member<Animation>>& updatedCompositorKeyframes() const { 208 const HeapVector<Member<Animation>>& updatedCompositorKeyframes() const {
203 return m_updatedCompositorKeyframes; 209 return m_updatedCompositorKeyframes;
204 } 210 }
205 211
206 struct NewTransition { 212 struct NewTransition {
207 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 213 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
208 214
209 public: 215 public:
210 DEFINE_INLINE_TRACE() { visitor->trace(effect); } 216 DEFINE_INLINE_TRACE() { visitor->trace(effect); }
211 217
212 CSSPropertyID id; 218 PropertyHandle property = HashTraits<blink::PropertyHandle>::emptyValue();
213 RefPtr<AnimatableValue> from; 219 RefPtr<AnimatableValue> from;
214 RefPtr<AnimatableValue> to; 220 RefPtr<AnimatableValue> to;
215 RefPtr<AnimatableValue> reversingAdjustedStartValue; 221 RefPtr<AnimatableValue> reversingAdjustedStartValue;
216 double reversingShorteningFactor; 222 double reversingShorteningFactor;
217 Member<const InertEffect> effect; 223 Member<const InertEffect> effect;
218 }; 224 };
219 using NewTransitionMap = HeapHashMap<CSSPropertyID, NewTransition>; 225 using NewTransitionMap = HeapHashMap<PropertyHandle, NewTransition>;
220 const NewTransitionMap& newTransitions() const { return m_newTransitions; } 226 const NewTransitionMap& newTransitions() const { return m_newTransitions; }
221 const HashSet<CSSPropertyID>& cancelledTransitions() const { 227 const HashSet<PropertyHandle>& cancelledTransitions() const {
222 return m_cancelledTransitions; 228 return m_cancelledTransitions;
223 } 229 }
224 const HashSet<CSSPropertyID>& finishedTransitions() const { 230 const HashSet<PropertyHandle>& finishedTransitions() const {
225 return m_finishedTransitions; 231 return m_finishedTransitions;
226 } 232 }
227 233
228 void adoptActiveInterpolationsForAnimations(ActiveInterpolationsMap& newMap) { 234 void adoptActiveInterpolationsForAnimations(ActiveInterpolationsMap& newMap) {
229 newMap.swap(m_activeInterpolationsForAnimations); 235 newMap.swap(m_activeInterpolationsForAnimations);
230 } 236 }
231 void adoptActiveInterpolationsForTransitions( 237 void adoptActiveInterpolationsForTransitions(
232 ActiveInterpolationsMap& newMap) { 238 ActiveInterpolationsMap& newMap) {
233 newMap.swap(m_activeInterpolationsForTransitions); 239 newMap.swap(m_activeInterpolationsForTransitions);
234 } 240 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // with the same name, due to the way in which we split up animations with 274 // with the same name, due to the way in which we split up animations with
269 // incomplete keyframes. 275 // incomplete keyframes.
270 HeapVector<NewCSSAnimation> m_newAnimations; 276 HeapVector<NewCSSAnimation> m_newAnimations;
271 Vector<size_t> m_cancelledAnimationIndices; 277 Vector<size_t> m_cancelledAnimationIndices;
272 HeapHashSet<Member<const Animation>> m_suppressedAnimations; 278 HeapHashSet<Member<const Animation>> m_suppressedAnimations;
273 Vector<size_t> m_animationIndicesWithPauseToggled; 279 Vector<size_t> m_animationIndicesWithPauseToggled;
274 HeapVector<UpdatedCSSAnimation> m_animationsWithUpdates; 280 HeapVector<UpdatedCSSAnimation> m_animationsWithUpdates;
275 HeapVector<Member<Animation>> m_updatedCompositorKeyframes; 281 HeapVector<Member<Animation>> m_updatedCompositorKeyframes;
276 282
277 NewTransitionMap m_newTransitions; 283 NewTransitionMap m_newTransitions;
278 HashSet<CSSPropertyID> m_cancelledTransitions; 284 HashSet<PropertyHandle> m_cancelledTransitions;
279 HashSet<CSSPropertyID> m_finishedTransitions; 285 HashSet<PropertyHandle> m_finishedTransitions;
280 286
281 ActiveInterpolationsMap m_activeInterpolationsForAnimations; 287 ActiveInterpolationsMap m_activeInterpolationsForAnimations;
282 ActiveInterpolationsMap m_activeInterpolationsForTransitions; 288 ActiveInterpolationsMap m_activeInterpolationsForTransitions;
283 289
284 friend class PendingAnimationUpdate; 290 friend class PendingAnimationUpdate;
285 }; 291 };
286 292
287 } // namespace blink 293 } // namespace blink
288 294
289 #endif 295 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698