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

Side by Side Diff: Source/core/animation/KeyframeEffect.cpp

Issue 1113173003: Web Animations: Update naming to reflect spec changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No, really. Created 5 years, 7 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 | « Source/core/animation/KeyframeEffect.h ('k') | Source/core/animation/KeyframeEffect.idl » ('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 11 matching lines...) Expand all
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/animation/Animation.h" 32 #include "core/animation/KeyframeEffect.h"
33 33
34 #include "bindings/core/v8/Dictionary.h" 34 #include "bindings/core/v8/Dictionary.h"
35 #include "bindings/core/v8/ExceptionState.h" 35 #include "bindings/core/v8/ExceptionState.h"
36 #include "core/animation/AnimationPlayer.h" 36 #include "core/animation/Animation.h"
37 #include "core/animation/AnimationTimeline.h" 37 #include "core/animation/AnimationTimeline.h"
38 #include "core/animation/AnimationTimingProperties.h"
39 #include "core/animation/CompositorAnimations.h" 38 #include "core/animation/CompositorAnimations.h"
40 #include "core/animation/ElementAnimations.h" 39 #include "core/animation/ElementAnimations.h"
41 #include "core/animation/Interpolation.h" 40 #include "core/animation/Interpolation.h"
42 #include "core/animation/KeyframeEffectModel.h" 41 #include "core/animation/KeyframeEffectModel.h"
42 #include "core/animation/KeyframeEffectOptions.h"
43 #include "core/animation/PropertyHandle.h" 43 #include "core/animation/PropertyHandle.h"
44 #include "core/dom/Element.h" 44 #include "core/dom/Element.h"
45 #include "core/dom/NodeComputedStyle.h" 45 #include "core/dom/NodeComputedStyle.h"
46 #include "core/frame/UseCounter.h" 46 #include "core/frame/UseCounter.h"
47 #include "core/paint/DeprecatedPaintLayer.h" 47 #include "core/paint/DeprecatedPaintLayer.h"
48 #include "core/svg/SVGElement.h" 48 #include "core/svg/SVGElement.h"
49 49
50 namespace blink { 50 namespace blink {
51 51
52 PassRefPtrWillBeRawPtr<Animation> Animation::create(Element* target, PassRefPtrW illBeRawPtr<AnimationEffect> effect, const Timing& timing, Priority priority, Pa ssOwnPtrWillBeRawPtr<EventDelegate> eventDelegate) 52 PassRefPtrWillBeRawPtr<KeyframeEffect> KeyframeEffect::create(Element* target, P assRefPtrWillBeRawPtr<EffectModel> effect, const Timing& timing, Priority priori ty, PassOwnPtrWillBeRawPtr<EventDelegate> eventDelegate)
53 { 53 {
54 return adoptRefWillBeNoop(new Animation(target, effect, timing, priority, ev entDelegate)); 54 return adoptRefWillBeNoop(new KeyframeEffect(target, effect, timing, priorit y, eventDelegate));
55 } 55 }
56 56
57 PassRefPtrWillBeRawPtr<Animation> Animation::create(Element* element, const Vect or<Dictionary>& keyframeDictionaryVector, double duration, ExceptionState& excep tionState) 57 PassRefPtrWillBeRawPtr<KeyframeEffect> KeyframeEffect::create(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, double duration, ExceptionSt ate& exceptionState)
58 { 58 {
59 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 59 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
60 if (element) 60 if (element)
61 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectObjectTiming); 61 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectObjectTiming);
62 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), TimingInput::convert(duration)); 62 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), TimingInput::convert(duration));
63 } 63 }
64 PassRefPtrWillBeRawPtr<Animation> Animation::create(Element* element, const Vect or<Dictionary>& keyframeDictionaryVector, const AnimationTimingProperties& timin gInput, ExceptionState& exceptionState) 64 PassRefPtrWillBeRawPtr<KeyframeEffect> KeyframeEffect::create(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, const KeyframeEffectOptions& timingInput, ExceptionState& exceptionState)
65 { 65 {
66 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 66 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
67 if (element) 67 if (element)
68 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectObjectTiming); 68 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectObjectTiming);
69 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), TimingInput::convert(timingInput)); 69 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), TimingInput::convert(timingInput));
70 } 70 }
71 PassRefPtrWillBeRawPtr<Animation> Animation::create(Element* element, const Vect or<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionState) 71 PassRefPtrWillBeRawPtr<KeyframeEffect> KeyframeEffect::create(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionSta te)
72 { 72 {
73 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 73 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
74 if (element) 74 if (element)
75 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectNoTiming); 75 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectNoTiming);
76 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), Timing()); 76 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), Timing());
77 } 77 }
78 78
79 Animation::Animation(Element* target, PassRefPtrWillBeRawPtr<AnimationEffect> ef fect, const Timing& timing, Priority priority, PassOwnPtrWillBeRawPtr<EventDeleg ate> eventDelegate) 79 KeyframeEffect::KeyframeEffect(Element* target, PassRefPtrWillBeRawPtr<EffectMod el> effect, const Timing& timing, Priority priority, PassOwnPtrWillBeRawPtr<Even tDelegate> eventDelegate)
80 : AnimationNode(timing, eventDelegate) 80 : AnimationEffect(timing, eventDelegate)
81 , m_target(target) 81 , m_target(target)
82 , m_effect(effect) 82 , m_effect(effect)
83 , m_sampledEffect(nullptr) 83 , m_sampledEffect(nullptr)
84 , m_priority(priority) 84 , m_priority(priority)
85 { 85 {
86 #if !ENABLE(OILPAN) 86 #if !ENABLE(OILPAN)
87 if (m_target) 87 if (m_target)
88 m_target->ensureElementAnimations().addAnimation(this); 88 m_target->ensureElementAnimations().addEffect(this);
89 #endif 89 #endif
90 } 90 }
91 91
92 Animation::~Animation() 92 KeyframeEffect::~KeyframeEffect()
93 { 93 {
94 #if !ENABLE(OILPAN) 94 #if !ENABLE(OILPAN)
95 if (m_target) 95 if (m_target)
96 m_target->elementAnimations()->notifyAnimationDestroyed(this); 96 m_target->elementAnimations()->notifyEffectDestroyed(this);
97 #endif 97 #endif
98 } 98 }
99 99
100 void Animation::attach(AnimationPlayer* player) 100 void KeyframeEffect::attach(Animation* animation)
101 { 101 {
102 if (m_target) { 102 if (m_target) {
103 m_target->ensureElementAnimations().players().add(player); 103 m_target->ensureElementAnimations().animations().add(animation);
104 m_target->setNeedsAnimationStyleRecalc(); 104 m_target->setNeedsAnimationStyleRecalc();
105 } 105 }
106 AnimationNode::attach(player); 106 AnimationEffect::attach(animation);
107 } 107 }
108 108
109 void Animation::detach() 109 void KeyframeEffect::detach()
110 { 110 {
111 if (m_target) 111 if (m_target)
112 m_target->elementAnimations()->players().remove(player()); 112 m_target->elementAnimations()->animations().remove(animation());
113 if (m_sampledEffect) 113 if (m_sampledEffect)
114 clearEffects(); 114 clearEffects();
115 AnimationNode::detach(); 115 AnimationEffect::detach();
116 } 116 }
117 117
118 void Animation::specifiedTimingChanged() 118 void KeyframeEffect::specifiedTimingChanged()
119 { 119 {
120 if (player()) { 120 if (animation()) {
121 // FIXME: Needs to consider groups when added. 121 // FIXME: Needs to consider groups when added.
122 ASSERT(player()->source() == this); 122 ASSERT(animation()->source() == this);
123 player()->setCompositorPending(true); 123 animation()->setCompositorPending(true);
124 } 124 }
125 } 125 }
126 126
127 static AnimationStack& ensureAnimationStack(Element* element) 127 static AnimationStack& ensureAnimationStack(Element* element)
128 { 128 {
129 return element->ensureElementAnimations().defaultStack(); 129 return element->ensureElementAnimations().defaultStack();
130 } 130 }
131 131
132 void Animation::applyEffects() 132 void KeyframeEffect::applyEffects()
133 { 133 {
134 ASSERT(isInEffect()); 134 ASSERT(isInEffect());
135 ASSERT(player()); 135 ASSERT(animation());
136 if (!m_target || !m_effect) 136 if (!m_target || !m_effect)
137 return; 137 return;
138 138
139 // Cancel composited animation of transform if a motion path has been introd uced on the element. 139 // Cancel composited animation of transform if a motion path has been introd uced on the element.
140 if (m_target->computedStyle() 140 if (m_target->computedStyle()
141 && m_target->computedStyle()->hasMotionPath() 141 && m_target->computedStyle()->hasMotionPath()
142 && player()->hasActiveAnimationsOnCompositor() 142 && animation()->hasActiveAnimationsOnCompositor()
143 && player()->affects(*m_target, CSSPropertyTransform)) { 143 && animation()->affects(*m_target, CSSPropertyTransform)) {
144 player()->cancelAnimationOnCompositor(); 144 animation()->cancelAnimationOnCompositor();
145 } 145 }
146 146
147 double iteration = currentIteration(); 147 double iteration = currentIteration();
148 ASSERT(iteration >= 0); 148 ASSERT(iteration >= 0);
149 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt r; 149 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt r;
150 // FIXME: Handle iteration values which overflow int. 150 // FIXME: Handle iteration values which overflow int.
151 m_effect->sample(static_cast<int>(iteration), timeFraction(), iterationDurat ion(), interpolations); 151 m_effect->sample(static_cast<int>(iteration), timeFraction(), iterationDurat ion(), interpolations);
152 if (m_sampledEffect) { 152 if (m_sampledEffect) {
153 m_sampledEffect->setInterpolations(interpolations.release()); 153 m_sampledEffect->setInterpolations(interpolations.release());
154 } else if (interpolations && !interpolations->isEmpty()) { 154 } else if (interpolations && !interpolations->isEmpty()) {
155 OwnPtrWillBeRawPtr<SampledEffect> sampledEffect = SampledEffect::create( this, interpolations.release()); 155 OwnPtrWillBeRawPtr<SampledEffect> sampledEffect = SampledEffect::create( this, interpolations.release());
156 m_sampledEffect = sampledEffect.get(); 156 m_sampledEffect = sampledEffect.get();
157 ensureAnimationStack(m_target).add(sampledEffect.release()); 157 ensureAnimationStack(m_target).add(sampledEffect.release());
158 } else { 158 } else {
159 return; 159 return;
160 } 160 }
161 161
162 m_target->setNeedsAnimationStyleRecalc(); 162 m_target->setNeedsAnimationStyleRecalc();
163 if (m_target->isSVGElement()) 163 if (m_target->isSVGElement())
164 m_sampledEffect->applySVGUpdate(toSVGElement(*m_target)); 164 m_sampledEffect->applySVGUpdate(toSVGElement(*m_target));
165 } 165 }
166 166
167 void Animation::clearEffects() 167 void KeyframeEffect::clearEffects()
168 { 168 {
169 ASSERT(player()); 169 ASSERT(animation());
170 ASSERT(m_sampledEffect); 170 ASSERT(m_sampledEffect);
171 171
172 m_sampledEffect->clear(); 172 m_sampledEffect->clear();
173 m_sampledEffect = nullptr; 173 m_sampledEffect = nullptr;
174 restartAnimationOnCompositor(); 174 restartAnimationOnCompositor();
175 m_target->setNeedsAnimationStyleRecalc(); 175 m_target->setNeedsAnimationStyleRecalc();
176 invalidate(); 176 invalidate();
177 } 177 }
178 178
179 void Animation::updateChildrenAndEffects() const 179 void KeyframeEffect::updateChildrenAndEffects() const
180 { 180 {
181 if (!m_effect) 181 if (!m_effect)
182 return; 182 return;
183 if (isInEffect()) 183 if (isInEffect())
184 const_cast<Animation*>(this)->applyEffects(); 184 const_cast<KeyframeEffect*>(this)->applyEffects();
185 else if (m_sampledEffect) 185 else if (m_sampledEffect)
186 const_cast<Animation*>(this)->clearEffects(); 186 const_cast<KeyframeEffect*>(this)->clearEffects();
187 } 187 }
188 188
189 double Animation::calculateTimeToEffectChange(bool forwards, double localTime, d ouble timeToNextIteration) const 189 double KeyframeEffect::calculateTimeToEffectChange(bool forwards, double localTi me, double timeToNextIteration) const
190 { 190 {
191 const double start = startTimeInternal() + specifiedTiming().startDelay; 191 const double start = startTimeInternal() + specifiedTiming().startDelay;
192 const double end = start + activeDurationInternal(); 192 const double end = start + activeDurationInternal();
193 193
194 switch (phase()) { 194 switch (phase()) {
195 case PhaseNone: 195 case PhaseNone:
196 return std::numeric_limits<double>::infinity(); 196 return std::numeric_limits<double>::infinity();
197 case PhaseBefore: 197 case PhaseBefore:
198 ASSERT(start >= localTime); 198 ASSERT(start >= localTime);
199 return forwards 199 return forwards
200 ? start - localTime 200 ? start - localTime
201 : std::numeric_limits<double>::infinity(); 201 : std::numeric_limits<double>::infinity();
202 case PhaseActive: 202 case PhaseActive:
203 if (forwards) { 203 if (forwards) {
204 // Need service to apply fill / fire events. 204 // Need service to apply fill / fire events.
205 const double timeToEnd = end - localTime; 205 const double timeToEnd = end - localTime;
206 if (requiresIterationEvents()) { 206 if (requiresIterationEvents()) {
207 return std::min(timeToEnd, timeToNextIteration); 207 return std::min(timeToEnd, timeToNextIteration);
208 } 208 }
209 return timeToEnd; 209 return timeToEnd;
210 } 210 }
211 return 0; 211 return 0;
212 case PhaseAfter: 212 case PhaseAfter:
213 ASSERT(localTime >= end); 213 ASSERT(localTime >= end);
214 // If this Animation is still in effect then it will need to update 214 // If this KeyframeEffect is still in effect then it will need to update
215 // when its parent goes out of effect. We have no way of knowing when 215 // when its parent goes out of effect. We have no way of knowing when
216 // that will be, however, so the parent will need to supply it. 216 // that will be, however, so the parent will need to supply it.
217 return forwards 217 return forwards
218 ? std::numeric_limits<double>::infinity() 218 ? std::numeric_limits<double>::infinity()
219 : localTime - end; 219 : localTime - end;
220 default: 220 default:
221 ASSERT_NOT_REACHED(); 221 ASSERT_NOT_REACHED();
222 return std::numeric_limits<double>::infinity(); 222 return std::numeric_limits<double>::infinity();
223 } 223 }
224 } 224 }
225 225
226 #if !ENABLE(OILPAN) 226 #if !ENABLE(OILPAN)
227 void Animation::notifyElementDestroyed() 227 void KeyframeEffect::notifyElementDestroyed()
228 { 228 {
229 // If our player is kept alive just by the sampledEffect, we might get our 229 // If our animation is kept alive just by the sampledEffect, we might get ou r
230 // destructor called when we call SampledEffect::clear(), so we need to 230 // destructor called when we call SampledEffect::clear(), so we need to
231 // clear m_sampledEffect first. 231 // clear m_sampledEffect first.
232 m_target = nullptr; 232 m_target = nullptr;
233 clearEventDelegate(); 233 clearEventDelegate();
234 SampledEffect* sampledEffect = m_sampledEffect; 234 SampledEffect* sampledEffect = m_sampledEffect;
235 m_sampledEffect = nullptr; 235 m_sampledEffect = nullptr;
236 if (sampledEffect) 236 if (sampledEffect)
237 sampledEffect->clear(); 237 sampledEffect->clear();
238 } 238 }
239 #endif 239 #endif
240 240
241 bool Animation::isCandidateForAnimationOnCompositor(double playerPlaybackRate) c onst 241 bool KeyframeEffect::isCandidateForAnimationOnCompositor(double animationPlaybac kRate) const
242 { 242 {
243 if (!effect() 243 if (!effect()
244 || !m_target 244 || !m_target
245 || (m_target->computedStyle() && m_target->computedStyle()->hasMotionPat h())) 245 || (m_target->computedStyle() && m_target->computedStyle()->hasMotionPat h()))
246 return false; 246 return false;
247 247
248 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor (specifiedTiming(), *m_target, player(), *effect(), playerPlaybackRate); 248 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor (specifiedTiming(), *m_target, animation(), *effect(), animationPlaybackRate);
249 } 249 }
250 250
251 bool Animation::maybeStartAnimationOnCompositor(int group, double startTime, dou ble currentTime, double playerPlaybackRate) 251 bool KeyframeEffect::maybeStartAnimationOnCompositor(int group, double startTime , double currentTime, double animationPlaybackRate)
252 { 252 {
253 ASSERT(!hasActiveAnimationsOnCompositor()); 253 ASSERT(!hasActiveAnimationsOnCompositor());
254 if (!isCandidateForAnimationOnCompositor(playerPlaybackRate)) 254 if (!isCandidateForAnimationOnCompositor(animationPlaybackRate))
255 return false; 255 return false;
256 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ et)) 256 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ et))
257 return false; 257 return false;
258 if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target, group, startTime, currentTime, specifiedTiming(), *player(), *effect(), m_compo sitorAnimationIds, playerPlaybackRate)) 258 if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target, group, startTime, currentTime, specifiedTiming(), *animation(), *effect(), m_co mpositorAnimationIds, animationPlaybackRate))
259 return false; 259 return false;
260 ASSERT(!m_compositorAnimationIds.isEmpty()); 260 ASSERT(!m_compositorAnimationIds.isEmpty());
261 return true; 261 return true;
262 } 262 }
263 263
264 bool Animation::hasActiveAnimationsOnCompositor() const 264 bool KeyframeEffect::hasActiveAnimationsOnCompositor() const
265 { 265 {
266 return !m_compositorAnimationIds.isEmpty(); 266 return !m_compositorAnimationIds.isEmpty();
267 } 267 }
268 268
269 bool Animation::hasActiveAnimationsOnCompositor(CSSPropertyID property) const 269 bool KeyframeEffect::hasActiveAnimationsOnCompositor(CSSPropertyID property) con st
270 { 270 {
271 return hasActiveAnimationsOnCompositor() && affects(PropertyHandle(property) ); 271 return hasActiveAnimationsOnCompositor() && affects(PropertyHandle(property) );
272 } 272 }
273 273
274 bool Animation::affects(PropertyHandle property) const 274 bool KeyframeEffect::affects(PropertyHandle property) const
275 { 275 {
276 return m_effect && m_effect->affects(property); 276 return m_effect && m_effect->affects(property);
277 } 277 }
278 278
279 bool Animation::cancelAnimationOnCompositor() 279 bool KeyframeEffect::cancelAnimationOnCompositor()
280 { 280 {
281 // FIXME: cancelAnimationOnCompositor is called from withins style recalc. 281 // FIXME: cancelAnimationOnCompositor is called from withins style recalc.
282 // This queries compositingState, which is not necessarily up to date. 282 // This queries compositingState, which is not necessarily up to date.
283 // https://code.google.com/p/chromium/issues/detail?id=339847 283 // https://code.google.com/p/chromium/issues/detail?id=339847
284 DisableCompositingQueryAsserts disabler; 284 DisableCompositingQueryAsserts disabler;
285 if (!hasActiveAnimationsOnCompositor()) 285 if (!hasActiveAnimationsOnCompositor())
286 return false; 286 return false;
287 if (!m_target || !m_target->layoutObject()) 287 if (!m_target || !m_target->layoutObject())
288 return false; 288 return false;
289 ASSERT(player()); 289 ASSERT(animation());
290 for (const auto& compositorAnimationId : m_compositorAnimationIds) 290 for (const auto& compositorAnimationId : m_compositorAnimationIds)
291 CompositorAnimations::instance()->cancelAnimationOnCompositor(*m_target, *player(), compositorAnimationId); 291 CompositorAnimations::instance()->cancelAnimationOnCompositor(*m_target, *animation(), compositorAnimationId);
292 m_compositorAnimationIds.clear(); 292 m_compositorAnimationIds.clear();
293 return true; 293 return true;
294 } 294 }
295 295
296 void Animation::restartAnimationOnCompositor() 296 void KeyframeEffect::restartAnimationOnCompositor()
297 { 297 {
298 if (cancelAnimationOnCompositor()) 298 if (cancelAnimationOnCompositor())
299 player()->setCompositorPending(true); 299 animation()->setCompositorPending(true);
300 } 300 }
301 301
302 void Animation::cancelIncompatibleAnimationsOnCompositor() 302 void KeyframeEffect::cancelIncompatibleAnimationsOnCompositor()
303 { 303 {
304 if (m_target && player() && effect()) 304 if (m_target && animation() && effect())
305 CompositorAnimations::instance()->cancelIncompatibleAnimationsOnComposit or(*m_target, *player(), *effect()); 305 CompositorAnimations::instance()->cancelIncompatibleAnimationsOnComposit or(*m_target, *animation(), *effect());
306 } 306 }
307 307
308 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) 308 void KeyframeEffect::pauseAnimationForTestingOnCompositor(double pauseTime)
309 { 309 {
310 ASSERT(hasActiveAnimationsOnCompositor()); 310 ASSERT(hasActiveAnimationsOnCompositor());
311 if (!m_target || !m_target->layoutObject()) 311 if (!m_target || !m_target->layoutObject())
312 return; 312 return;
313 ASSERT(player()); 313 ASSERT(animation());
314 for (const auto& compositorAnimationId : m_compositorAnimationIds) 314 for (const auto& compositorAnimationId : m_compositorAnimationIds)
315 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(* m_target, *player(), compositorAnimationId, pauseTime); 315 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(* m_target, *animation(), compositorAnimationId, pauseTime);
316 } 316 }
317 317
318 bool Animation::canAttachCompositedLayers() const 318 bool KeyframeEffect::canAttachCompositedLayers() const
319 { 319 {
320 if (!m_target || !player()) 320 if (!m_target || !animation())
321 return false; 321 return false;
322 322
323 return CompositorAnimations::instance()->canAttachCompositedLayers(*m_target , *player()); 323 return CompositorAnimations::instance()->canAttachCompositedLayers(*m_target , *animation());
324 } 324 }
325 325
326 void Animation::attachCompositedLayers() 326 void KeyframeEffect::attachCompositedLayers()
327 { 327 {
328 ASSERT(m_target); 328 ASSERT(m_target);
329 ASSERT(player()); 329 ASSERT(animation());
330 CompositorAnimations::instance()->attachCompositedLayers(*m_target, *player( )); 330 CompositorAnimations::instance()->attachCompositedLayers(*m_target, *animati on());
331 } 331 }
332 332
333 DEFINE_TRACE(Animation) 333 DEFINE_TRACE(KeyframeEffect)
334 { 334 {
335 visitor->trace(m_target); 335 visitor->trace(m_target);
336 visitor->trace(m_effect); 336 visitor->trace(m_effect);
337 visitor->trace(m_sampledEffect); 337 visitor->trace(m_sampledEffect);
338 AnimationNode::trace(visitor); 338 AnimationEffect::trace(visitor);
339 } 339 }
340 340
341 } // namespace blink 341 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/KeyframeEffect.h ('k') | Source/core/animation/KeyframeEffect.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698