Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 48e68eb17fb7ecf1b9d25c4101f06a200a185e08
      
https://github.com/WebKit/WebKit/commit/48e68eb17fb7ecf1b9d25c4101f06a200a185e08
  Author: Antoine Quint <[email protected]>
  Date:   2025-11-18 (Tue, 18 Nov 2025)

  Changed paths:
    M Source/WebCore/animation/CSSTransition.cpp
    M Source/WebCore/animation/CSSTransition.h
    M Source/WebCore/animation/WebAnimation.h
    M Source/WebCore/style/Styleable.cpp

  Log Message:
  -----------
  REGRESSION(303073@main): Twitch pages crash after exiting fullscreen on iPad
https://bugs.webkit.org/show_bug.cgi?id=302713
rdar://164913157

Reviewed by Antti Koivisto.

We made `KeyframeEffectStack::sortedEffects()` return a const reference in 
303073@main whereas previously it would return a copy of
the list of sorted effects.

In the `updateCSSTransitionsForStyleableAndProperty()` function, called under 
`Style::TreeResolver::createAnimatedElementUpdate()`,
where we update transitions as part of an animation update, in order to 
determine the before-change style [0], we manually update
the underlying, non-animated style to the current state for animations that 
target the property in question. We use
`KeyframeEffectStack::sortedEffects()` to get the list of effects applied to 
the element we're processing, but we use a method,
`WebAnimation::resolve()`, to compute the animated styles that does more than 
just that, updating the finished state of the animation [1]
which may change whether the animation in question is considered relevant [2] 
and thus affect its membership in the effect list
we're iterating upon.

One way to address this would be to make a copy of the effect list, but we 
should be able to iterate through the effect list here
without it changing from under us. To that end, we now use 
`KeyframeEffect::apply()` instead of `WebAnimation::resolve()`. This change
alone addresses the reported issue.

However, this change yielded some test regressions in the WPT test 
`css/css-transitions/KeyframeEffect-setKeyframes.tentative.html`.
As it turns out, the current style of a transition was cached under an 
overridden implementation of `WebAnimation::resolve()` in the
`CSSTransition` class, and changing from calling `WebAnimation::resolve()` to 
`KeyframeEffect::apply()` meant that this style was no
longer current. It appears now that this approach was fragile, and also 
overkill since this transition current style is only ever used
in one of the branches of the CSS Transition update process and should be 
computed as requested. So on top of the change described above,
we now remove the CSS Transition current style caching, removing the 
`CSSTransition::m_currentStyle` member, in favor of computing it
directly as needed.

[0] https://drafts.csswg.org/css-transitions-1/#before-change-style
[1] https://drafts.csswg.org/web-animations-1/#updating-the-finished-state
[2] https://drafts.csswg.org/web-animations-1/#relevant-animations-section

* Source/WebCore/animation/CSSTransition.cpp:
(WebCore::CSSTransition::create):
(WebCore::CSSTransition::CSSTransition):
(WebCore::CSSTransition::resolve): Deleted.
* Source/WebCore/animation/CSSTransition.h:
* Source/WebCore/animation/WebAnimation.h:
* Source/WebCore/style/Styleable.cpp:
(WebCore::updateCSSTransitionsForStyleableAndProperty):

Canonical link: https://commits.webkit.org/303234@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to