| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 for (CSSPropertyID property : allProperties) { | 164 for (CSSPropertyID property : allProperties) { |
| 165 bool startNeedsValue = missingStartValues && !startKeyframePropertie
s.contains(PropertyHandle(property)); | 165 bool startNeedsValue = missingStartValues && !startKeyframePropertie
s.contains(PropertyHandle(property)); |
| 166 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont
ains(PropertyHandle(property)); | 166 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont
ains(PropertyHandle(property)); |
| 167 if (!startNeedsValue && !endNeedsValue) | 167 if (!startNeedsValue && !endNeedsValue) |
| 168 continue; | 168 continue; |
| 169 if (CompositorAnimations::isCompositableProperty(property)) | 169 if (CompositorAnimations::isCompositableProperty(property)) |
| 170 UseCounter::count(elementForScoping->document(), UseCounter::Syn
theticKeyframesInCompositedCSSAnimation); | 170 UseCounter::count(elementForScoping->document(), UseCounter::Syn
theticKeyframesInCompositedCSSAnimation); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 RefPtrWillBeRawPtr<StringKeyframeEffectModel> model = StringKeyframeEffectMo
del::create(keyframes, &keyframes[0]->easing()); | 174 StringKeyframeEffectModel* model = StringKeyframeEffectModel::create(keyfram
es, &keyframes[0]->easing()); |
| 175 model->forceConversionsToAnimatableValues(element, style); | 175 model->forceConversionsToAnimatableValues(element, style); |
| 176 if (animationIndex > 0 && model->hasSyntheticKeyframes()) | 176 if (animationIndex > 0 && model->hasSyntheticKeyframes()) |
| 177 UseCounter::count(elementForScoping->document(), UseCounter::CSSAnimatio
nsStackedNeutralKeyframe); | 177 UseCounter::count(elementForScoping->document(), UseCounter::CSSAnimatio
nsStackedNeutralKeyframe); |
| 178 return model; | 178 return model; |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace | 181 } // namespace |
| 182 | 182 |
| 183 CSSAnimations::CSSAnimations() | 183 CSSAnimations::CSSAnimations() |
| 184 { | 184 { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 return; | 302 return; |
| 303 | 303 |
| 304 m_previousActiveInterpolationsForAnimations.swap(m_pendingUpdate.activeInter
polationsForAnimations()); | 304 m_previousActiveInterpolationsForAnimations.swap(m_pendingUpdate.activeInter
polationsForAnimations()); |
| 305 | 305 |
| 306 // FIXME: cancelling, pausing, unpausing animations all query compositingSta
te, which is not necessarily up to date here | 306 // FIXME: cancelling, pausing, unpausing animations all query compositingSta
te, which is not necessarily up to date here |
| 307 // since we call this from recalc style. | 307 // since we call this from recalc style. |
| 308 // https://code.google.com/p/chromium/issues/detail?id=339847 | 308 // https://code.google.com/p/chromium/issues/detail?id=339847 |
| 309 DisableCompositingQueryAsserts disabler; | 309 DisableCompositingQueryAsserts disabler; |
| 310 | 310 |
| 311 for (const AtomicString& animationName : m_pendingUpdate.cancelledAnimationN
ames()) { | 311 for (const AtomicString& animationName : m_pendingUpdate.cancelledAnimationN
ames()) { |
| 312 RefPtrWillBeRawPtr<Animation> animation = m_animations.take(animationNam
e)->animation; | 312 Animation* animation = m_animations.take(animationName)->animation; |
| 313 animation->cancel(); | 313 animation->cancel(); |
| 314 animation->update(TimingUpdateOnDemand); | 314 animation->update(TimingUpdateOnDemand); |
| 315 } | 315 } |
| 316 | 316 |
| 317 for (const AtomicString& animationName : m_pendingUpdate.animationsWithPause
Toggled()) { | 317 for (const AtomicString& animationName : m_pendingUpdate.animationsWithPause
Toggled()) { |
| 318 Animation* animation = m_animations.get(animationName)->animation.get(); | 318 Animation* animation = m_animations.get(animationName)->animation.get(); |
| 319 if (animation->paused()) | 319 if (animation->paused()) |
| 320 animation->unpause(); | 320 animation->unpause(); |
| 321 else | 321 else |
| 322 animation->pause(); | 322 animation->pause(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 347 KeyframeEffect* effect = toKeyframeEffect(entry.animation->effect()); | 347 KeyframeEffect* effect = toKeyframeEffect(entry.animation->effect()); |
| 348 | 348 |
| 349 effect->setModel(entry.effect->model()); | 349 effect->setModel(entry.effect->model()); |
| 350 effect->updateSpecifiedTiming(entry.effect->specifiedTiming()); | 350 effect->updateSpecifiedTiming(entry.effect->specifiedTiming()); |
| 351 | 351 |
| 352 m_animations.find(entry.name)->value->update(entry); | 352 m_animations.find(entry.name)->value->update(entry); |
| 353 } | 353 } |
| 354 | 354 |
| 355 for (const auto& entry : m_pendingUpdate.newAnimations()) { | 355 for (const auto& entry : m_pendingUpdate.newAnimations()) { |
| 356 const InertEffect* inertAnimation = entry.effect.get(); | 356 const InertEffect* inertAnimation = entry.effect.get(); |
| 357 OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillB
eNoop(new AnimationEventDelegate(element, entry.name)); | 357 AnimationEventDelegate* eventDelegate = new AnimationEventDelegate(eleme
nt, entry.name); |
| 358 RefPtrWillBeRawPtr<KeyframeEffect> effect = KeyframeEffect::create(eleme
nt, inertAnimation->model(), inertAnimation->specifiedTiming(), KeyframeEffect::
DefaultPriority, eventDelegate.release()); | 358 KeyframeEffect* effect = KeyframeEffect::create(element, inertAnimation-
>model(), inertAnimation->specifiedTiming(), KeyframeEffect::DefaultPriority, ev
entDelegate); |
| 359 effect->setName(inertAnimation->name()); | 359 effect->setName(inertAnimation->name()); |
| 360 RefPtrWillBeRawPtr<Animation> animation = element->document().timeline()
.play(effect.get()); | 360 Animation* animation = element->document().timeline().play(effect); |
| 361 if (inertAnimation->paused()) | 361 if (inertAnimation->paused()) |
| 362 animation->pause(); | 362 animation->pause(); |
| 363 animation->update(TimingUpdateOnDemand); | 363 animation->update(TimingUpdateOnDemand); |
| 364 | 364 |
| 365 m_animations.set(entry.name, adoptRefWillBeNoop(new RunningAnimation(ani
mation, entry))); | 365 m_animations.set(entry.name, new RunningAnimation(animation, entry)); |
| 366 } | 366 } |
| 367 | 367 |
| 368 // Transitions that are run on the compositor only update main-thread state | 368 // Transitions that are run on the compositor only update main-thread state |
| 369 // lazily. However, we need the new state to know what the from state shoud | 369 // lazily. However, we need the new state to know what the from state shoud |
| 370 // be when transitions are retargeted. Instead of triggering complete style | 370 // be when transitions are retargeted. Instead of triggering complete style |
| 371 // recalculation, we find these cases by searching for new transitions that | 371 // recalculation, we find these cases by searching for new transitions that |
| 372 // have matching cancelled animation property IDs on the compositor. | 372 // have matching cancelled animation property IDs on the compositor. |
| 373 WillBeHeapHashMap<CSSPropertyID, std::pair<RefPtrWillBeMember<KeyframeEffect
>, double>> retargetedCompositorTransitions; | 373 HeapHashMap<CSSPropertyID, std::pair<Member<KeyframeEffect>, double>> retarg
etedCompositorTransitions; |
| 374 for (CSSPropertyID id : m_pendingUpdate.cancelledTransitions()) { | 374 for (CSSPropertyID id : m_pendingUpdate.cancelledTransitions()) { |
| 375 ASSERT(m_transitions.contains(id)); | 375 ASSERT(m_transitions.contains(id)); |
| 376 | 376 |
| 377 RefPtrWillBeRawPtr<Animation> animation = m_transitions.take(id).animati
on; | 377 Animation* animation = m_transitions.take(id).animation; |
| 378 KeyframeEffect* effect = toKeyframeEffect(animation->effect()); | 378 KeyframeEffect* effect = toKeyframeEffect(animation->effect()); |
| 379 if (effect->hasActiveAnimationsOnCompositor(id) && m_pendingUpdate.newTr
ansitions().find(id) != m_pendingUpdate.newTransitions().end() && !animation->li
mited()) | 379 if (effect->hasActiveAnimationsOnCompositor(id) && m_pendingUpdate.newTr
ansitions().find(id) != m_pendingUpdate.newTransitions().end() && !animation->li
mited()) |
| 380 retargetedCompositorTransitions.add(id, std::pair<RefPtrWillBeMember
<KeyframeEffect>, double>(effect, animation->startTimeInternal())); | 380 retargetedCompositorTransitions.add(id, std::pair<KeyframeEffect*, d
ouble>(effect, animation->startTimeInternal())); |
| 381 animation->cancel(); | 381 animation->cancel(); |
| 382 // after cancelation, transitions must be downgraded or they'll fail | 382 // after cancelation, transitions must be downgraded or they'll fail |
| 383 // to be considered when retriggering themselves. This can happen if | 383 // to be considered when retriggering themselves. This can happen if |
| 384 // the transition is captured through getAnimations then played. | 384 // the transition is captured through getAnimations then played. |
| 385 if (animation->effect() && animation->effect()->isAnimation()) | 385 if (animation->effect() && animation->effect()->isAnimation()) |
| 386 toKeyframeEffect(animation->effect())->downgradeToNormal(); | 386 toKeyframeEffect(animation->effect())->downgradeToNormal(); |
| 387 animation->update(TimingUpdateOnDemand); | 387 animation->update(TimingUpdateOnDemand); |
| 388 } | 388 } |
| 389 | 389 |
| 390 for (CSSPropertyID id : m_pendingUpdate.finishedTransitions()) { | 390 for (CSSPropertyID id : m_pendingUpdate.finishedTransitions()) { |
| 391 // This transition can also be cancelled and finished at the same time | 391 // This transition can also be cancelled and finished at the same time |
| 392 if (m_transitions.contains(id)) { | 392 if (m_transitions.contains(id)) { |
| 393 RefPtrWillBeRawPtr<Animation> animation = m_transitions.take(id).ani
mation; | 393 Animation* animation = m_transitions.take(id).animation; |
| 394 // Transition must be downgraded | 394 // Transition must be downgraded |
| 395 if (animation->effect() && animation->effect()->isAnimation()) | 395 if (animation->effect() && animation->effect()->isAnimation()) |
| 396 toKeyframeEffect(animation->effect())->downgradeToNormal(); | 396 toKeyframeEffect(animation->effect())->downgradeToNormal(); |
| 397 } | 397 } |
| 398 } | 398 } |
| 399 | 399 |
| 400 for (const auto& entry : m_pendingUpdate.newTransitions()) { | 400 for (const auto& entry : m_pendingUpdate.newTransitions()) { |
| 401 const CSSAnimationUpdate::NewTransition& newTransition = entry.value; | 401 const CSSAnimationUpdate::NewTransition& newTransition = entry.value; |
| 402 | 402 |
| 403 RunningTransition runningTransition; | 403 RunningTransition runningTransition; |
| 404 runningTransition.from = newTransition.from; | 404 runningTransition.from = newTransition.from; |
| 405 runningTransition.to = newTransition.to; | 405 runningTransition.to = newTransition.to; |
| 406 | 406 |
| 407 CSSPropertyID id = newTransition.id; | 407 CSSPropertyID id = newTransition.id; |
| 408 InertEffect* inertAnimation = newTransition.effect.get(); | 408 InertEffect* inertAnimation = newTransition.effect.get(); |
| 409 OwnPtrWillBeRawPtr<TransitionEventDelegate> eventDelegate = adoptPtrWill
BeNoop(new TransitionEventDelegate(element, id)); | 409 TransitionEventDelegate* eventDelegate = new TransitionEventDelegate(ele
ment, id); |
| 410 | 410 |
| 411 RefPtrWillBeRawPtr<EffectModel> model = inertAnimation->model(); | 411 EffectModel* model = inertAnimation->model(); |
| 412 | 412 |
| 413 if (retargetedCompositorTransitions.contains(id)) { | 413 if (retargetedCompositorTransitions.contains(id)) { |
| 414 const std::pair<RefPtrWillBeMember<KeyframeEffect>, double>& oldTran
sition = retargetedCompositorTransitions.get(id); | 414 const std::pair<Member<KeyframeEffect>, double>& oldTransition = ret
argetedCompositorTransitions.get(id); |
| 415 RefPtrWillBeRawPtr<KeyframeEffect> oldAnimation = oldTransition.firs
t; | 415 KeyframeEffect* oldAnimation = oldTransition.first; |
| 416 double oldStartTime = oldTransition.second; | 416 double oldStartTime = oldTransition.second; |
| 417 double inheritedTime = isNull(oldStartTime) ? 0 : element->document(
).timeline().currentTimeInternal() - oldStartTime; | 417 double inheritedTime = isNull(oldStartTime) ? 0 : element->document(
).timeline().currentTimeInternal() - oldStartTime; |
| 418 | 418 |
| 419 AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKey
frameEffectModel(inertAnimation->model()); | 419 AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKey
frameEffectModel(inertAnimation->model()); |
| 420 const KeyframeVector& frames = oldEffect->getFrames(); | 420 const KeyframeVector& frames = oldEffect->getFrames(); |
| 421 | 421 |
| 422 AnimatableValueKeyframeVector newFrames; | 422 AnimatableValueKeyframeVector newFrames; |
| 423 newFrames.append(toAnimatableValueKeyframe(frames[0]->clone().get())
); | 423 newFrames.append(toAnimatableValueKeyframe(frames[0]->clone().get())
); |
| 424 newFrames.append(toAnimatableValueKeyframe(frames[1]->clone().get())
); | 424 newFrames.append(toAnimatableValueKeyframe(frames[1]->clone().get())
); |
| 425 newFrames.append(toAnimatableValueKeyframe(frames[2]->clone().get())
); | 425 newFrames.append(toAnimatableValueKeyframe(frames[2]->clone().get())
); |
| 426 newFrames[0]->clearPropertyValue(id); | 426 newFrames[0]->clearPropertyValue(id); |
| 427 newFrames[1]->clearPropertyValue(id); | 427 newFrames[1]->clearPropertyValue(id); |
| 428 | 428 |
| 429 RefPtrWillBeRawPtr<InertEffect> inertAnimationForSampling = InertEff
ect::create(oldAnimation->model(), oldAnimation->specifiedTiming(), false, inher
itedTime); | 429 InertEffect* inertAnimationForSampling = InertEffect::create(oldAnim
ation->model(), oldAnimation->specifiedTiming(), false, inheritedTime); |
| 430 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation
>>> sample = nullptr; | 430 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation
>>> sample = nullptr; |
| 431 inertAnimationForSampling->sample(sample); | 431 inertAnimationForSampling->sample(sample); |
| 432 if (sample && sample->size() == 1) { | 432 if (sample && sample->size() == 1) { |
| 433 newFrames[0]->setPropertyValue(id, toLegacyStyleInterpolation(sa
mple->at(0).get())->currentValue()); | 433 newFrames[0]->setPropertyValue(id, toLegacyStyleInterpolation(sa
mple->at(0).get())->currentValue()); |
| 434 newFrames[1]->setPropertyValue(id, toLegacyStyleInterpolation(sa
mple->at(0).get())->currentValue()); | 434 newFrames[1]->setPropertyValue(id, toLegacyStyleInterpolation(sa
mple->at(0).get())->currentValue()); |
| 435 model = AnimatableValueKeyframeEffectModel::create(newFrames); | 435 model = AnimatableValueKeyframeEffectModel::create(newFrames); |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 | 438 |
| 439 RefPtrWillBeRawPtr<KeyframeEffect> transition = KeyframeEffect::create(e
lement, model, inertAnimation->specifiedTiming(), KeyframeEffect::TransitionPrio
rity, eventDelegate.release()); | 439 KeyframeEffect* transition = KeyframeEffect::create(element, model, iner
tAnimation->specifiedTiming(), KeyframeEffect::TransitionPriority, eventDelegate
); |
| 440 transition->setName(inertAnimation->name()); | 440 transition->setName(inertAnimation->name()); |
| 441 RefPtrWillBeRawPtr<Animation> animation = element->document().timeline()
.play(transition.get()); | 441 Animation* animation = element->document().timeline().play(transition); |
| 442 // Set the current time as the start time for retargeted transitions | 442 // Set the current time as the start time for retargeted transitions |
| 443 if (retargetedCompositorTransitions.contains(id)) | 443 if (retargetedCompositorTransitions.contains(id)) |
| 444 animation->setStartTime(element->document().timeline().currentTime()
); | 444 animation->setStartTime(element->document().timeline().currentTime()
); |
| 445 animation->update(TimingUpdateOnDemand); | 445 animation->update(TimingUpdateOnDemand); |
| 446 runningTransition.animation = animation; | 446 runningTransition.animation = animation; |
| 447 m_transitions.set(id, runningTransition); | 447 m_transitions.set(id, runningTransition); |
| 448 ASSERT(id != CSSPropertyInvalid); | 448 ASSERT(id != CSSPropertyInvalid); |
| 449 Platform::current()->histogramSparse("WebCore.Animation.CSSProperties",
UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); | 449 Platform::current()->histogramSparse("WebCore.Animation.CSSProperties",
UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); |
| 450 } | 450 } |
| 451 | 451 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 startKeyframe->setOffset(startKeyframeOffset); | 501 startKeyframe->setOffset(startKeyframeOffset); |
| 502 startKeyframe->setEasing(timing.timingFunction.release()); | 502 startKeyframe->setEasing(timing.timingFunction.release()); |
| 503 timing.timingFunction = LinearTimingFunction::shared(); | 503 timing.timingFunction = LinearTimingFunction::shared(); |
| 504 keyframes.append(startKeyframe); | 504 keyframes.append(startKeyframe); |
| 505 | 505 |
| 506 RefPtrWillBeRawPtr<AnimatableValueKeyframe> endKeyframe = AnimatableValueKey
frame::create(); | 506 RefPtrWillBeRawPtr<AnimatableValueKeyframe> endKeyframe = AnimatableValueKey
frame::create(); |
| 507 endKeyframe->setPropertyValue(id, to.get()); | 507 endKeyframe->setPropertyValue(id, to.get()); |
| 508 endKeyframe->setOffset(1); | 508 endKeyframe->setOffset(1); |
| 509 keyframes.append(endKeyframe); | 509 keyframes.append(endKeyframe); |
| 510 | 510 |
| 511 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> model = AnimatableVal
ueKeyframeEffectModel::create(keyframes); | 511 AnimatableValueKeyframeEffectModel* model = AnimatableValueKeyframeEffectMod
el::create(keyframes); |
| 512 update.startTransition(id, from.get(), to.get(), InertEffect::create(model,
timing, false, 0)); | 512 update.startTransition(id, from.get(), to.get(), InertEffect::create(model,
timing, false, 0)); |
| 513 ASSERT(!element->elementAnimations() || !element->elementAnimations()->isAni
mationStyleChange()); | 513 ASSERT(!element->elementAnimations() || !element->elementAnimations()->isAni
mationStyleChange()); |
| 514 } | 514 } |
| 515 | 515 |
| 516 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate& update, const
Element* animatingElement, const ComputedStyle& style) | 516 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate& update, const
Element* animatingElement, const ComputedStyle& style) |
| 517 { | 517 { |
| 518 if (!animatingElement) | 518 if (!animatingElement) |
| 519 return; | 519 return; |
| 520 | 520 |
| 521 ElementAnimations* elementAnimations = animatingElement->elementAnimations()
; | 521 ElementAnimations* elementAnimations = animatingElement->elementAnimations()
; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 { | 603 { |
| 604 ElementAnimations* elementAnimations = animatingElement ? animatingElement->
elementAnimations() : nullptr; | 604 ElementAnimations* elementAnimations = animatingElement ? animatingElement->
elementAnimations() : nullptr; |
| 605 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def
aultStack() : nullptr; | 605 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def
aultStack() : nullptr; |
| 606 | 606 |
| 607 if (update.newAnimations().isEmpty() && update.suppressedAnimations().isEmpt
y()) { | 607 if (update.newAnimations().isEmpty() && update.suppressedAnimations().isEmpt
y()) { |
| 608 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack:
:activeInterpolations(animationStack, 0, 0, KeyframeEffect::DefaultPriority, tim
elineCurrentTime)); | 608 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack:
:activeInterpolations(animationStack, 0, 0, KeyframeEffect::DefaultPriority, tim
elineCurrentTime)); |
| 609 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAni
mations); | 609 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAni
mations); |
| 610 return; | 610 return; |
| 611 } | 611 } |
| 612 | 612 |
| 613 WillBeHeapVector<RawPtrWillBeMember<InertEffect>> newEffects; | 613 HeapVector<Member<InertEffect>> newEffects; |
| 614 for (const auto& newAnimation : update.newAnimations()) | 614 for (const auto& newAnimation : update.newAnimations()) |
| 615 newEffects.append(newAnimation.effect.get()); | 615 newEffects.append(newAnimation.effect.get()); |
| 616 for (const auto& updatedAnimation : update.animationsWithUpdates()) | 616 for (const auto& updatedAnimation : update.animationsWithUpdates()) |
| 617 newEffects.append(updatedAnimation.effect.get()); // Animations with upd
ates use a temporary InertEffect for the current frame. | 617 newEffects.append(updatedAnimation.effect.get()); // Animations with upd
ates use a temporary InertEffect for the current frame. |
| 618 | 618 |
| 619 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack::act
iveInterpolations(animationStack, &newEffects, &update.suppressedAnimations(), K
eyframeEffect::DefaultPriority, timelineCurrentTime)); | 619 ActiveInterpolationMap activeInterpolationsForAnimations(AnimationStack::act
iveInterpolations(animationStack, &newEffects, &update.suppressedAnimations(), K
eyframeEffect::DefaultPriority, timelineCurrentTime)); |
| 620 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimati
ons); | 620 update.adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimati
ons); |
| 621 } | 621 } |
| 622 | 622 |
| 623 void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate&
update, const Element* animatingElement, double timelineCurrentTime) | 623 void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate&
update, const Element* animatingElement, double timelineCurrentTime) |
| 624 { | 624 { |
| 625 ElementAnimations* elementAnimations = animatingElement ? animatingElement->
elementAnimations() : nullptr; | 625 ElementAnimations* elementAnimations = animatingElement ? animatingElement->
elementAnimations() : nullptr; |
| 626 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def
aultStack() : nullptr; | 626 AnimationStack* animationStack = elementAnimations ? &elementAnimations->def
aultStack() : nullptr; |
| 627 | 627 |
| 628 ActiveInterpolationMap activeInterpolationsForTransitions; | 628 ActiveInterpolationMap activeInterpolationsForTransitions; |
| 629 if (update.newTransitions().isEmpty() && update.cancelledTransitions().isEmp
ty()) { | 629 if (update.newTransitions().isEmpty() && update.cancelledTransitions().isEmp
ty()) { |
| 630 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, 0, 0, KeyframeEffect::TransitionPriority, timelineCurrentTime)
; | 630 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, 0, 0, KeyframeEffect::TransitionPriority, timelineCurrentTime)
; |
| 631 } else { | 631 } else { |
| 632 WillBeHeapVector<RawPtrWillBeMember<InertEffect>> newTransitions; | 632 HeapVector<Member<InertEffect>> newTransitions; |
| 633 for (const auto& entry : update.newTransitions()) | 633 for (const auto& entry : update.newTransitions()) |
| 634 newTransitions.append(entry.value.effect.get()); | 634 newTransitions.append(entry.value.effect.get()); |
| 635 | 635 |
| 636 WillBeHeapHashSet<RawPtrWillBeMember<const Animation>> cancelledAnimatio
ns; | 636 HeapHashSet<Member<const Animation>> cancelledAnimations; |
| 637 if (!update.cancelledTransitions().isEmpty()) { | 637 if (!update.cancelledTransitions().isEmpty()) { |
| 638 ASSERT(elementAnimations); | 638 ASSERT(elementAnimations); |
| 639 const TransitionMap& transitionMap = elementAnimations->cssAnimation
s().m_transitions; | 639 const TransitionMap& transitionMap = elementAnimations->cssAnimation
s().m_transitions; |
| 640 for (CSSPropertyID id : update.cancelledTransitions()) { | 640 for (CSSPropertyID id : update.cancelledTransitions()) { |
| 641 ASSERT(transitionMap.contains(id)); | 641 ASSERT(transitionMap.contains(id)); |
| 642 cancelledAnimations.add(transitionMap.get(id).animation.get()); | 642 cancelledAnimations.add(transitionMap.get(id).animation.get()); |
| 643 } | 643 } |
| 644 } | 644 } |
| 645 | 645 |
| 646 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, &newTransitions, &cancelledAnimations, KeyframeEffect::Transit
ionPriority, timelineCurrentTime); | 646 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, &newTransitions, &cancelledAnimations, KeyframeEffect::Transit
ionPriority, timelineCurrentTime); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 case CSSPropertyTransitionProperty: | 780 case CSSPropertyTransitionProperty: |
| 781 case CSSPropertyTransitionTimingFunction: | 781 case CSSPropertyTransitionTimingFunction: |
| 782 return false; | 782 return false; |
| 783 default: | 783 default: |
| 784 return true; | 784 return true; |
| 785 } | 785 } |
| 786 } | 786 } |
| 787 | 787 |
| 788 DEFINE_TRACE(CSSAnimations) | 788 DEFINE_TRACE(CSSAnimations) |
| 789 { | 789 { |
| 790 #if ENABLE(OILPAN) | |
| 791 visitor->trace(m_transitions); | 790 visitor->trace(m_transitions); |
| 792 visitor->trace(m_pendingUpdate); | 791 visitor->trace(m_pendingUpdate); |
| 793 visitor->trace(m_animations); | 792 visitor->trace(m_animations); |
| 793 #if ENABLE(OILPAN) |
| 794 visitor->trace(m_previousActiveInterpolationsForAnimations); | 794 visitor->trace(m_previousActiveInterpolationsForAnimations); |
| 795 #endif | 795 #endif |
| 796 } | 796 } |
| 797 | 797 |
| 798 } // namespace blink | 798 } // namespace blink |
| OLD | NEW |