OLD | NEW |
---|---|
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 } | 71 } |
72 void toggleAnimationPaused(const AtomicString& name) | 72 void toggleAnimationPaused(const AtomicString& name) |
73 { | 73 { |
74 m_animationsWithPauseToggled.append(name); | 74 m_animationsWithPauseToggled.append(name); |
75 } | 75 } |
76 | 76 |
77 void startTransition(CSSPropertyID id, const AnimatableValue* from, const An imatableValue* to, PassRefPtr<InertAnimation> animation) | 77 void startTransition(CSSPropertyID id, const AnimatableValue* from, const An imatableValue* to, PassRefPtr<InertAnimation> animation) |
78 { | 78 { |
79 NewTransition newTransition; | 79 NewTransition newTransition; |
80 newTransition.id = id; | 80 newTransition.id = id; |
81 newTransition.from = from; | 81 newTransition.from = const_cast<AnimatableValue*>(from); |
82 newTransition.to = to; | 82 newTransition.to = const_cast<AnimatableValue*>(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 AtomicString name; | 90 AtomicString name; |
91 HashSet<RefPtr<InertAnimation> > animations; | 91 HashSet<RefPtr<InertAnimation> > animations; |
92 }; | 92 }; |
93 const Vector<NewAnimation>& newAnimations() const { return m_newAnimations; } | 93 const Vector<NewAnimation>& newAnimations() const { return m_newAnimations; } |
94 const Vector<AtomicString>& cancelledAnimationNames() const { return m_cance lledAnimationNames; } | 94 const Vector<AtomicString>& cancelledAnimationNames() const { return m_cance lledAnimationNames; } |
95 const HashSet<const AnimationPlayer*>& cancelledAnimationAnimationPlayers() const { return m_cancelledAnimationAnimationPlayers; } | 95 const HashSet<const AnimationPlayer*>& cancelledAnimationAnimationPlayers() const { return m_cancelledAnimationAnimationPlayers; } |
96 const Vector<AtomicString>& animationsWithPauseToggled() const { return m_an imationsWithPauseToggled; } | 96 const Vector<AtomicString>& animationsWithPauseToggled() const { return m_an imationsWithPauseToggled; } |
97 | 97 |
98 struct NewTransition { | 98 struct NewTransition { |
99 ALLOW_ONLY_INLINE_ALLOCATION(); | |
100 public: | |
101 void trace(Visitor* visitor) | |
102 { | |
103 visitor->trace(from); | |
104 visitor->trace(to); | |
105 } | |
106 | |
99 CSSPropertyID id; | 107 CSSPropertyID id; |
100 const AnimatableValue* from; | 108 RawPtrWillBeMember<AnimatableValue> from; |
Mads Ager (chromium)
2014/03/21 17:05:44
Do you want to keep the const here and use RawPtrW
haraken
2014/03/21 17:21:33
Done.
| |
101 const AnimatableValue* to; | 109 RawPtrWillBeMember<AnimatableValue> to; |
102 RefPtr<InertAnimation> animation; | 110 RefPtr<InertAnimation> animation; |
103 }; | 111 }; |
104 typedef HashMap<CSSPropertyID, NewTransition> NewTransitionMap; | 112 typedef WillBePersistentHeapHashMap<CSSPropertyID, NewTransition> NewTransit ionMap; |
105 const NewTransitionMap& newTransitions() const { return m_newTransitions; } | 113 const NewTransitionMap& newTransitions() const { return m_newTransitions; } |
106 const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancel ledTransitions; } | 114 const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancel ledTransitions; } |
107 | 115 |
108 void adoptActiveInterpolationsForAnimations(HashMap<CSSPropertyID, RefPtr<In terpolation> >& newMap) { newMap.swap(m_activeInterpolationsForAnimations); } | 116 void adoptActiveInterpolationsForAnimations(HashMap<CSSPropertyID, RefPtr<In terpolation> >& newMap) { newMap.swap(m_activeInterpolationsForAnimations); } |
109 void adoptActiveInterpolationsForTransitions(HashMap<CSSPropertyID, RefPtr<I nterpolation> >& newMap) { newMap.swap(m_activeInterpolationsForTransitions); } | 117 void adoptActiveInterpolationsForTransitions(HashMap<CSSPropertyID, RefPtr<I nterpolation> >& newMap) { newMap.swap(m_activeInterpolationsForTransitions); } |
110 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rAnimations() const { return m_activeInterpolationsForAnimations; } | 118 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rAnimations() const { return m_activeInterpolationsForAnimations; } |
111 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rTransitions() const { return m_activeInterpolationsForTransitions; } | 119 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rTransitions() const { return m_activeInterpolationsForTransitions; } |
112 HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsForAnima tions() { return m_activeInterpolationsForAnimations; } | 120 HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsForAnima tions() { return m_activeInterpolationsForAnimations; } |
113 | 121 |
114 bool isEmpty() const | 122 bool isEmpty() const |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 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; } |
158 void cancel(); | 166 void cancel(); |
159 | 167 |
160 private: | 168 private: |
161 // 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 |
162 // the way in which we split up animations with incomplete keyframes. | 170 // the way in which we split up animations with incomplete keyframes. |
163 // 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 |
164 // ParGroup to drive multiple animations from a single AnimationPlayer. | 172 // ParGroup to drive multiple animations from a single AnimationPlayer. |
165 typedef HashMap<AtomicString, HashSet<RefPtr<AnimationPlayer> > > AnimationM ap; | 173 typedef HashMap<AtomicString, HashSet<RefPtr<AnimationPlayer> > > AnimationM ap; |
166 struct RunningTransition { | 174 struct RunningTransition { |
175 ALLOW_ONLY_INLINE_ALLOCATION(); | |
176 public: | |
177 void trace(Visitor* visitor) | |
178 { | |
179 visitor->trace(from); | |
180 visitor->trace(to); | |
181 } | |
182 | |
167 Animation* transition; // The TransitionTimeline keeps the AnimationPlay ers alive | 183 Animation* transition; // The TransitionTimeline keeps the AnimationPlay ers alive |
168 const AnimatableValue* from; | 184 RawPtrWillBeMember<AnimatableValue> from; |
169 const AnimatableValue* to; | 185 RawPtrWillBeMember<AnimatableValue> to; |
170 }; | 186 }; |
171 typedef HashMap<CSSPropertyID, RunningTransition > TransitionMap; | 187 typedef WillBePersistentHeapHashMap<CSSPropertyID, RunningTransition> Transi tionMap; |
172 AnimationMap m_animations; | 188 AnimationMap m_animations; |
173 TransitionMap m_transitions; | 189 TransitionMap m_transitions; |
174 OwnPtr<CSSAnimationUpdate> m_pendingUpdate; | 190 OwnPtr<CSSAnimationUpdate> m_pendingUpdate; |
175 | 191 |
176 HashMap<CSSPropertyID, RefPtr<Interpolation> > m_previousActiveInterpolation sForAnimations; | 192 HashMap<CSSPropertyID, RefPtr<Interpolation> > m_previousActiveInterpolation sForAnimations; |
177 | 193 |
178 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*); |
179 static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element*, c onst RenderStyle&); | 195 static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element*, c onst RenderStyle&); |
180 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*); |
181 | 197 |
(...skipping 24 matching lines...) Expand all Loading... | |
206 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; |
207 private: | 223 private: |
208 Element* m_target; | 224 Element* m_target; |
209 const CSSPropertyID m_property; | 225 const CSSPropertyID m_property; |
210 }; | 226 }; |
211 }; | 227 }; |
212 | 228 |
213 } // namespace WebCore | 229 } // namespace WebCore |
214 | 230 |
215 #endif | 231 #endif |
OLD | NEW |