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

Side by Side Diff: Source/core/animation/css/CSSAnimations.cpp

Issue 1318543009: Oilpan: Partially ship Oilpan for core/animations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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/dom/Document.h » ('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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "public/platform/Platform.h" 58 #include "public/platform/Platform.h"
59 #include "wtf/BitArray.h" 59 #include "wtf/BitArray.h"
60 #include "wtf/HashSet.h" 60 #include "wtf/HashSet.h"
61 61
62 namespace blink { 62 namespace blink {
63 63
64 using PropertySet = HashSet<CSSPropertyID>; 64 using PropertySet = HashSet<CSSPropertyID>;
65 65
66 namespace { 66 namespace {
67 67
68 static PassRefPtrWillBeRawPtr<StringKeyframeEffectModel> createKeyframeEffectMod el(StyleResolver* resolver, const Element* animatingElement, Element& element, c onst ComputedStyle* style, const ComputedStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction, size_t animationIndex) 68 static StringKeyframeEffectModel* createKeyframeEffectModel(StyleResolver* resol ver, const Element* animatingElement, Element& element, const ComputedStyle* sty le, const ComputedStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction, size_t animationIndex)
69 { 69 {
70 // When the animating element is null, use its parent for scoping purposes. 70 // When the animating element is null, use its parent for scoping purposes.
71 const Element* elementForScoping = animatingElement ? animatingElement : &el ement; 71 const Element* elementForScoping = animatingElement ? animatingElement : &el ement;
72 const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elemen tForScoping, name); 72 const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elemen tForScoping, name);
73 ASSERT(keyframesRule); 73 ASSERT(keyframesRule);
74 74
75 StringKeyframeVector keyframes; 75 StringKeyframeVector keyframes;
76 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>& styleKeyframe s = keyframesRule->keyframes(); 76 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>& styleKeyframe s = keyframesRule->keyframes();
77 77
78 // Construct and populate the style for each keyframe 78 // Construct and populate the style for each keyframe
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 for (CSSPropertyID property : allProperties) { 169 for (CSSPropertyID property : allProperties) {
170 bool startNeedsValue = missingStartValues && !startKeyframePropertie s.contains(PropertyHandle(property)); 170 bool startNeedsValue = missingStartValues && !startKeyframePropertie s.contains(PropertyHandle(property));
171 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont ains(PropertyHandle(property)); 171 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont ains(PropertyHandle(property));
172 if (!startNeedsValue && !endNeedsValue) 172 if (!startNeedsValue && !endNeedsValue)
173 continue; 173 continue;
174 if (CompositorAnimations::isCompositableProperty(property)) 174 if (CompositorAnimations::isCompositableProperty(property))
175 UseCounter::count(elementForScoping->document(), UseCounter::Syn theticKeyframesInCompositedCSSAnimation); 175 UseCounter::count(elementForScoping->document(), UseCounter::Syn theticKeyframesInCompositedCSSAnimation);
176 } 176 }
177 } 177 }
178 178
179 RefPtrWillBeRawPtr<StringKeyframeEffectModel> model = StringKeyframeEffectMo del::create(keyframes, &keyframes[0]->easing()); 179 StringKeyframeEffectModel* model = StringKeyframeEffectModel::create(keyfram es, &keyframes[0]->easing());
180 model->forceConversionsToAnimatableValues(element, style); 180 model->forceConversionsToAnimatableValues(element, style);
181 if (animationIndex > 0 && model->hasSyntheticKeyframes()) 181 if (animationIndex > 0 && model->hasSyntheticKeyframes())
182 UseCounter::count(elementForScoping->document(), UseCounter::CSSAnimatio nsStackedNeutralKeyframe); 182 UseCounter::count(elementForScoping->document(), UseCounter::CSSAnimatio nsStackedNeutralKeyframe);
183 return model; 183 return model;
184 } 184 }
185 185
186 } // namespace 186 } // namespace
187 187
188 CSSAnimations::CSSAnimations() 188 CSSAnimations::CSSAnimations()
189 { 189 {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 return; 307 return;
308 308
309 m_previousActiveInterpolationsForAnimations.swap(m_pendingUpdate.activeInter polationsForAnimations()); 309 m_previousActiveInterpolationsForAnimations.swap(m_pendingUpdate.activeInter polationsForAnimations());
310 310
311 // FIXME: cancelling, pausing, unpausing animations all query compositingSta te, which is not necessarily up to date here 311 // FIXME: cancelling, pausing, unpausing animations all query compositingSta te, which is not necessarily up to date here
312 // since we call this from recalc style. 312 // since we call this from recalc style.
313 // https://code.google.com/p/chromium/issues/detail?id=339847 313 // https://code.google.com/p/chromium/issues/detail?id=339847
314 DisableCompositingQueryAsserts disabler; 314 DisableCompositingQueryAsserts disabler;
315 315
316 for (const AtomicString& animationName : m_pendingUpdate.cancelledAnimationN ames()) { 316 for (const AtomicString& animationName : m_pendingUpdate.cancelledAnimationN ames()) {
317 RefPtrWillBeRawPtr<Animation> animation = m_animations.take(animationNam e)->animation; 317 Animation* animation = m_animations.take(animationName)->animation;
318 animation->cancel(); 318 animation->cancel();
319 animation->update(TimingUpdateOnDemand); 319 animation->update(TimingUpdateOnDemand);
320 } 320 }
321 321
322 for (const AtomicString& animationName : m_pendingUpdate.animationsWithPause Toggled()) { 322 for (const AtomicString& animationName : m_pendingUpdate.animationsWithPause Toggled()) {
323 Animation* animation = m_animations.get(animationName)->animation.get(); 323 Animation* animation = m_animations.get(animationName)->animation.get();
324 if (animation->paused()) 324 if (animation->paused())
325 animation->unpause(); 325 animation->unpause();
326 else 326 else
327 animation->pause(); 327 animation->pause();
(...skipping 26 matching lines...) Expand all
354 KeyframeEffect* effect = toKeyframeEffect(entry.animation->effect()); 354 KeyframeEffect* effect = toKeyframeEffect(entry.animation->effect());
355 355
356 effect->setModel(entry.effect->model()); 356 effect->setModel(entry.effect->model());
357 effect->updateSpecifiedTiming(entry.effect->specifiedTiming()); 357 effect->updateSpecifiedTiming(entry.effect->specifiedTiming());
358 358
359 m_animations.find(entry.name)->value->update(entry); 359 m_animations.find(entry.name)->value->update(entry);
360 } 360 }
361 361
362 for (const auto& entry : m_pendingUpdate.newAnimations()) { 362 for (const auto& entry : m_pendingUpdate.newAnimations()) {
363 const InertEffect* inertAnimation = entry.effect.get(); 363 const InertEffect* inertAnimation = entry.effect.get();
364 OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillB eNoop(new AnimationEventDelegate(element, entry.name)); 364 AnimationEventDelegate* eventDelegate = new AnimationEventDelegate(eleme nt, entry.name);
365 RefPtrWillBeRawPtr<KeyframeEffect> effect = KeyframeEffect::create(eleme nt, inertAnimation->model(), inertAnimation->specifiedTiming(), KeyframeEffect:: DefaultPriority, eventDelegate.release()); 365 KeyframeEffect* effect = KeyframeEffect::create(element, inertAnimation- >model(), inertAnimation->specifiedTiming(), KeyframeEffect::DefaultPriority, ev entDelegate);
366 effect->setName(inertAnimation->name()); 366 effect->setName(inertAnimation->name());
367 RefPtrWillBeRawPtr<Animation> animation = element->document().timeline() .play(effect.get()); 367 Animation* animation = element->document().timeline().play(effect);
368 if (inertAnimation->paused()) 368 if (inertAnimation->paused())
369 animation->pause(); 369 animation->pause();
370 animation->update(TimingUpdateOnDemand); 370 animation->update(TimingUpdateOnDemand);
371 371
372 m_animations.set(entry.name, adoptRefWillBeNoop(new RunningAnimation(ani mation, entry))); 372 m_animations.set(entry.name, new RunningAnimation(animation, entry));
373 } 373 }
374 374
375 // Transitions that are run on the compositor only update main-thread state 375 // Transitions that are run on the compositor only update main-thread state
376 // lazily. However, we need the new state to know what the from state shoud 376 // lazily. However, we need the new state to know what the from state shoud
377 // be when transitions are retargeted. Instead of triggering complete style 377 // be when transitions are retargeted. Instead of triggering complete style
378 // recalculation, we find these cases by searching for new transitions that 378 // recalculation, we find these cases by searching for new transitions that
379 // have matching cancelled animation property IDs on the compositor. 379 // have matching cancelled animation property IDs on the compositor.
380 WillBeHeapHashMap<CSSPropertyID, std::pair<RefPtrWillBeMember<KeyframeEffect >, double>> retargetedCompositorTransitions; 380 HeapHashMap<CSSPropertyID, std::pair<Member<KeyframeEffect>, double>> retarg etedCompositorTransitions;
381 for (CSSPropertyID id : m_pendingUpdate.cancelledTransitions()) { 381 for (CSSPropertyID id : m_pendingUpdate.cancelledTransitions()) {
382 ASSERT(m_transitions.contains(id)); 382 ASSERT(m_transitions.contains(id));
383 383
384 RefPtrWillBeRawPtr<Animation> animation = m_transitions.take(id).animati on; 384 Animation* animation = m_transitions.take(id).animation;
385 KeyframeEffect* effect = toKeyframeEffect(animation->effect()); 385 KeyframeEffect* effect = toKeyframeEffect(animation->effect());
386 if (effect->hasActiveAnimationsOnCompositor(id) && m_pendingUpdate.newTr ansitions().find(id) != m_pendingUpdate.newTransitions().end() && !animation->li mited()) 386 if (effect->hasActiveAnimationsOnCompositor(id) && m_pendingUpdate.newTr ansitions().find(id) != m_pendingUpdate.newTransitions().end() && !animation->li mited())
387 retargetedCompositorTransitions.add(id, std::pair<RefPtrWillBeMember <KeyframeEffect>, double>(effect, animation->startTimeInternal())); 387 retargetedCompositorTransitions.add(id, std::pair<KeyframeEffect*, d ouble>(effect, animation->startTimeInternal()));
388 animation->cancel(); 388 animation->cancel();
389 // after cancelation, transitions must be downgraded or they'll fail 389 // after cancelation, transitions must be downgraded or they'll fail
390 // to be considered when retriggering themselves. This can happen if 390 // to be considered when retriggering themselves. This can happen if
391 // the transition is captured through getAnimations then played. 391 // the transition is captured through getAnimations then played.
392 if (animation->effect() && animation->effect()->isAnimation()) 392 if (animation->effect() && animation->effect()->isAnimation())
393 toKeyframeEffect(animation->effect())->downgradeToNormal(); 393 toKeyframeEffect(animation->effect())->downgradeToNormal();
394 animation->update(TimingUpdateOnDemand); 394 animation->update(TimingUpdateOnDemand);
395 } 395 }
396 396
397 for (CSSPropertyID id : m_pendingUpdate.finishedTransitions()) { 397 for (CSSPropertyID id : m_pendingUpdate.finishedTransitions()) {
398 // This transition can also be cancelled and finished at the same time 398 // This transition can also be cancelled and finished at the same time
399 if (m_transitions.contains(id)) { 399 if (m_transitions.contains(id)) {
400 RefPtrWillBeRawPtr<Animation> animation = m_transitions.take(id).ani mation; 400 Animation* animation = m_transitions.take(id).animation;
401 // Transition must be downgraded 401 // Transition must be downgraded
402 if (animation->effect() && animation->effect()->isAnimation()) 402 if (animation->effect() && animation->effect()->isAnimation())
403 toKeyframeEffect(animation->effect())->downgradeToNormal(); 403 toKeyframeEffect(animation->effect())->downgradeToNormal();
404 } 404 }
405 } 405 }
406 406
407 for (const auto& entry : m_pendingUpdate.newTransitions()) { 407 for (const auto& entry : m_pendingUpdate.newTransitions()) {
408 const CSSAnimationUpdate::NewTransition& newTransition = entry.value; 408 const CSSAnimationUpdate::NewTransition& newTransition = entry.value;
409 409
410 RunningTransition runningTransition; 410 RunningTransition runningTransition;
411 runningTransition.from = newTransition.from; 411 runningTransition.from = newTransition.from;
412 runningTransition.to = newTransition.to; 412 runningTransition.to = newTransition.to;
413 413
414 CSSPropertyID id = newTransition.id; 414 CSSPropertyID id = newTransition.id;
415 InertEffect* inertAnimation = newTransition.effect.get(); 415 InertEffect* inertAnimation = newTransition.effect.get();
416 OwnPtrWillBeRawPtr<TransitionEventDelegate> eventDelegate = adoptPtrWill BeNoop(new TransitionEventDelegate(element, id)); 416 TransitionEventDelegate* eventDelegate = new TransitionEventDelegate(ele ment, id);
417 417
418 RefPtrWillBeRawPtr<EffectModel> model = inertAnimation->model(); 418 EffectModel* model = inertAnimation->model();
419 419
420 if (retargetedCompositorTransitions.contains(id)) { 420 if (retargetedCompositorTransitions.contains(id)) {
421 const std::pair<RefPtrWillBeMember<KeyframeEffect>, double>& oldTran sition = retargetedCompositorTransitions.get(id); 421 const std::pair<Member<KeyframeEffect>, double>& oldTransition = ret argetedCompositorTransitions.get(id);
422 RefPtrWillBeRawPtr<KeyframeEffect> oldAnimation = oldTransition.firs t; 422 KeyframeEffect* oldAnimation = oldTransition.first;
423 double oldStartTime = oldTransition.second; 423 double oldStartTime = oldTransition.second;
424 double inheritedTime = isNull(oldStartTime) ? 0 : element->document( ).timeline().currentTimeInternal() - oldStartTime; 424 double inheritedTime = isNull(oldStartTime) ? 0 : element->document( ).timeline().currentTimeInternal() - oldStartTime;
425 425
426 AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKey frameEffectModel(inertAnimation->model()); 426 AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKey frameEffectModel(inertAnimation->model());
427 const KeyframeVector& frames = oldEffect->getFrames(); 427 const KeyframeVector& frames = oldEffect->getFrames();
428 428
429 AnimatableValueKeyframeVector newFrames; 429 AnimatableValueKeyframeVector newFrames;
430 newFrames.append(toAnimatableValueKeyframe(frames[0]->clone().get()) ); 430 newFrames.append(toAnimatableValueKeyframe(frames[0]->clone().get()) );
431 newFrames.append(toAnimatableValueKeyframe(frames[1]->clone().get()) ); 431 newFrames.append(toAnimatableValueKeyframe(frames[1]->clone().get()) );
432 newFrames.append(toAnimatableValueKeyframe(frames[2]->clone().get()) ); 432 newFrames.append(toAnimatableValueKeyframe(frames[2]->clone().get()) );
433 newFrames[0]->clearPropertyValue(id); 433 newFrames[0]->clearPropertyValue(id);
434 newFrames[1]->clearPropertyValue(id); 434 newFrames[1]->clearPropertyValue(id);
435 435
436 RefPtrWillBeRawPtr<InertEffect> inertAnimationForSampling = InertEff ect::create(oldAnimation->model(), oldAnimation->specifiedTiming(), false, inher itedTime); 436 InertEffect* inertAnimationForSampling = InertEffect::create(oldAnim ation->model(), oldAnimation->specifiedTiming(), false, inheritedTime);
437 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation >>> sample = nullptr; 437 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation >>> sample = nullptr;
438 inertAnimationForSampling->sample(sample); 438 inertAnimationForSampling->sample(sample);
439 if (sample && sample->size() == 1) { 439 if (sample && sample->size() == 1) {
440 newFrames[0]->setPropertyValue(id, toLegacyStyleInterpolation(sa mple->at(0).get())->currentValue()); 440 newFrames[0]->setPropertyValue(id, toLegacyStyleInterpolation(sa mple->at(0).get())->currentValue());
441 newFrames[1]->setPropertyValue(id, toLegacyStyleInterpolation(sa mple->at(0).get())->currentValue()); 441 newFrames[1]->setPropertyValue(id, toLegacyStyleInterpolation(sa mple->at(0).get())->currentValue());
442 model = AnimatableValueKeyframeEffectModel::create(newFrames); 442 model = AnimatableValueKeyframeEffectModel::create(newFrames);
443 } 443 }
444 } 444 }
445 445
446 RefPtrWillBeRawPtr<KeyframeEffect> transition = KeyframeEffect::create(e lement, model, inertAnimation->specifiedTiming(), KeyframeEffect::TransitionPrio rity, eventDelegate.release()); 446 KeyframeEffect* transition = KeyframeEffect::create(element, model, iner tAnimation->specifiedTiming(), KeyframeEffect::TransitionPriority, eventDelegate );
447 transition->setName(inertAnimation->name()); 447 transition->setName(inertAnimation->name());
448 RefPtrWillBeRawPtr<Animation> animation = element->document().timeline() .play(transition.get()); 448 Animation* animation = element->document().timeline().play(transition);
449 // Set the current time as the start time for retargeted transitions 449 // Set the current time as the start time for retargeted transitions
450 if (retargetedCompositorTransitions.contains(id)) 450 if (retargetedCompositorTransitions.contains(id))
451 animation->setStartTime(element->document().timeline().currentTime() ); 451 animation->setStartTime(element->document().timeline().currentTime() );
452 animation->update(TimingUpdateOnDemand); 452 animation->update(TimingUpdateOnDemand);
453 runningTransition.animation = animation; 453 runningTransition.animation = animation;
454 m_transitions.set(id, runningTransition); 454 m_transitions.set(id, runningTransition);
455 ASSERT(id != CSSPropertyInvalid); 455 ASSERT(id != CSSPropertyInvalid);
456 Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); 456 Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id));
457 } 457 }
458 458
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 startKeyframe->setOffset(startKeyframeOffset); 508 startKeyframe->setOffset(startKeyframeOffset);
509 startKeyframe->setEasing(timing.timingFunction.release()); 509 startKeyframe->setEasing(timing.timingFunction.release());
510 timing.timingFunction = LinearTimingFunction::shared(); 510 timing.timingFunction = LinearTimingFunction::shared();
511 keyframes.append(startKeyframe); 511 keyframes.append(startKeyframe);
512 512
513 RefPtrWillBeRawPtr<AnimatableValueKeyframe> endKeyframe = AnimatableValueKey frame::create(); 513 RefPtrWillBeRawPtr<AnimatableValueKeyframe> endKeyframe = AnimatableValueKey frame::create();
514 endKeyframe->setPropertyValue(id, to.get()); 514 endKeyframe->setPropertyValue(id, to.get());
515 endKeyframe->setOffset(1); 515 endKeyframe->setOffset(1);
516 keyframes.append(endKeyframe); 516 keyframes.append(endKeyframe);
517 517
518 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> model = AnimatableVal ueKeyframeEffectModel::create(keyframes); 518 AnimatableValueKeyframeEffectModel* model = AnimatableValueKeyframeEffectMod el::create(keyframes);
519 update.startTransition(id, from.get(), to.get(), InertEffect::create(model, timing, false, 0)); 519 update.startTransition(id, from.get(), to.get(), InertEffect::create(model, timing, false, 0));
520 ASSERT(!element->elementAnimations() || !element->elementAnimations()->isAni mationStyleChange()); 520 ASSERT(!element->elementAnimations() || !element->elementAnimations()->isAni mationStyleChange());
521 } 521 }
522 522
523 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate& update, const Element* animatingElement, const ComputedStyle& style) 523 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate& update, const Element* animatingElement, const ComputedStyle& style)
524 { 524 {
525 if (!animatingElement) 525 if (!animatingElement)
526 return; 526 return;
527 527
528 ElementAnimations* elementAnimations = animatingElement->elementAnimations() ; 528 ElementAnimations* elementAnimations = animatingElement->elementAnimations() ;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 { 610 {
611 ElementAnimations* elementAnimations = animatingElement ? animatingElement-> elementAnimations() : nullptr; 611 ElementAnimations* elementAnimations = animatingElement ? animatingElement-> elementAnimations() : nullptr;
612 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def aultStack() : nullptr; 612 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def aultStack() : nullptr;
613 613
614 if (update.newAnimations().isEmpty() && update.suppressedAnimations().isEmpt y()) { 614 if (update.newAnimations().isEmpty() && update.suppressedAnimations().isEmpt y()) {
615 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack: :activeInterpolations(animationStack, 0, 0, KeyframeEffect::DefaultPriority, tim elineCurrentTime)); 615 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack: :activeInterpolations(animationStack, 0, 0, KeyframeEffect::DefaultPriority, tim elineCurrentTime));
616 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAni mations); 616 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAni mations);
617 return; 617 return;
618 } 618 }
619 619
620 WillBeHeapVector<RawPtrWillBeMember<InertEffect>> newEffects; 620 HeapVector<Member<InertEffect>> newEffects;
621 for (const auto& newAnimation : update.newAnimations()) 621 for (const auto& newAnimation : update.newAnimations())
622 newEffects.append(newAnimation.effect.get()); 622 newEffects.append(newAnimation.effect.get());
623 for (const auto& updatedAnimation : update.animationsWithUpdates()) 623 for (const auto& updatedAnimation : update.animationsWithUpdates())
624 newEffects.append(updatedAnimation.effect.get()); // Animations with upd ates use a temporary InertEffect for the current frame. 624 newEffects.append(updatedAnimation.effect.get()); // Animations with upd ates use a temporary InertEffect for the current frame.
625 625
626 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack::act iveInterpolations(animationStack, &newEffects, &update.suppressedAnimations(), K eyframeEffect::DefaultPriority, timelineCurrentTime)); 626 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack::act iveInterpolations(animationStack, &newEffects, &update.suppressedAnimations(), K eyframeEffect::DefaultPriority, timelineCurrentTime));
627 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimati ons); 627 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimati ons);
628 } 628 }
629 629
630 void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate& update, const Element* animatingElement, double timelineCurrentTime) 630 void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate& update, const Element* animatingElement, double timelineCurrentTime)
631 { 631 {
632 ElementAnimations* elementAnimations = animatingElement ? animatingElement-> elementAnimations() : nullptr; 632 ElementAnimations* elementAnimations = animatingElement ? animatingElement-> elementAnimations() : nullptr;
633 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def aultStack() : nullptr; 633 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def aultStack() : nullptr;
634 634
635 ActiveInterpolationMap activeInterpolationsForTransitions; 635 ActiveInterpolationMap activeInterpolationsForTransitions;
636 if (update.newTransitions().isEmpty() && update.cancelledTransitions().isEmp ty()) { 636 if (update.newTransitions().isEmpty() && update.cancelledTransitions().isEmp ty()) {
637 activeInterpolationsForTransitions = AnimationStack::activeInterpolation s(animationStack, 0, 0, KeyframeEffect::TransitionPriority, timelineCurrentTime) ; 637 activeInterpolationsForTransitions = AnimationStack::activeInterpolation s(animationStack, 0, 0, KeyframeEffect::TransitionPriority, timelineCurrentTime) ;
638 } else { 638 } else {
639 WillBeHeapVector<RawPtrWillBeMember<InertEffect>> newTransitions; 639 HeapVector<Member<InertEffect>> newTransitions;
640 for (const auto& entry : update.newTransitions()) 640 for (const auto& entry : update.newTransitions())
641 newTransitions.append(entry.value.effect.get()); 641 newTransitions.append(entry.value.effect.get());
642 642
643 WillBeHeapHashSet<RawPtrWillBeMember<const Animation>> cancelledAnimatio ns; 643 HeapHashSet<Member<const Animation>> cancelledAnimations;
644 if (!update.cancelledTransitions().isEmpty()) { 644 if (!update.cancelledTransitions().isEmpty()) {
645 ASSERT(elementAnimations); 645 ASSERT(elementAnimations);
646 const TransitionMap& transitionMap = elementAnimations->cssAnimation s().m_transitions; 646 const TransitionMap& transitionMap = elementAnimations->cssAnimation s().m_transitions;
647 for (CSSPropertyID id : update.cancelledTransitions()) { 647 for (CSSPropertyID id : update.cancelledTransitions()) {
648 ASSERT(transitionMap.contains(id)); 648 ASSERT(transitionMap.contains(id));
649 cancelledAnimations.add(transitionMap.get(id).animation.get()); 649 cancelledAnimations.add(transitionMap.get(id).animation.get());
650 } 650 }
651 } 651 }
652 652
653 activeInterpolationsForTransitions = AnimationStack::activeInterpolation s(animationStack, &newTransitions, &cancelledAnimations, KeyframeEffect::Transit ionPriority, timelineCurrentTime); 653 activeInterpolationsForTransitions = AnimationStack::activeInterpolation s(animationStack, &newTransitions, &cancelledAnimations, KeyframeEffect::Transit ionPriority, timelineCurrentTime);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 case CSSPropertyTransitionProperty: 787 case CSSPropertyTransitionProperty:
788 case CSSPropertyTransitionTimingFunction: 788 case CSSPropertyTransitionTimingFunction:
789 return false; 789 return false;
790 default: 790 default:
791 return true; 791 return true;
792 } 792 }
793 } 793 }
794 794
795 DEFINE_TRACE(CSSAnimations) 795 DEFINE_TRACE(CSSAnimations)
796 { 796 {
797 #if ENABLE(OILPAN)
798 visitor->trace(m_transitions); 797 visitor->trace(m_transitions);
799 visitor->trace(m_pendingUpdate); 798 visitor->trace(m_pendingUpdate);
800 visitor->trace(m_animations); 799 visitor->trace(m_animations);
800 #if ENABLE(OILPAN)
801 visitor->trace(m_previousActiveInterpolationsForAnimations); 801 visitor->trace(m_previousActiveInterpolationsForAnimations);
802 #endif 802 #endif
803 } 803 }
804 804
805 } // namespace blink 805 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/css/CSSAnimations.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698