Skip to content

Commit

Permalink
KeyframeEffect::setAnimation should clear blending key frames for an …
Browse files Browse the repository at this point in the history
…old CSSAnimation

https://bugs.webkit.org/show_bug.cgi?id=246244

Reviewed by Antoine Quint.

KeyframeEffect::propertyAffectingKeyframeResolutionDidChange performs a switch on m_blendingKeyframesSource but this one is no longer valid if the animation has changed.
For CSSTransition this is a no-op and for WebAnimation this is just a call to clearBlendingKeyframes(), so wrong behavior can only happen with CSSAnimation.

* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::setAnimation): Clear blending key frames if the old animation was a CSSAnimation to prevent any misbehavior in later calls to propertyAffectingKeyframeResolutionDidChange.

Canonical link: https://commits.webkit.org/255308@main
  • Loading branch information
fred-wang committed Oct 8, 2022
1 parent f2b771d commit fa25b13
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/WebCore/animation/KeyframeEffect.cpp
Expand Up @@ -1195,8 +1195,11 @@ void KeyframeEffect::setAnimation(WebAnimation* animation)
{
bool animationChanged = animation != this->animation();
AnimationEffect::setAnimation(animation);
if (animationChanged)
if (animationChanged) {
if (m_blendingKeyframesSource == BlendingKeyframesSource::CSSAnimation)
clearBlendingKeyframes();
updateEffectStackMembership();
}
}

const std::optional<const Styleable> KeyframeEffect::targetStyleable() const
Expand Down

0 comments on commit fa25b13

Please sign in to comment.