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

Side by Side Diff: Source/core/animation/css/CSSAnimations.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/css/CSSAnimations.h ('k') | Source/core/core.gypi » ('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 14 matching lines...) Expand all
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/css/CSSAnimations.h" 32 #include "core/animation/css/CSSAnimations.h"
33 33
34 #include "core/StylePropertyShorthand.h" 34 #include "core/StylePropertyShorthand.h"
35 #include "core/animation/AnimationPlayer.h" 35 #include "core/animation/Animation.h"
36 #include "core/animation/AnimationTimeline.h" 36 #include "core/animation/AnimationTimeline.h"
37 #include "core/animation/CompositorAnimations.h" 37 #include "core/animation/CompositorAnimations.h"
38 #include "core/animation/DeferredLegacyStyleInterpolation.h" 38 #include "core/animation/DeferredLegacyStyleInterpolation.h"
39 #include "core/animation/ElementAnimations.h" 39 #include "core/animation/ElementAnimations.h"
40 #include "core/animation/Interpolation.h" 40 #include "core/animation/Interpolation.h"
41 #include "core/animation/KeyframeEffectModel.h" 41 #include "core/animation/KeyframeEffectModel.h"
42 #include "core/animation/css/CSSAnimatableValueFactory.h" 42 #include "core/animation/css/CSSAnimatableValueFactory.h"
43 #include "core/animation/css/CSSPropertyEquality.h" 43 #include "core/animation/css/CSSPropertyEquality.h"
44 #include "core/css/CSSKeyframeRule.h" 44 #include "core/css/CSSKeyframeRule.h"
45 #include "core/css/CSSPropertyMetadata.h" 45 #include "core/css/CSSPropertyMetadata.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 effect->forceConversionsToAnimatableValues(element, style); 176 effect->forceConversionsToAnimatableValues(element, style);
177 return effect; 177 return effect;
178 } 178 }
179 179
180 } // namespace 180 } // namespace
181 181
182 CSSAnimations::CSSAnimations() 182 CSSAnimations::CSSAnimations()
183 { 183 {
184 } 184 }
185 185
186 const AtomicString CSSAnimations::getAnimationNameForInspector(const AnimationPl ayer& player) 186 const AtomicString CSSAnimations::getAnimationNameForInspector(const Animation& animation)
187 { 187 {
188 for (const auto& it : m_animations) { 188 for (const auto& it : m_animations) {
189 if (it.value->player->sequenceNumber() == player.sequenceNumber()) 189 if (it.value->animation->sequenceNumber() == animation.sequenceNumber())
190 return it.key; 190 return it.key;
191 } 191 }
192 return nullAtom; 192 return nullAtom;
193 } 193 }
194 194
195 bool CSSAnimations::isTransitionAnimationForInspector(const AnimationPlayer& pla yer) const 195 bool CSSAnimations::isTransitionAnimationForInspector(const Animation& animation ) const
196 { 196 {
197 for (const auto& it : m_transitions) { 197 for (const auto& it : m_transitions) {
198 if (it.value.player->sequenceNumber() == player.sequenceNumber()) 198 if (it.value.animation->sequenceNumber() == animation.sequenceNumber())
199 return true; 199 return true;
200 } 200 }
201 return false; 201 return false;
202 } 202 }
203 203
204 PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> CSSAnimations::calculateUpdate(const Element* animatingElement, Element& element, const ComputedStyle& style, Compute dStyle* parentStyle, StyleResolver* resolver) 204 PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> CSSAnimations::calculateUpdate(const Element* animatingElement, Element& element, const ComputedStyle& style, Compute dStyle* parentStyle, StyleResolver* resolver)
205 { 205 {
206 OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = adoptPtrWillBeNoop(new CSSAn imationUpdate()); 206 OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = adoptPtrWillBeNoop(new CSSAn imationUpdate());
207 calculateAnimationUpdate(update.get(), animatingElement, element, style, par entStyle, resolver); 207 calculateAnimationUpdate(update.get(), animatingElement, element, style, par entStyle, resolver);
208 calculateAnimationActiveInterpolations(update.get(), animatingElement, eleme nt.document().timeline().currentTimeInternal()); 208 calculateAnimationActiveInterpolations(update.get(), animatingElement, eleme nt.document().timeline().currentTimeInternal());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 RefPtrWillBeRawPtr<StyleRuleKeyframes> keyframesRule = resolver->fin dKeyframesRule(elementForScoping, animationName); 250 RefPtrWillBeRawPtr<StyleRuleKeyframes> keyframesRule = resolver->fin dKeyframesRule(elementForScoping, animationName);
251 if (!keyframesRule) 251 if (!keyframesRule)
252 continue; // Cancel the animation if there's no style rule for i t. 252 continue; // Cancel the animation if there's no style rule for i t.
253 253
254 if (cssAnimations) { 254 if (cssAnimations) {
255 AnimationMap::const_iterator existing(cssAnimations->m_animation s.find(animationName)); 255 AnimationMap::const_iterator existing(cssAnimations->m_animation s.find(animationName));
256 if (existing != cssAnimations->m_animations.end()) { 256 if (existing != cssAnimations->m_animations.end()) {
257 inactive.remove(animationName); 257 inactive.remove(animationName);
258 258
259 const RunningAnimation* runningAnimation = existing->value.g et(); 259 const RunningAnimation* runningAnimation = existing->value.g et();
260 AnimationPlayer* player = runningAnimation->player.get(); 260 Animation* animation = runningAnimation->animation.get();
261 261
262 if (keyframesRule != runningAnimation->styleRule || keyframe sRule->version() != runningAnimation->styleRuleVersion || runningAnimation->spec ifiedTiming != specifiedTiming) { 262 if (keyframesRule != runningAnimation->styleRule || keyframe sRule->version() != runningAnimation->styleRuleVersion || runningAnimation->spec ifiedTiming != specifiedTiming) {
263 ASSERT(!isAnimationStyleChange); 263 ASSERT(!isAnimationStyleChange);
264 update->updateAnimation(animationName, player, InertAnim ation::create( 264 update->updateAnimation(animationName, animation, InertA nimation::create(
265 createKeyframeEffect(resolver, animatingElement, ele ment, &style, parentStyle, animationName, keyframeTimingFunction.get()), 265 createKeyframeEffect(resolver, animatingElement, ele ment, &style, parentStyle, animationName, keyframeTimingFunction.get()),
266 timing, isPaused, player->unlimitedCurrentTimeIntern al()), specifiedTiming, keyframesRule); 266 timing, isPaused, animation->unlimitedCurrentTimeInt ernal()), specifiedTiming, keyframesRule);
267 } else if (!isAnimationStyleChange && player->source() && pl ayer->source()->isAnimation()) { 267 } else if (!isAnimationStyleChange && animation->source() && animation->source()->isAnimation()) {
268 AnimationEffect* effect = toAnimation(player->source())- >effect(); 268 EffectModel* effect = toKeyframeEffect(animation->source ())->effect();
269 if (effect && effect->isKeyframeEffectModel()) { 269 if (effect && effect->isKeyframeEffectModel()) {
270 KeyframeEffectModelBase* keyframeEffect = toKeyframe EffectModelBase(effect); 270 KeyframeEffectModelBase* keyframeEffect = toKeyframe EffectModelBase(effect);
271 if (keyframeEffect->hasSyntheticKeyframes()) 271 if (keyframeEffect->hasSyntheticKeyframes())
272 update->updateAnimationStyle(player, keyframeEff ect, animatingElement->layoutObject(), style); 272 update->updateAnimationStyle(animation, keyframe Effect, animatingElement->layoutObject(), style);
273 } 273 }
274 } 274 }
275 275
276 if (isPaused != player->paused()) { 276 if (isPaused != animation->paused()) {
277 ASSERT(!isAnimationStyleChange); 277 ASSERT(!isAnimationStyleChange);
278 update->toggleAnimationPaused(animationName); 278 update->toggleAnimationPaused(animationName);
279 } 279 }
280 280
281 continue; 281 continue;
282 } 282 }
283 } 283 }
284 284
285 ASSERT(!isAnimationStyleChange); 285 ASSERT(!isAnimationStyleChange);
286 update->startAnimation(animationName, InertAnimation::create( 286 update->startAnimation(animationName, InertAnimation::create(
287 createKeyframeEffect(resolver, animatingElement, element, &style , parentStyle, animationName, keyframeTimingFunction.get()), 287 createKeyframeEffect(resolver, animatingElement, element, &style , parentStyle, animationName, keyframeTimingFunction.get()),
288 timing, isPaused, 0), specifiedTiming, keyframesRule); 288 timing, isPaused, 0), specifiedTiming, keyframesRule);
289 } 289 }
290 } 290 }
291 291
292 ASSERT(inactive.isEmpty() || cssAnimations); 292 ASSERT(inactive.isEmpty() || cssAnimations);
293 for (const AtomicString& animationName : inactive) { 293 for (const AtomicString& animationName : inactive) {
294 ASSERT(!isAnimationStyleChange); 294 ASSERT(!isAnimationStyleChange);
295 update->cancelAnimation(animationName, *cssAnimations->m_animations.get( animationName)->player); 295 update->cancelAnimation(animationName, *cssAnimations->m_animations.get( animationName)->animation);
296 } 296 }
297 } 297 }
298 298
299 void CSSAnimations::maybeApplyPendingUpdate(Element* element) 299 void CSSAnimations::maybeApplyPendingUpdate(Element* element)
300 { 300 {
301 if (!m_pendingUpdate) { 301 if (!m_pendingUpdate) {
302 m_previousActiveInterpolationsForAnimations.clear(); 302 m_previousActiveInterpolationsForAnimations.clear();
303 return; 303 return;
304 } 304 }
305 305
306 OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = m_pendingUpdate.release(); 306 OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = m_pendingUpdate.release();
307 307
308 m_previousActiveInterpolationsForAnimations.swap(update->activeInterpolation sForAnimations()); 308 m_previousActiveInterpolationsForAnimations.swap(update->activeInterpolation sForAnimations());
309 309
310 // FIXME: cancelling, pausing, unpausing animations all query compositingSta te, which is not necessarily up to date here 310 // FIXME: cancelling, pausing, unpausing animations all query compositingSta te, which is not necessarily up to date here
311 // since we call this from recalc style. 311 // since we call this from recalc style.
312 // https://code.google.com/p/chromium/issues/detail?id=339847 312 // https://code.google.com/p/chromium/issues/detail?id=339847
313 DisableCompositingQueryAsserts disabler; 313 DisableCompositingQueryAsserts disabler;
314 314
315 for (const AtomicString& animationName : update->cancelledAnimationNames()) { 315 for (const AtomicString& animationName : update->cancelledAnimationNames()) {
316 RefPtrWillBeRawPtr<AnimationPlayer> player = m_animations.take(animation Name)->player; 316 RefPtrWillBeRawPtr<Animation> animation = m_animations.take(animationNam e)->animation;
317 player->cancel(); 317 animation->cancel();
318 player->update(TimingUpdateOnDemand); 318 animation->update(TimingUpdateOnDemand);
319 } 319 }
320 320
321 for (const AtomicString& animationName : update->animationsWithPauseToggled( )) { 321 for (const AtomicString& animationName : update->animationsWithPauseToggled( )) {
322 AnimationPlayer* player = m_animations.get(animationName)->player.get(); 322 Animation* animation = m_animations.get(animationName)->animation.get();
323 if (player->paused()) 323 if (animation->paused())
324 player->unpause(); 324 animation->unpause();
325 else 325 else
326 player->pause(); 326 animation->pause();
327 if (player->outdated()) 327 if (animation->outdated())
328 player->update(TimingUpdateOnDemand); 328 animation->update(TimingUpdateOnDemand);
329 } 329 }
330 330
331 for (const auto& entry : update->animationsWithUpdates()) { 331 for (const auto& entry : update->animationsWithUpdates()) {
332 Animation* animation = toAnimation(entry.player->source()); 332 KeyframeEffect* effect = toKeyframeEffect(entry.animation->source());
333 333
334 animation->setEffect(entry.animation->effect()); 334 effect->setEffect(entry.effect->effect());
335 animation->updateSpecifiedTiming(entry.animation->specifiedTiming()); 335 effect->updateSpecifiedTiming(entry.effect->specifiedTiming());
336 336
337 m_animations.find(entry.name)->value->update(entry); 337 m_animations.find(entry.name)->value->update(entry);
338 } 338 }
339 339
340 for (const auto& styleUpdate : update->animationsWithStyleUpdates()) { 340 for (const auto& styleUpdate : update->animationsWithStyleUpdates()) {
341 styleUpdate.effect->forEachInterpolation([](Interpolation& interpolation ) { 341 styleUpdate.effect->forEachInterpolation([](Interpolation& interpolation ) {
342 if (interpolation.isStyleInterpolation() && toStyleInterpolation(int erpolation).isDeferredLegacyStyleInterpolation()) 342 if (interpolation.isStyleInterpolation() && toStyleInterpolation(int erpolation).isDeferredLegacyStyleInterpolation())
343 toDeferredLegacyStyleInterpolation(toStyleInterpolation(interpol ation)).underlyingStyleChanged(); 343 toDeferredLegacyStyleInterpolation(toStyleInterpolation(interpol ation)).underlyingStyleChanged();
344 }); 344 });
345 345
346 bool updated = false; 346 bool updated = false;
347 if (styleUpdate.snapshot.opacity) 347 if (styleUpdate.snapshot.opacity)
348 updated |= styleUpdate.effect->updateNeutralKeyframeAnimatableValues (CSSPropertyOpacity, styleUpdate.snapshot.opacity); 348 updated |= styleUpdate.effect->updateNeutralKeyframeAnimatableValues (CSSPropertyOpacity, styleUpdate.snapshot.opacity);
349 if (styleUpdate.snapshot.transform) 349 if (styleUpdate.snapshot.transform)
350 updated |= styleUpdate.effect->updateNeutralKeyframeAnimatableValues (CSSPropertyTransform, styleUpdate.snapshot.transform); 350 updated |= styleUpdate.effect->updateNeutralKeyframeAnimatableValues (CSSPropertyTransform, styleUpdate.snapshot.transform);
351 if (styleUpdate.snapshot.webkitFilter) 351 if (styleUpdate.snapshot.webkitFilter)
352 updated |= styleUpdate.effect->updateNeutralKeyframeAnimatableValues (CSSPropertyWebkitFilter, styleUpdate.snapshot.webkitFilter); 352 updated |= styleUpdate.effect->updateNeutralKeyframeAnimatableValues (CSSPropertyWebkitFilter, styleUpdate.snapshot.webkitFilter);
353 if (updated) { 353 if (updated) {
354 styleUpdate.player->setOutdated(); 354 styleUpdate.animation->setOutdated();
355 styleUpdate.player->setCompositorPending(true); 355 styleUpdate.animation->setCompositorPending(true);
356 } 356 }
357 } 357 }
358 358
359 for (const auto& entry : update->newAnimations()) { 359 for (const auto& entry : update->newAnimations()) {
360 const InertAnimation* inertAnimation = entry.animation.get(); 360 const InertAnimation* inertAnimation = entry.effect.get();
361 OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillB eNoop(new AnimationEventDelegate(element, entry.name)); 361 OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillB eNoop(new AnimationEventDelegate(element, entry.name));
362 RefPtrWillBeRawPtr<Animation> animation = Animation::create(element, ine rtAnimation->effect(), inertAnimation->specifiedTiming(), Animation::DefaultPrio rity, eventDelegate.release()); 362 RefPtrWillBeRawPtr<KeyframeEffect> effect = KeyframeEffect::create(eleme nt, inertAnimation->effect(), inertAnimation->specifiedTiming(), KeyframeEffect: :DefaultPriority, eventDelegate.release());
363 animation->setName(inertAnimation->name()); 363 effect->setName(inertAnimation->name());
364 RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timelin e().play(animation.get()); 364 RefPtrWillBeRawPtr<Animation> animation = element->document().timeline() .play(effect.get());
365 if (inertAnimation->paused()) 365 if (inertAnimation->paused())
366 player->pause(); 366 animation->pause();
367 player->update(TimingUpdateOnDemand); 367 animation->update(TimingUpdateOnDemand);
368 368
369 m_animations.set(entry.name, adoptRefWillBeNoop(new RunningAnimation(pla yer, entry))); 369 m_animations.set(entry.name, adoptRefWillBeNoop(new RunningAnimation(ani mation, entry)));
370 } 370 }
371 371
372 // Transitions that are run on the compositor only update main-thread state 372 // Transitions that are run on the compositor only update main-thread state
373 // lazily. However, we need the new state to know what the from state shoud 373 // lazily. However, we need the new state to know what the from state shoud
374 // be when transitions are retargeted. Instead of triggering complete style 374 // be when transitions are retargeted. Instead of triggering complete style
375 // recalculation, we find these cases by searching for new transitions that 375 // recalculation, we find these cases by searching for new transitions that
376 // have matching cancelled animation property IDs on the compositor. 376 // have matching cancelled animation property IDs on the compositor.
377 WillBeHeapHashMap<CSSPropertyID, std::pair<RefPtrWillBeMember<Animation>, do uble>> retargetedCompositorTransitions; 377 WillBeHeapHashMap<CSSPropertyID, std::pair<RefPtrWillBeMember<KeyframeEffect >, double>> retargetedCompositorTransitions;
378 for (CSSPropertyID id : update->cancelledTransitions()) { 378 for (CSSPropertyID id : update->cancelledTransitions()) {
379 ASSERT(m_transitions.contains(id)); 379 ASSERT(m_transitions.contains(id));
380 380
381 RefPtrWillBeRawPtr<AnimationPlayer> player = m_transitions.take(id).play er; 381 RefPtrWillBeRawPtr<Animation> animation = m_transitions.take(id).animati on;
382 Animation* animation = toAnimation(player->source()); 382 KeyframeEffect* effect = toKeyframeEffect(animation->source());
383 if (animation->hasActiveAnimationsOnCompositor(id) && update->newTransit ions().find(id) != update->newTransitions().end() && !player->limited()) 383 if (effect->hasActiveAnimationsOnCompositor(id) && update->newTransition s().find(id) != update->newTransitions().end() && !animation->limited())
384 retargetedCompositorTransitions.add(id, std::pair<RefPtrWillBeMember <Animation>, double>(animation, player->startTimeInternal())); 384 retargetedCompositorTransitions.add(id, std::pair<RefPtrWillBeMember <KeyframeEffect>, double>(effect, animation->startTimeInternal()));
385 player->cancel(); 385 animation->cancel();
386 // after cancelation, transitions must be downgraded or they'll fail 386 // after cancelation, transitions must be downgraded or they'll fail
387 // to be considered when retriggering themselves. This can happen if 387 // to be considered when retriggering themselves. This can happen if
388 // the transition is captured through getAnimationPlayers then played. 388 // the transition is captured through getAnimations then played.
389 if (player->source() && player->source()->isAnimation()) 389 if (animation->source() && animation->source()->isAnimation())
390 toAnimation(player->source())->downgradeToNormalAnimation(); 390 toKeyframeEffect(animation->source())->downgradeToNormal();
391 player->update(TimingUpdateOnDemand); 391 animation->update(TimingUpdateOnDemand);
392 } 392 }
393 393
394 for (CSSPropertyID id : update->finishedTransitions()) { 394 for (CSSPropertyID id : update->finishedTransitions()) {
395 // This transition can also be cancelled and finished at the same time 395 // This transition can also be cancelled and finished at the same time
396 if (m_transitions.contains(id)) { 396 if (m_transitions.contains(id)) {
397 RefPtrWillBeRawPtr<AnimationPlayer> player = m_transitions.take(id). player; 397 RefPtrWillBeRawPtr<Animation> animation = m_transitions.take(id).ani mation;
398 // Transition must be downgraded 398 // Transition must be downgraded
399 if (player->source() && player->source()->isAnimation()) 399 if (animation->source() && animation->source()->isAnimation())
400 toAnimation(player->source())->downgradeToNormalAnimation(); 400 toKeyframeEffect(animation->source())->downgradeToNormal();
401 } 401 }
402 } 402 }
403 403
404 for (const auto& entry : update->newTransitions()) { 404 for (const auto& entry : update->newTransitions()) {
405 const CSSAnimationUpdate::NewTransition& newTransition = entry.value; 405 const CSSAnimationUpdate::NewTransition& newTransition = entry.value;
406 406
407 RunningTransition runningTransition; 407 RunningTransition runningTransition;
408 runningTransition.from = newTransition.from; 408 runningTransition.from = newTransition.from;
409 runningTransition.to = newTransition.to; 409 runningTransition.to = newTransition.to;
410 410
411 CSSPropertyID id = newTransition.id; 411 CSSPropertyID id = newTransition.id;
412 InertAnimation* inertAnimation = newTransition.animation.get(); 412 InertAnimation* inertAnimation = newTransition.effect.get();
413 OwnPtrWillBeRawPtr<TransitionEventDelegate> eventDelegate = adoptPtrWill BeNoop(new TransitionEventDelegate(element, newTransition.eventId)); 413 OwnPtrWillBeRawPtr<TransitionEventDelegate> eventDelegate = adoptPtrWill BeNoop(new TransitionEventDelegate(element, newTransition.eventId));
414 414
415 RefPtrWillBeRawPtr<AnimationEffect> effect = inertAnimation->effect(); 415 RefPtrWillBeRawPtr<EffectModel> effect = inertAnimation->effect();
416 416
417 if (retargetedCompositorTransitions.contains(id)) { 417 if (retargetedCompositorTransitions.contains(id)) {
418 const std::pair<RefPtrWillBeMember<Animation>, double>& oldTransitio n = retargetedCompositorTransitions.get(id); 418 const std::pair<RefPtrWillBeMember<KeyframeEffect>, double>& oldTran sition = retargetedCompositorTransitions.get(id);
419 RefPtrWillBeRawPtr<Animation> oldAnimation = oldTransition.first; 419 RefPtrWillBeRawPtr<KeyframeEffect> oldAnimation = oldTransition.firs t;
420 double oldStartTime = oldTransition.second; 420 double oldStartTime = oldTransition.second;
421 double inheritedTime = isNull(oldStartTime) ? 0 : element->document( ).timeline().currentTimeInternal() - oldStartTime; 421 double inheritedTime = isNull(oldStartTime) ? 0 : element->document( ).timeline().currentTimeInternal() - oldStartTime;
422 422
423 AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKey frameEffectModel(inertAnimation->effect()); 423 AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKey frameEffectModel(inertAnimation->effect());
424 const KeyframeVector& frames = oldEffect->getFrames(); 424 const KeyframeVector& frames = oldEffect->getFrames();
425 425
426 AnimatableValueKeyframeVector newFrames; 426 AnimatableValueKeyframeVector newFrames;
427 newFrames.append(toAnimatableValueKeyframe(frames[0]->clone().get()) ); 427 newFrames.append(toAnimatableValueKeyframe(frames[0]->clone().get()) );
428 newFrames.append(toAnimatableValueKeyframe(frames[1]->clone().get()) ); 428 newFrames.append(toAnimatableValueKeyframe(frames[1]->clone().get()) );
429 newFrames.append(toAnimatableValueKeyframe(frames[2]->clone().get()) ); 429 newFrames.append(toAnimatableValueKeyframe(frames[2]->clone().get()) );
430 newFrames[0]->clearPropertyValue(id); 430 newFrames[0]->clearPropertyValue(id);
431 newFrames[1]->clearPropertyValue(id); 431 newFrames[1]->clearPropertyValue(id);
432 432
433 RefPtrWillBeRawPtr<InertAnimation> inertAnimationForSampling = Inert Animation::create(oldAnimation->effect(), oldAnimation->specifiedTiming(), false , inheritedTime); 433 RefPtrWillBeRawPtr<InertAnimation> inertAnimationForSampling = Inert Animation::create(oldAnimation->effect(), oldAnimation->specifiedTiming(), false , inheritedTime);
434 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation >>> sample = nullptr; 434 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation >>> sample = nullptr;
435 inertAnimationForSampling->sample(sample); 435 inertAnimationForSampling->sample(sample);
436 if (sample && sample->size() == 1) { 436 if (sample && sample->size() == 1) {
437 newFrames[0]->setPropertyValue(id, toLegacyStyleInterpolation(sa mple->at(0).get())->currentValue()); 437 newFrames[0]->setPropertyValue(id, toLegacyStyleInterpolation(sa mple->at(0).get())->currentValue());
438 newFrames[1]->setPropertyValue(id, toLegacyStyleInterpolation(sa mple->at(0).get())->currentValue()); 438 newFrames[1]->setPropertyValue(id, toLegacyStyleInterpolation(sa mple->at(0).get())->currentValue());
439 effect = AnimatableValueKeyframeEffectModel::create(newFrames); 439 effect = AnimatableValueKeyframeEffectModel::create(newFrames);
440 } 440 }
441 } 441 }
442 442
443 RefPtrWillBeRawPtr<Animation> transition = Animation::create(element, ef fect, inertAnimation->specifiedTiming(), Animation::TransitionPriority, eventDel egate.release()); 443 RefPtrWillBeRawPtr<KeyframeEffect> transition = KeyframeEffect::create(e lement, effect, inertAnimation->specifiedTiming(), KeyframeEffect::TransitionPri ority, eventDelegate.release());
444 transition->setName(inertAnimation->name()); 444 transition->setName(inertAnimation->name());
445 RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timelin e().play(transition.get()); 445 RefPtrWillBeRawPtr<Animation> animation = element->document().timeline() .play(transition.get());
446 player->update(TimingUpdateOnDemand); 446 animation->update(TimingUpdateOnDemand);
447 runningTransition.player = player; 447 runningTransition.animation = animation;
448 m_transitions.set(id, runningTransition); 448 m_transitions.set(id, runningTransition);
449 ASSERT(id != CSSPropertyInvalid); 449 ASSERT(id != CSSPropertyInvalid);
450 Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); 450 Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id));
451 } 451 }
452 } 452 }
453 453
454 void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, CSSPr opertyID eventId, const CSSTransitionData& transitionData, size_t transitionInde x, const ComputedStyle& oldStyle, const ComputedStyle& style, const TransitionMa p* activeTransitions, CSSAnimationUpdate* update, const Element* element) 454 void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, CSSPr opertyID eventId, const CSSTransitionData& transitionData, size_t transitionInde x, const ComputedStyle& oldStyle, const ComputedStyle& style, const TransitionMa p* activeTransitions, CSSAnimationUpdate* update, const Element* element)
455 { 455 {
456 RefPtrWillBeRawPtr<AnimatableValue> to = nullptr; 456 RefPtrWillBeRawPtr<AnimatableValue> to = nullptr;
457 if (activeTransitions) { 457 if (activeTransitions) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 568 }
569 } 569 }
570 } 570 }
571 } 571 }
572 572
573 if (activeTransitions) { 573 if (activeTransitions) {
574 for (const auto& entry : *activeTransitions) { 574 for (const auto& entry : *activeTransitions) {
575 CSSPropertyID id = entry.key; 575 CSSPropertyID id = entry.key;
576 if (!anyTransitionHadTransitionAll && !animationStyleRecalc && !list edProperties.get(id)) { 576 if (!anyTransitionHadTransitionAll && !animationStyleRecalc && !list edProperties.get(id)) {
577 // TODO: Figure out why this fails on Chrome OS login page. crbu g.com/365507 577 // TODO: Figure out why this fails on Chrome OS login page. crbu g.com/365507
578 // ASSERT(player.playStateInternal() == AnimationPlayer::Finishe d || !(elementAnimations && elementAnimations->isAnimationStyleChange())); 578 // ASSERT(animation.playStateInternal() == Animation::Finished | | !(elementAnimations && elementAnimations->isAnimationStyleChange()));
579 update->cancelTransition(id); 579 update->cancelTransition(id);
580 } else if (entry.value.player->finishedInternal()) { 580 } else if (entry.value.animation->finishedInternal()) {
581 update->finishTransition(id); 581 update->finishTransition(id);
582 } 582 }
583 } 583 }
584 } 584 }
585 } 585 }
586 586
587 void CSSAnimations::cancel() 587 void CSSAnimations::cancel()
588 { 588 {
589 for (const auto& entry : m_animations) { 589 for (const auto& entry : m_animations) {
590 entry.value->player->cancel(); 590 entry.value->animation->cancel();
591 entry.value->player->update(TimingUpdateOnDemand); 591 entry.value->animation->update(TimingUpdateOnDemand);
592 } 592 }
593 593
594 for (const auto& entry : m_transitions) { 594 for (const auto& entry : m_transitions) {
595 entry.value.player->cancel(); 595 entry.value.animation->cancel();
596 entry.value.player->update(TimingUpdateOnDemand); 596 entry.value.animation->update(TimingUpdateOnDemand);
597 } 597 }
598 598
599 m_animations.clear(); 599 m_animations.clear();
600 m_transitions.clear(); 600 m_transitions.clear();
601 m_pendingUpdate = nullptr; 601 m_pendingUpdate = nullptr;
602 } 602 }
603 603
604 void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate* u pdate, const Element* animatingElement, double timelineCurrentTime) 604 void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate* u pdate, const Element* animatingElement, double timelineCurrentTime)
605 { 605 {
606 ElementAnimations* elementAnimations = animatingElement ? animatingElement-> elementAnimations() : nullptr; 606 ElementAnimations* elementAnimations = animatingElement ? animatingElement-> elementAnimations() : nullptr;
607 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def aultStack() : nullptr; 607 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def aultStack() : nullptr;
608 608
609 if (update->newAnimations().isEmpty() && update->suppressedAnimationAnimatio nPlayers().isEmpty()) { 609 if (update->newAnimations().isEmpty() && update->suppressedAnimationAnimatio ns().isEmpty()) {
610 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack: :activeInterpolations(animationStack, 0, 0, Animation::DefaultPriority, timeline CurrentTime)); 610 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack: :activeInterpolations(animationStack, 0, 0, KeyframeEffect::DefaultPriority, tim elineCurrentTime));
611 update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAn imations); 611 update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAn imations);
612 return; 612 return;
613 } 613 }
614 614
615 WillBeHeapVector<RawPtrWillBeMember<InertAnimation>> newAnimations; 615 WillBeHeapVector<RawPtrWillBeMember<InertAnimation>> newEffects;
616 for (const auto& newAnimation : update->newAnimations()) 616 for (const auto& newAnimation : update->newAnimations())
617 newAnimations.append(newAnimation.animation.get()); 617 newEffects.append(newAnimation.effect.get());
618 for (const auto& updatedAnimation : update->animationsWithUpdates()) 618 for (const auto& updatedAnimation : update->animationsWithUpdates())
619 newAnimations.append(updatedAnimation.animation.get()); // Animations wi th updates use a temporary InertAnimation for the current frame. 619 newEffects.append(updatedAnimation.effect.get()); // Animations with upd ates use a temporary InertAnimation for the current frame.
620 620
621 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack::act iveInterpolations(animationStack, &newAnimations, &update->suppressedAnimationAn imationPlayers(), Animation::DefaultPriority, timelineCurrentTime)); 621 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack::act iveInterpolations(animationStack, &newEffects, &update->suppressedAnimationAnima tions(), KeyframeEffect::DefaultPriority, timelineCurrentTime));
622 update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimat ions); 622 update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimat ions);
623 } 623 }
624 624
625 void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate* update, const Element* animatingElement, double timelineCurrentTime) 625 void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate* update, const Element* animatingElement, double timelineCurrentTime)
626 { 626 {
627 ElementAnimations* elementAnimations = animatingElement ? animatingElement-> elementAnimations() : nullptr; 627 ElementAnimations* elementAnimations = animatingElement ? animatingElement-> elementAnimations() : nullptr;
628 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def aultStack() : nullptr; 628 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def aultStack() : nullptr;
629 629
630 ActiveInterpolationMap activeInterpolationsForTransitions; 630 ActiveInterpolationMap activeInterpolationsForTransitions;
631 if (update->newTransitions().isEmpty() && update->cancelledTransitions().isE mpty()) { 631 if (update->newTransitions().isEmpty() && update->cancelledTransitions().isE mpty()) {
632 activeInterpolationsForTransitions = AnimationStack::activeInterpolation s(animationStack, 0, 0, Animation::TransitionPriority, timelineCurrentTime); 632 activeInterpolationsForTransitions = AnimationStack::activeInterpolation s(animationStack, 0, 0, KeyframeEffect::TransitionPriority, timelineCurrentTime) ;
633 } else { 633 } else {
634 WillBeHeapVector<RawPtrWillBeMember<InertAnimation>> newTransitions; 634 WillBeHeapVector<RawPtrWillBeMember<InertAnimation>> newTransitions;
635 for (const auto& entry : update->newTransitions()) 635 for (const auto& entry : update->newTransitions())
636 newTransitions.append(entry.value.animation.get()); 636 newTransitions.append(entry.value.effect.get());
637 637
638 WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer>> cancelledAn imationPlayers; 638 WillBeHeapHashSet<RawPtrWillBeMember<const Animation>> cancelledAnimatio ns;
639 if (!update->cancelledTransitions().isEmpty()) { 639 if (!update->cancelledTransitions().isEmpty()) {
640 ASSERT(elementAnimations); 640 ASSERT(elementAnimations);
641 const TransitionMap& transitionMap = elementAnimations->cssAnimation s().m_transitions; 641 const TransitionMap& transitionMap = elementAnimations->cssAnimation s().m_transitions;
642 for (CSSPropertyID id : update->cancelledTransitions()) { 642 for (CSSPropertyID id : update->cancelledTransitions()) {
643 ASSERT(transitionMap.contains(id)); 643 ASSERT(transitionMap.contains(id));
644 cancelledAnimationPlayers.add(transitionMap.get(id).player.get() ); 644 cancelledAnimations.add(transitionMap.get(id).animation.get());
645 } 645 }
646 } 646 }
647 647
648 activeInterpolationsForTransitions = AnimationStack::activeInterpolation s(animationStack, &newTransitions, &cancelledAnimationPlayers, Animation::Transi tionPriority, timelineCurrentTime); 648 activeInterpolationsForTransitions = AnimationStack::activeInterpolation s(animationStack, &newTransitions, &cancelledAnimations, KeyframeEffect::Transit ionPriority, timelineCurrentTime);
649 } 649 }
650 650
651 // Properties being animated by animations don't get values from transitions applied. 651 // Properties being animated by animations don't get values from transitions applied.
652 if (!update->activeInterpolationsForAnimations().isEmpty() && !activeInterpo lationsForTransitions.isEmpty()) { 652 if (!update->activeInterpolationsForAnimations().isEmpty() && !activeInterpo lationsForTransitions.isEmpty()) {
653 for (const auto& entry : update->activeInterpolationsForAnimations()) 653 for (const auto& entry : update->activeInterpolationsForAnimations())
654 activeInterpolationsForTransitions.remove(entry.key); 654 activeInterpolationsForTransitions.remove(entry.key);
655 } 655 }
656 update->adoptActiveInterpolationsForTransitions(activeInterpolationsForTrans itions); 656 update->adoptActiveInterpolationsForTransitions(activeInterpolationsForTrans itions);
657 } 657 }
658 658
659 EventTarget* CSSAnimations::AnimationEventDelegate::eventTarget() const 659 EventTarget* CSSAnimations::AnimationEventDelegate::eventTarget() const
660 { 660 {
661 return EventPath::eventTargetRespectingTargetRules(*m_animationTarget); 661 return EventPath::eventTargetRespectingTargetRules(*m_animationTarget);
662 } 662 }
663 663
664 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType listenerType, const AtomicString& eventName, double elapsedTime) 664 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType listenerType, const AtomicString& eventName, double elapsedTime)
665 { 665 {
666 if (m_animationTarget->document().hasListenerType(listenerType)) { 666 if (m_animationTarget->document().hasListenerType(listenerType)) {
667 RefPtrWillBeRawPtr<AnimationEvent> event = AnimationEvent::create(eventN ame, m_name, elapsedTime); 667 RefPtrWillBeRawPtr<AnimationEvent> event = AnimationEvent::create(eventN ame, m_name, elapsedTime);
668 event->setTarget(eventTarget()); 668 event->setTarget(eventTarget());
669 document().enqueueAnimationFrameEvent(event); 669 document().enqueueAnimationFrameEvent(event);
670 } 670 }
671 } 671 }
672 672
673 bool CSSAnimations::AnimationEventDelegate::requiresIterationEvents(const Animat ionNode& animationNode) 673 bool CSSAnimations::AnimationEventDelegate::requiresIterationEvents(const Animat ionEffect& animationNode)
674 { 674 {
675 return document().hasListenerType(Document::ANIMATIONITERATION_LISTENER); 675 return document().hasListenerType(Document::ANIMATIONITERATION_LISTENER);
676 } 676 }
677 677
678 void CSSAnimations::AnimationEventDelegate::onEventCondition(const AnimationNode & animationNode) 678 void CSSAnimations::AnimationEventDelegate::onEventCondition(const AnimationEffe ct& animationNode)
679 { 679 {
680 const AnimationNode::Phase currentPhase = animationNode.phase(); 680 const AnimationEffect::Phase currentPhase = animationNode.phase();
681 const double currentIteration = animationNode.currentIteration(); 681 const double currentIteration = animationNode.currentIteration();
682 682
683 if (m_previousPhase != currentPhase 683 if (m_previousPhase != currentPhase
684 && (currentPhase == AnimationNode::PhaseActive || currentPhase == Animat ionNode::PhaseAfter) 684 && (currentPhase == AnimationEffect::PhaseActive || currentPhase == Anim ationEffect::PhaseAfter)
685 && (m_previousPhase == AnimationNode::PhaseNone || m_previousPhase == An imationNode::PhaseBefore)) { 685 && (m_previousPhase == AnimationEffect::PhaseNone || m_previousPhase == AnimationEffect::PhaseBefore)) {
686 const double startDelay = animationNode.specifiedTiming().startDelay; 686 const double startDelay = animationNode.specifiedTiming().startDelay;
687 const double elapsedTime = startDelay < 0 ? -startDelay : 0; 687 const double elapsedTime = startDelay < 0 ? -startDelay : 0;
688 maybeDispatch(Document::ANIMATIONSTART_LISTENER, EventTypeNames::animati onstart, elapsedTime); 688 maybeDispatch(Document::ANIMATIONSTART_LISTENER, EventTypeNames::animati onstart, elapsedTime);
689 } 689 }
690 690
691 if (currentPhase == AnimationNode::PhaseActive && m_previousPhase == current Phase && m_previousIteration != currentIteration) { 691 if (currentPhase == AnimationEffect::PhaseActive && m_previousPhase == curre ntPhase && m_previousIteration != currentIteration) {
692 // We fire only a single event for all iterations thast terminate 692 // We fire only a single event for all iterations thast terminate
693 // between a single pair of samples. See http://crbug.com/275263. For 693 // between a single pair of samples. See http://crbug.com/275263. For
694 // compatibility with the existing implementation, this event uses 694 // compatibility with the existing implementation, this event uses
695 // the elapsedTime for the first iteration in question. 695 // the elapsedTime for the first iteration in question.
696 ASSERT(!std::isnan(animationNode.specifiedTiming().iterationDuration)); 696 ASSERT(!std::isnan(animationNode.specifiedTiming().iterationDuration));
697 const double elapsedTime = animationNode.specifiedTiming().iterationDura tion * (m_previousIteration + 1); 697 const double elapsedTime = animationNode.specifiedTiming().iterationDura tion * (m_previousIteration + 1);
698 maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::ani mationiteration, elapsedTime); 698 maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::ani mationiteration, elapsedTime);
699 } 699 }
700 700
701 if (currentPhase == AnimationNode::PhaseAfter && m_previousPhase != Animatio nNode::PhaseAfter) 701 if (currentPhase == AnimationEffect::PhaseAfter && m_previousPhase != Animat ionEffect::PhaseAfter)
702 maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animation end, animationNode.activeDurationInternal()); 702 maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animation end, animationNode.activeDurationInternal());
703 703
704 m_previousPhase = currentPhase; 704 m_previousPhase = currentPhase;
705 m_previousIteration = currentIteration; 705 m_previousIteration = currentIteration;
706 } 706 }
707 707
708 DEFINE_TRACE(CSSAnimations::AnimationEventDelegate) 708 DEFINE_TRACE(CSSAnimations::AnimationEventDelegate)
709 { 709 {
710 visitor->trace(m_animationTarget); 710 visitor->trace(m_animationTarget);
711 AnimationNode::EventDelegate::trace(visitor); 711 AnimationEffect::EventDelegate::trace(visitor);
712 } 712 }
713 713
714 EventTarget* CSSAnimations::TransitionEventDelegate::eventTarget() const 714 EventTarget* CSSAnimations::TransitionEventDelegate::eventTarget() const
715 { 715 {
716 return EventPath::eventTargetRespectingTargetRules(*m_transitionTarget); 716 return EventPath::eventTargetRespectingTargetRules(*m_transitionTarget);
717 } 717 }
718 718
719 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationNod e& animationNode) 719 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationEff ect& animationNode)
720 { 720 {
721 const AnimationNode::Phase currentPhase = animationNode.phase(); 721 const AnimationEffect::Phase currentPhase = animationNode.phase();
722 if (currentPhase == AnimationNode::PhaseAfter && currentPhase != m_previousP hase && document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { 722 if (currentPhase == AnimationEffect::PhaseAfter && currentPhase != m_previou sPhase && document().hasListenerType(Document::TRANSITIONEND_LISTENER)) {
723 String propertyName = getPropertyNameString(m_property); 723 String propertyName = getPropertyNameString(m_property);
724 const Timing& timing = animationNode.specifiedTiming(); 724 const Timing& timing = animationNode.specifiedTiming();
725 double elapsedTime = timing.iterationDuration; 725 double elapsedTime = timing.iterationDuration;
726 const AtomicString& eventType = EventTypeNames::transitionend; 726 const AtomicString& eventType = EventTypeNames::transitionend;
727 String pseudoElement = PseudoElement::pseudoElementNameForEvents(pseudoI d()); 727 String pseudoElement = PseudoElement::pseudoElementNameForEvents(pseudoI d());
728 RefPtrWillBeRawPtr<TransitionEvent> event = TransitionEvent::create(even tType, propertyName, elapsedTime, pseudoElement); 728 RefPtrWillBeRawPtr<TransitionEvent> event = TransitionEvent::create(even tType, propertyName, elapsedTime, pseudoElement);
729 event->setTarget(eventTarget()); 729 event->setTarget(eventTarget());
730 document().enqueueAnimationFrameEvent(event); 730 document().enqueueAnimationFrameEvent(event);
731 } 731 }
732 732
733 m_previousPhase = currentPhase; 733 m_previousPhase = currentPhase;
734 } 734 }
735 735
736 DEFINE_TRACE(CSSAnimations::TransitionEventDelegate) 736 DEFINE_TRACE(CSSAnimations::TransitionEventDelegate)
737 { 737 {
738 visitor->trace(m_transitionTarget); 738 visitor->trace(m_transitionTarget);
739 AnimationNode::EventDelegate::trace(visitor); 739 AnimationEffect::EventDelegate::trace(visitor);
740 } 740 }
741 741
742 const StylePropertyShorthand& CSSAnimations::propertiesForTransitionAll() 742 const StylePropertyShorthand& CSSAnimations::propertiesForTransitionAll()
743 { 743 {
744 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); 744 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ());
745 DEFINE_STATIC_LOCAL(StylePropertyShorthand, propertyShorthand, ()); 745 DEFINE_STATIC_LOCAL(StylePropertyShorthand, propertyShorthand, ());
746 if (properties.isEmpty()) { 746 if (properties.isEmpty()) {
747 for (int i = firstCSSProperty; i < lastCSSProperty; ++i) { 747 for (int i = firstCSSProperty; i < lastCSSProperty; ++i) {
748 CSSPropertyID id = convertToCSSPropertyID(i); 748 CSSPropertyID id = convertToCSSPropertyID(i);
749 // Avoid creating overlapping transitions with perspective-origin an d transition-origin. 749 // Avoid creating overlapping transitions with perspective-origin an d transition-origin.
750 if (id == CSSPropertyWebkitPerspectiveOriginX 750 if (id == CSSPropertyWebkitPerspectiveOriginX
751 || id == CSSPropertyWebkitPerspectiveOriginY 751 || id == CSSPropertyWebkitPerspectiveOriginY
752 || id == CSSPropertyWebkitTransformOriginX 752 || id == CSSPropertyWebkitTransformOriginX
753 || id == CSSPropertyWebkitTransformOriginY 753 || id == CSSPropertyWebkitTransformOriginY
754 || id == CSSPropertyWebkitTransformOriginZ) 754 || id == CSSPropertyWebkitTransformOriginZ)
755 continue; 755 continue;
756 if (CSSPropertyMetadata::isAnimatableProperty(id)) 756 if (CSSPropertyMetadata::isAnimatableProperty(id))
757 properties.append(id); 757 properties.append(id);
758 } 758 }
759 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie s.begin(), properties.size()); 759 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie s.begin(), properties.size());
760 } 760 }
761 return propertyShorthand; 761 return propertyShorthand;
762 } 762 }
763 763
764 // Animation properties are not allowed to be affected by Web Animations. 764 // KeyframeEffect properties are not allowed to be affected by Web Animations.
765 // http://dev.w3.org/fxtf/web-animations/#not-animatable 765 // http://dev.w3.org/fxtf/web-animations/#not-animatable
766 bool CSSAnimations::isAllowedAnimation(CSSPropertyID property) 766 bool CSSAnimations::isAllowedAnimation(CSSPropertyID property)
767 { 767 {
768 switch (property) { 768 switch (property) {
769 case CSSPropertyAnimation: 769 case CSSPropertyAnimation:
770 case CSSPropertyAnimationDelay: 770 case CSSPropertyAnimationDelay:
771 case CSSPropertyAnimationDirection: 771 case CSSPropertyAnimationDirection:
772 case CSSPropertyAnimationDuration: 772 case CSSPropertyAnimationDuration:
773 case CSSPropertyAnimationFillMode: 773 case CSSPropertyAnimationFillMode:
774 case CSSPropertyAnimationIterationCount: 774 case CSSPropertyAnimationIterationCount:
(...skipping 22 matching lines...) Expand all
797 #endif 797 #endif
798 } 798 }
799 799
800 DEFINE_TRACE(CSSAnimationUpdate) 800 DEFINE_TRACE(CSSAnimationUpdate)
801 { 801 {
802 #if ENABLE(OILPAN) 802 #if ENABLE(OILPAN)
803 visitor->trace(m_newTransitions); 803 visitor->trace(m_newTransitions);
804 visitor->trace(m_activeInterpolationsForAnimations); 804 visitor->trace(m_activeInterpolationsForAnimations);
805 visitor->trace(m_activeInterpolationsForTransitions); 805 visitor->trace(m_activeInterpolationsForTransitions);
806 visitor->trace(m_newAnimations); 806 visitor->trace(m_newAnimations);
807 visitor->trace(m_suppressedAnimationPlayers); 807 visitor->trace(m_suppressedAnimations);
808 visitor->trace(m_animationsWithUpdates); 808 visitor->trace(m_animationsWithUpdates);
809 visitor->trace(m_animationsWithStyleUpdates); 809 visitor->trace(m_animationsWithStyleUpdates);
810 #endif 810 #endif
811 } 811 }
812 812
813 } // namespace blink 813 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/css/CSSAnimations.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698