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

Side by Side Diff: trunk/Source/core/animation/css/CSSAnimations.h

Issue 199663007: Revert 169949 "Oilpan: Move CSSAnimations and CSSAnimationUpdate..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/Source/core/animation/css/CSSAnimations.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 namespace WebCore { 46 namespace WebCore {
47 47
48 class Element; 48 class Element;
49 class StylePropertyShorthand; 49 class StylePropertyShorthand;
50 class StyleResolver; 50 class StyleResolver;
51 class StyleRuleKeyframes; 51 class StyleRuleKeyframes;
52 52
53 // This class stores the CSS Animations/Transitions information we use during a style recalc. 53 // This class stores the CSS Animations/Transitions information we use during a style recalc.
54 // This includes updates to animations/transitions as well as the Interpolations to be applied. 54 // This includes updates to animations/transitions as well as the Interpolations to be applied.
55 class CSSAnimationUpdate FINAL : public NoBaseWillBeGarbageCollectedFinalized<CS SAnimationUpdate> { 55 class CSSAnimationUpdate FINAL {
56 public: 56 public:
57 void startAnimation(AtomicString& animationName, const HashSet<RefPtr<InertA nimation> >& animations) 57 void startAnimation(AtomicString& animationName, const HashSet<RefPtr<InertA nimation> >& animations)
58 { 58 {
59 NewAnimation newAnimation; 59 NewAnimation newAnimation;
60 newAnimation.name = animationName; 60 newAnimation.name = animationName;
61 newAnimation.animations = animations; 61 newAnimation.animations = animations;
62 m_newAnimations.append(newAnimation); 62 m_newAnimations.append(newAnimation);
63 } 63 }
64 // Returns whether player has been cancelled and should be filtered during s tyle application. 64 // Returns whether player has been cancelled and should be filtered during s tyle application.
65 bool isCancelledAnimation(const AnimationPlayer* player) const { return m_ca ncelledAnimationAnimationPlayers.contains(player); } 65 bool isCancelledAnimation(const AnimationPlayer* player) const { return m_ca ncelledAnimationAnimationPlayers.contains(player); }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 { 102 {
103 visitor->trace(from); 103 visitor->trace(from);
104 visitor->trace(to); 104 visitor->trace(to);
105 } 105 }
106 106
107 CSSPropertyID id; 107 CSSPropertyID id;
108 RawPtrWillBeMember<const AnimatableValue> from; 108 RawPtrWillBeMember<const AnimatableValue> from;
109 RawPtrWillBeMember<const AnimatableValue> to; 109 RawPtrWillBeMember<const AnimatableValue> to;
110 RefPtr<InertAnimation> animation; 110 RefPtr<InertAnimation> animation;
111 }; 111 };
112 typedef WillBeHeapHashMap<CSSPropertyID, NewTransition> NewTransitionMap; 112 typedef WillBePersistentHeapHashMap<CSSPropertyID, NewTransition> NewTransit ionMap;
113 const NewTransitionMap& newTransitions() const { return m_newTransitions; } 113 const NewTransitionMap& newTransitions() const { return m_newTransitions; }
114 const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancel ledTransitions; } 114 const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancel ledTransitions; }
115 115
116 void adoptActiveInterpolationsForAnimations(WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& newMap) { newMap.swap(m_activeInterpolatio nsForAnimations); } 116 void adoptActiveInterpolationsForAnimations(WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& newMap) { newMap.swap(m_activeInterpolatio nsForAnimations); }
117 void adoptActiveInterpolationsForTransitions(WillBeHeapHashMap<CSSPropertyID , RefPtrWillBeMember<Interpolation> >& newMap) { newMap.swap(m_activeInterpolati onsForTransitions); } 117 void adoptActiveInterpolationsForTransitions(WillBeHeapHashMap<CSSPropertyID , RefPtrWillBeMember<Interpolation> >& newMap) { newMap.swap(m_activeInterpolati onsForTransitions); }
118 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolationsForAnimations() const { return m_activeInterpolationsForAnim ations; } 118 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolationsForAnimations() const { return m_activeInterpolationsForAnim ations; }
119 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolationsForTransitions() const { return m_activeInterpolationsForTra nsitions; } 119 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpolationsForTransitions() const { return m_activeInterpolationsForTra nsitions; }
120 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& active InterpolationsForAnimations() { return m_activeInterpolationsForAnimations; } 120 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& active InterpolationsForAnimations() { return m_activeInterpolationsForAnimations; }
121 121
122 bool isEmpty() const 122 bool isEmpty() const
123 { 123 {
124 return m_newAnimations.isEmpty() 124 return m_newAnimations.isEmpty()
125 && m_cancelledAnimationNames.isEmpty() 125 && m_cancelledAnimationNames.isEmpty()
126 && m_cancelledAnimationAnimationPlayers.isEmpty() 126 && m_cancelledAnimationAnimationPlayers.isEmpty()
127 && m_animationsWithPauseToggled.isEmpty() 127 && m_animationsWithPauseToggled.isEmpty()
128 && m_newTransitions.isEmpty() 128 && m_newTransitions.isEmpty()
129 && m_cancelledTransitions.isEmpty() 129 && m_cancelledTransitions.isEmpty()
130 && m_activeInterpolationsForAnimations.isEmpty() 130 && m_activeInterpolationsForAnimations.isEmpty()
131 && m_activeInterpolationsForTransitions.isEmpty(); 131 && m_activeInterpolationsForTransitions.isEmpty();
132 } 132 }
133
134 void trace(Visitor*);
135
136 private: 133 private:
137 // Order is significant since it defines the order in which new animations 134 // Order is significant since it defines the order in which new animations
138 // will be started. Note that there may be multiple animations present 135 // will be started. Note that there may be multiple animations present
139 // with the same name, due to the way in which we split up animations with 136 // with the same name, due to the way in which we split up animations with
140 // incomplete keyframes. 137 // incomplete keyframes.
141 Vector<NewAnimation> m_newAnimations; 138 Vector<NewAnimation> m_newAnimations;
142 Vector<AtomicString> m_cancelledAnimationNames; 139 Vector<AtomicString> m_cancelledAnimationNames;
143 HashSet<const AnimationPlayer*> m_cancelledAnimationAnimationPlayers; 140 HashSet<const AnimationPlayer*> m_cancelledAnimationAnimationPlayers;
144 Vector<AtomicString> m_animationsWithPauseToggled; 141 Vector<AtomicString> m_animationsWithPauseToggled;
145 142
146 NewTransitionMap m_newTransitions; 143 NewTransitionMap m_newTransitions;
147 HashSet<CSSPropertyID> m_cancelledTransitions; 144 HashSet<CSSPropertyID> m_cancelledTransitions;
148 145
149 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_activ eInterpolationsForAnimations; 146 WillBePersistentHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_activeInterpolationsForAnimations;
150 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_activ eInterpolationsForTransitions; 147 WillBePersistentHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_activeInterpolationsForTransitions;
151 }; 148 };
152 149
153 class CSSAnimations FINAL : public NoBaseWillBeGarbageCollectedFinalized<CSSAnim ations> { 150 class CSSAnimations FINAL {
154 public: 151 public:
155 // FIXME: This method is only used here and in the legacy animations 152 // FIXME: This method is only used here and in the legacy animations
156 // implementation. It should be made private or file-scope when the legacy 153 // implementation. It should be made private or file-scope when the legacy
157 // engine is removed. 154 // engine is removed.
158 static const StyleRuleKeyframes* matchScopedKeyframesRule(StyleResolver*, co nst Element*, const StringImpl*); 155 static const StyleRuleKeyframes* matchScopedKeyframesRule(StyleResolver*, co nst Element*, const StringImpl*);
159 156
160 static bool isAnimatableProperty(CSSPropertyID); 157 static bool isAnimatableProperty(CSSPropertyID);
161 static const StylePropertyShorthand& animatableProperties(); 158 static const StylePropertyShorthand& animatableProperties();
162 // FIXME: This should take a const ScopedStyleTree instead of a StyleResolve r. 159 // FIXME: This should take a const ScopedStyleTree instead of a StyleResolve r.
163 // We should also change the Element* to a const Element* 160 // We should also change the Element* to a const Element*
164 static PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> calculateUpdate(Element*, const Element& parentElement, const RenderStyle&, RenderStyle* parentStyle, Styl eResolver*); 161 static PassOwnPtr<CSSAnimationUpdate> calculateUpdate(Element*, const Elemen t& parentElement, const RenderStyle&, RenderStyle* parentStyle, StyleResolver*);
165 162
166 void setPendingUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update) { m _pendingUpdate = update; } 163 void setPendingUpdate(PassOwnPtr<CSSAnimationUpdate> update) { m_pendingUpda te = update; }
167 void maybeApplyPendingUpdate(Element*); 164 void maybeApplyPendingUpdate(Element*);
168 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt y() && !m_pendingUpdate; } 165 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt y() && !m_pendingUpdate; }
169 void cancel(); 166 void cancel();
170 167
171 void trace(Visitor*);
172
173 private: 168 private:
174 // Note that a single animation name may map to multiple players due to 169 // Note that a single animation name may map to multiple players due to
175 // the way in which we split up animations with incomplete keyframes. 170 // the way in which we split up animations with incomplete keyframes.
176 // FIXME: Once the Web Animations model supports groups, we could use a 171 // FIXME: Once the Web Animations model supports groups, we could use a
177 // ParGroup to drive multiple animations from a single AnimationPlayer. 172 // ParGroup to drive multiple animations from a single AnimationPlayer.
178 typedef HashMap<AtomicString, HashSet<RefPtr<AnimationPlayer> > > AnimationM ap; 173 typedef HashMap<AtomicString, HashSet<RefPtr<AnimationPlayer> > > AnimationM ap;
179 struct RunningTransition { 174 struct RunningTransition {
180 ALLOW_ONLY_INLINE_ALLOCATION(); 175 ALLOW_ONLY_INLINE_ALLOCATION();
181 public: 176 public:
182 void trace(Visitor* visitor) 177 void trace(Visitor* visitor)
183 { 178 {
184 visitor->trace(from); 179 visitor->trace(from);
185 visitor->trace(to); 180 visitor->trace(to);
186 } 181 }
187 182
188 Animation* transition; // The TransitionTimeline keeps the AnimationPlay ers alive 183 Animation* transition; // The TransitionTimeline keeps the AnimationPlay ers alive
189 RawPtrWillBeMember<const AnimatableValue> from; 184 RawPtrWillBeMember<const AnimatableValue> from;
190 RawPtrWillBeMember<const AnimatableValue> to; 185 RawPtrWillBeMember<const AnimatableValue> to;
191 }; 186 };
192 typedef WillBeHeapHashMap<CSSPropertyID, RunningTransition> TransitionMap; 187 typedef WillBePersistentHeapHashMap<CSSPropertyID, RunningTransition> Transi tionMap;
193 AnimationMap m_animations; 188 AnimationMap m_animations;
194 TransitionMap m_transitions; 189 TransitionMap m_transitions;
195 OwnPtrWillBeMember<CSSAnimationUpdate> m_pendingUpdate; 190 OwnPtr<CSSAnimationUpdate> m_pendingUpdate;
196 191
197 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_previ ousActiveInterpolationsForAnimations; 192 WillBePersistentHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > m_previousActiveInterpolationsForAnimations;
198 193
199 static void calculateAnimationUpdate(CSSAnimationUpdate*, Element*, const El ement& parentElement, const RenderStyle&, RenderStyle* parentStyle, StyleResolve r*); 194 static void calculateAnimationUpdate(CSSAnimationUpdate*, Element*, const El ement& parentElement, const RenderStyle&, RenderStyle* parentStyle, StyleResolve r*);
200 static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element*, c onst RenderStyle&); 195 static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element*, c onst RenderStyle&);
201 static void calculateTransitionUpdateForProperty(CSSPropertyID, const CSSAni mationData*, const RenderStyle& oldStyle, const RenderStyle&, const TransitionMa p* activeTransitions, CSSAnimationUpdate*, const Element*); 196 static void calculateTransitionUpdateForProperty(CSSPropertyID, const CSSAni mationData*, const RenderStyle& oldStyle, const RenderStyle&, const TransitionMa p* activeTransitions, CSSAnimationUpdate*, const Element*);
202 197
203 static void calculateAnimationActiveInterpolations(CSSAnimationUpdate*, cons t Element*); 198 static void calculateAnimationActiveInterpolations(CSSAnimationUpdate*, cons t Element*);
204 static void calculateTransitionActiveInterpolations(CSSAnimationUpdate*, con st Element*); 199 static void calculateTransitionActiveInterpolations(CSSAnimationUpdate*, con st Element*);
205 200
206 class AnimationEventDelegate FINAL : public TimedItem::EventDelegate { 201 class AnimationEventDelegate FINAL : public TimedItem::EventDelegate {
207 public: 202 public:
(...skipping 19 matching lines...) Expand all
227 virtual void onEventCondition(const TimedItem*, bool isFirstSample, Time dItem::Phase previousPhase, double previousIteration) OVERRIDE; 222 virtual void onEventCondition(const TimedItem*, bool isFirstSample, Time dItem::Phase previousPhase, double previousIteration) OVERRIDE;
228 private: 223 private:
229 Element* m_target; 224 Element* m_target;
230 const CSSPropertyID m_property; 225 const CSSPropertyID m_property;
231 }; 226 };
232 }; 227 };
233 228
234 } // namespace WebCore 229 } // namespace WebCore
235 230
236 #endif 231 #endif
OLDNEW
« no previous file with comments | « no previous file | trunk/Source/core/animation/css/CSSAnimations.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698