Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7bb7290560c847fcc4f3a24eb8c3762c41c467b7
https://github.com/WebKit/WebKit/commit/7bb7290560c847fcc4f3a24eb8c3762c41c467b7
Author: Antoine Quint <[email protected]>
Date: 2025-11-30 (Sun, 30 Nov 2025)
Changed paths:
M Source/WebCore/animation/KeyframeEffect.cpp
M Source/WebCore/animation/KeyframeEffect.h
M Source/WebCore/platform/animation/AcceleratedEffect.cpp
M Source/WebCore/rendering/RenderLayerBacking.cpp
Log Message:
-----------
[threaded-animations] WPT test
`scroll-animations/view-timelines/timeline-offset-in-keyframe.html` crashes
with "Threaded Scroll-driven Animations" enabled
https://bugs.webkit.org/show_bug.cgi?id=303220
rdar://165549480
Reviewed by Anne van Kesteren.
We would crash this test with "Threaded Scroll-driven Animations" enabled
because the test would
set the effect of a previously-accelerated animation to a new effect with
keyframe offsets using
view timeline ranges [0]. Such keyframe offsets need to be resolved to a
computed offset, which
typically occurs under `KeyframeEffect::apply()`, called during style
resolution. In this case,
style resolution does not occur prior to the updated effect being uploaded to
the remote layer
tree, resulting in an NaN computed offset value which led to
`AcceleratedEffect::apply()` not
finding a keyframe interval to apply the effect in the remote layer tree.
To address this, in
`RenderLayerBacking::updateAcceleratedEffectsAndBaseValues()`, we move the
accelerated effect creation and link to its source keyframe effect to a new
method
`KeyframeEffect::updatedAcceleratedRepresentation()` which will ensure any
pending keyframe
offset resolution occurs.
We also add a new assertion in the `AcceleratedEffect` constructor that checks
that no NaN
value for keyframe offsets show up, which would have caught this issue in a
more explicit manner.
Note that this not an ideal fix, I think our accelerated effect creation code
is not very well
structured and could do with a cleaner approach where the creation occurs
entirely within `KeyframeEffect`,
similar to how accelerated timelines are created, and ideally also with the
creation of an associated
accelerated animation to retain the animation / timeline / effect object
relationship that exists
both for non-accelerated animation resolution in Web process and for decoded
animations in the remote
layer tree. But this is a larger refactor that will have to wait a bit longer
to address an issue
that will otherwise block making "Threaded Scroll-driven Animations" a preview
flag.
Note that there is no test change in this patch since the flag is not yet
enabled on bots. This
was caught in preparation of that running animation tests locally using
`--experimental-feature ThreadedScrollDrivenAnimationsEnabled=true`.
[0] https://drafts.csswg.org/scroll-animations-1/#view-timelines-ranges
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::updatedAcceleratedRepresentation):
* Source/WebCore/animation/KeyframeEffect.h:
* Source/WebCore/platform/animation/AcceleratedEffect.cpp:
(WebCore::AcceleratedEffect::AcceleratedEffect):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAcceleratedEffectsAndBaseValues):
Canonical link: https://commits.webkit.org/303651@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications