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

Side by Side Diff: sky/engine/core/animation/css/CSSAnimations.h

Issue 723253004: Remove tons of OILPAN. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 /* 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 newTransition.to = to; 82 newTransition.to = to;
83 newTransition.animation = animation; 83 newTransition.animation = animation;
84 m_newTransitions.set(id, newTransition); 84 m_newTransitions.set(id, newTransition);
85 } 85 }
86 bool isCancelledTransition(CSSPropertyID id) const { return m_cancelledTrans itions.contains(id); } 86 bool isCancelledTransition(CSSPropertyID id) const { return m_cancelledTrans itions.contains(id); }
87 void cancelTransition(CSSPropertyID id) { m_cancelledTransitions.add(id); } 87 void cancelTransition(CSSPropertyID id) { m_cancelledTransitions.add(id); }
88 88
89 struct NewAnimation { 89 struct NewAnimation {
90 ALLOW_ONLY_INLINE_ALLOCATION(); 90 ALLOW_ONLY_INLINE_ALLOCATION();
91 public: 91 public:
92 void trace(Visitor* visitor)
93 {
94 visitor->trace(animation);
95 }
96
97 AtomicString name; 92 AtomicString name;
98 RefPtr<InertAnimation> animation; 93 RefPtr<InertAnimation> animation;
99 }; 94 };
100 const Vector<NewAnimation>& newAnimations() const { return m_newAnimations; } 95 const Vector<NewAnimation>& newAnimations() const { return m_newAnimations; }
101 const Vector<AtomicString>& cancelledAnimationNames() const { return m_cance lledAnimationNames; } 96 const Vector<AtomicString>& cancelledAnimationNames() const { return m_cance lledAnimationNames; }
102 const HashSet<RawPtr<const AnimationPlayer> >& cancelledAnimationAnimationPl ayers() const { return m_cancelledAnimationPlayers; } 97 const HashSet<RawPtr<const AnimationPlayer> >& cancelledAnimationAnimationPl ayers() const { return m_cancelledAnimationPlayers; }
103 const Vector<AtomicString>& animationsWithPauseToggled() const { return m_an imationsWithPauseToggled; } 98 const Vector<AtomicString>& animationsWithPauseToggled() const { return m_an imationsWithPauseToggled; }
104 99
105 struct NewTransition { 100 struct NewTransition {
106 ALLOW_ONLY_INLINE_ALLOCATION(); 101 ALLOW_ONLY_INLINE_ALLOCATION();
107 public: 102 public:
108 void trace(Visitor* visitor)
109 {
110 visitor->trace(from);
111 visitor->trace(to);
112 visitor->trace(animation);
113 }
114
115 CSSPropertyID id; 103 CSSPropertyID id;
116 CSSPropertyID eventId; 104 CSSPropertyID eventId;
117 RawPtr<const AnimatableValue> from; 105 RawPtr<const AnimatableValue> from;
118 RawPtr<const AnimatableValue> to; 106 RawPtr<const AnimatableValue> to;
119 RefPtr<InertAnimation> animation; 107 RefPtr<InertAnimation> animation;
120 }; 108 };
121 typedef HashMap<CSSPropertyID, NewTransition> NewTransitionMap; 109 typedef HashMap<CSSPropertyID, NewTransition> NewTransitionMap;
122 const NewTransitionMap& newTransitions() const { return m_newTransitions; } 110 const NewTransitionMap& newTransitions() const { return m_newTransitions; }
123 const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancel ledTransitions; } 111 const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancel ledTransitions; }
124 112
125 void adoptActiveInterpolationsForAnimations(HashMap<CSSPropertyID, RefPtr<In terpolation> >& newMap) { newMap.swap(m_activeInterpolationsForAnimations); } 113 void adoptActiveInterpolationsForAnimations(HashMap<CSSPropertyID, RefPtr<In terpolation> >& newMap) { newMap.swap(m_activeInterpolationsForAnimations); }
126 void adoptActiveInterpolationsForTransitions(HashMap<CSSPropertyID, RefPtr<I nterpolation> >& newMap) { newMap.swap(m_activeInterpolationsForTransitions); } 114 void adoptActiveInterpolationsForTransitions(HashMap<CSSPropertyID, RefPtr<I nterpolation> >& newMap) { newMap.swap(m_activeInterpolationsForTransitions); }
127 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rAnimations() const { return m_activeInterpolationsForAnimations; } 115 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rAnimations() const { return m_activeInterpolationsForAnimations; }
128 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rTransitions() const { return m_activeInterpolationsForTransitions; } 116 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rTransitions() const { return m_activeInterpolationsForTransitions; }
129 HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsForAnima tions() { return m_activeInterpolationsForAnimations; } 117 HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsForAnima tions() { return m_activeInterpolationsForAnimations; }
130 118
131 bool isEmpty() const 119 bool isEmpty() const
132 { 120 {
133 return m_newAnimations.isEmpty() 121 return m_newAnimations.isEmpty()
134 && m_cancelledAnimationNames.isEmpty() 122 && m_cancelledAnimationNames.isEmpty()
135 && m_cancelledAnimationPlayers.isEmpty() 123 && m_cancelledAnimationPlayers.isEmpty()
136 && m_animationsWithPauseToggled.isEmpty() 124 && m_animationsWithPauseToggled.isEmpty()
137 && m_newTransitions.isEmpty() 125 && m_newTransitions.isEmpty()
138 && m_cancelledTransitions.isEmpty() 126 && m_cancelledTransitions.isEmpty()
139 && m_activeInterpolationsForAnimations.isEmpty() 127 && m_activeInterpolationsForAnimations.isEmpty()
140 && m_activeInterpolationsForTransitions.isEmpty(); 128 && m_activeInterpolationsForTransitions.isEmpty();
141 } 129 }
142 130
143 void trace(Visitor*);
144
145 private: 131 private:
146 // Order is significant since it defines the order in which new animations 132 // Order is significant since it defines the order in which new animations
147 // will be started. Note that there may be multiple animations present 133 // will be started. Note that there may be multiple animations present
148 // with the same name, due to the way in which we split up animations with 134 // with the same name, due to the way in which we split up animations with
149 // incomplete keyframes. 135 // incomplete keyframes.
150 Vector<NewAnimation> m_newAnimations; 136 Vector<NewAnimation> m_newAnimations;
151 Vector<AtomicString> m_cancelledAnimationNames; 137 Vector<AtomicString> m_cancelledAnimationNames;
152 HashSet<RawPtr<const AnimationPlayer> > m_cancelledAnimationPlayers; 138 HashSet<RawPtr<const AnimationPlayer> > m_cancelledAnimationPlayers;
153 Vector<AtomicString> m_animationsWithPauseToggled; 139 Vector<AtomicString> m_animationsWithPauseToggled;
154 140
(...skipping 18 matching lines...) Expand all
173 static const StylePropertyShorthand& animatableProperties(); 159 static const StylePropertyShorthand& animatableProperties();
174 static bool isAllowedAnimation(CSSPropertyID); 160 static bool isAllowedAnimation(CSSPropertyID);
175 // FIXME: We should change the Element* to a const Element* 161 // FIXME: We should change the Element* to a const Element*
176 static PassOwnPtr<CSSAnimationUpdate> calculateUpdate(Element*, const Elemen t& parentElement, const RenderStyle&, RenderStyle* parentStyle, StyleResolver*); 162 static PassOwnPtr<CSSAnimationUpdate> calculateUpdate(Element*, const Elemen t& parentElement, const RenderStyle&, RenderStyle* parentStyle, StyleResolver*);
177 163
178 void setPendingUpdate(PassOwnPtr<CSSAnimationUpdate> update) { m_pendingUpda te = update; } 164 void setPendingUpdate(PassOwnPtr<CSSAnimationUpdate> update) { m_pendingUpda te = update; }
179 void maybeApplyPendingUpdate(Element*); 165 void maybeApplyPendingUpdate(Element*);
180 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt y() && !m_pendingUpdate; } 166 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt y() && !m_pendingUpdate; }
181 void cancel(); 167 void cancel();
182 168
183 void trace(Visitor*);
184
185 private: 169 private:
186 struct RunningTransition { 170 struct RunningTransition {
187 ALLOW_ONLY_INLINE_ALLOCATION(); 171 ALLOW_ONLY_INLINE_ALLOCATION();
188 public: 172 public:
189 void trace(Visitor* visitor)
190 {
191 visitor->trace(from);
192 visitor->trace(to);
193 visitor->trace(player);
194 }
195
196 RefPtr<AnimationPlayer> player; 173 RefPtr<AnimationPlayer> player;
197 RawPtr<const AnimatableValue> from; 174 RawPtr<const AnimatableValue> from;
198 RawPtr<const AnimatableValue> to; 175 RawPtr<const AnimatableValue> to;
199 }; 176 };
200 177
201 typedef HashMap<AtomicString, RefPtr<AnimationPlayer> > AnimationMap; 178 typedef HashMap<AtomicString, RefPtr<AnimationPlayer> > AnimationMap;
202 AnimationMap m_animations; 179 AnimationMap m_animations;
203 180
204 typedef HashMap<CSSPropertyID, RunningTransition> TransitionMap; 181 typedef HashMap<CSSPropertyID, RunningTransition> TransitionMap;
205 TransitionMap m_transitions; 182 TransitionMap m_transitions;
(...skipping 12 matching lines...) Expand all
218 class AnimationEventDelegate final : public AnimationNode::EventDelegate { 195 class AnimationEventDelegate final : public AnimationNode::EventDelegate {
219 public: 196 public:
220 AnimationEventDelegate(Element* target, const AtomicString& name) 197 AnimationEventDelegate(Element* target, const AtomicString& name)
221 : m_target(target) 198 : m_target(target)
222 , m_name(name) 199 , m_name(name)
223 , m_previousPhase(AnimationNode::PhaseNone) 200 , m_previousPhase(AnimationNode::PhaseNone)
224 , m_previousIteration(nullValue()) 201 , m_previousIteration(nullValue())
225 { 202 {
226 } 203 }
227 virtual void onEventCondition(const AnimationNode*) override; 204 virtual void onEventCondition(const AnimationNode*) override;
228 virtual void trace(Visitor*) override;
229 205
230 private: 206 private:
231 void maybeDispatch(Document::ListenerType, const AtomicString& eventName , double elapsedTime); 207 void maybeDispatch(Document::ListenerType, const AtomicString& eventName , double elapsedTime);
232 RawPtr<Element> m_target; 208 RawPtr<Element> m_target;
233 const AtomicString m_name; 209 const AtomicString m_name;
234 AnimationNode::Phase m_previousPhase; 210 AnimationNode::Phase m_previousPhase;
235 double m_previousIteration; 211 double m_previousIteration;
236 }; 212 };
237 213
238 class TransitionEventDelegate final : public AnimationNode::EventDelegate { 214 class TransitionEventDelegate final : public AnimationNode::EventDelegate {
239 public: 215 public:
240 TransitionEventDelegate(Element* target, CSSPropertyID property) 216 TransitionEventDelegate(Element* target, CSSPropertyID property)
241 : m_target(target) 217 : m_target(target)
242 , m_property(property) 218 , m_property(property)
243 , m_previousPhase(AnimationNode::PhaseNone) 219 , m_previousPhase(AnimationNode::PhaseNone)
244 { 220 {
245 } 221 }
246 virtual void onEventCondition(const AnimationNode*) override; 222 virtual void onEventCondition(const AnimationNode*) override;
247 virtual void trace(Visitor*) override;
248 223
249 private: 224 private:
250 RawPtr<Element> m_target; 225 RawPtr<Element> m_target;
251 const CSSPropertyID m_property; 226 const CSSPropertyID m_property;
252 AnimationNode::Phase m_previousPhase; 227 AnimationNode::Phase m_previousPhase;
253 }; 228 };
254 }; 229 };
255 230
256 } // namespace blink 231 } // namespace blink
257 232
258 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::CSSAnimationUpdate::NewAnimation); 233 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::CSSAnimationUpdate::NewAnimation);
259 234
260 #endif 235 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/animation/animatable/AnimatableValueKeyframe.cpp ('k') | sky/engine/core/animation/css/CSSAnimations.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698