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

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

Issue 2680923005: Refactor CSS Transitions to use CSSInterpolationTypes instead of AnimatableValues (Closed)
Patch Set: Fix transition tests to not expect incorrect behaviour Created 3 years, 10 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(CSSPropertyID id,
166 const AnimatableValue* from, 166 RefPtr<AnimatableValue> from,
167 const 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.id = id;
173 newTransition.from = from; 173 newTransition.from = std::move(from);
174 newTransition.to = 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(id, newTransition);
179 } 179 }
180 bool isCancelledTransition(CSSPropertyID id) const { 180 bool isCancelledTransition(CSSPropertyID id) const {
181 return m_cancelledTransitions.contains(id); 181 return m_cancelledTransitions.contains(id);
182 } 182 }
183 void cancelTransition(CSSPropertyID id) { m_cancelledTransitions.insert(id); } 183 void cancelTransition(CSSPropertyID id) { m_cancelledTransitions.insert(id); }
184 void finishTransition(CSSPropertyID id) { m_finishedTransitions.insert(id); } 184 void finishTransition(CSSPropertyID id) { m_finishedTransitions.insert(id); }
(...skipping 17 matching lines...) Expand all
202 return m_updatedCompositorKeyframes; 202 return m_updatedCompositorKeyframes;
203 } 203 }
204 204
205 struct NewTransition { 205 struct NewTransition {
206 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 206 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
207 207
208 public: 208 public:
209 DEFINE_INLINE_TRACE() { visitor->trace(effect); } 209 DEFINE_INLINE_TRACE() { visitor->trace(effect); }
210 210
211 CSSPropertyID id; 211 CSSPropertyID id;
212 const AnimatableValue* from; 212 RefPtr<AnimatableValue> from;
213 const AnimatableValue* to; 213 RefPtr<AnimatableValue> to;
214 RefPtr<AnimatableValue> reversingAdjustedStartValue; 214 RefPtr<AnimatableValue> reversingAdjustedStartValue;
215 double reversingShorteningFactor; 215 double reversingShorteningFactor;
216 Member<const InertEffect> effect; 216 Member<const InertEffect> effect;
217 }; 217 };
218 using NewTransitionMap = HeapHashMap<CSSPropertyID, NewTransition>; 218 using NewTransitionMap = HeapHashMap<CSSPropertyID, NewTransition>;
219 const NewTransitionMap& newTransitions() const { return m_newTransitions; } 219 const NewTransitionMap& newTransitions() const { return m_newTransitions; }
220 const HashSet<CSSPropertyID>& cancelledTransitions() const { 220 const HashSet<CSSPropertyID>& cancelledTransitions() const {
221 return m_cancelledTransitions; 221 return m_cancelledTransitions;
222 } 222 }
223 const HashSet<CSSPropertyID>& finishedTransitions() const { 223 const HashSet<CSSPropertyID>& finishedTransitions() const {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 ActiveInterpolationsMap m_activeInterpolationsForAnimations; 280 ActiveInterpolationsMap m_activeInterpolationsForAnimations;
281 ActiveInterpolationsMap m_activeInterpolationsForTransitions; 281 ActiveInterpolationsMap m_activeInterpolationsForTransitions;
282 282
283 friend class PendingAnimationUpdate; 283 friend class PendingAnimationUpdate;
284 }; 284 };
285 285
286 } // namespace blink 286 } // namespace blink
287 287
288 #endif 288 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698