Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 854c97d6b33914417293825dc316257e3937cad5
https://github.com/WebKit/WebKit/commit/854c97d6b33914417293825dc316257e3937cad5
Author: Ryan Reno <[email protected]>
Date: 2026-09-26 (Sat, 26 Sep 2026)
Changed paths:
A
LayoutTests/compositing/backing/backing-store-attachment-animating-pseudo-element-outside-viewport-expected.txt
A
LayoutTests/compositing/backing/backing-store-attachment-animating-pseudo-element-outside-viewport.html
M LayoutTests/platform/glib/TestExpectations
A
LayoutTests/platform/ios/compositing/backing/backing-store-attachment-animating-pseudo-element-outside-viewport-expected.txt
M Source/WebCore/animation/KeyframeEffect.cpp
M Source/WebCore/animation/KeyframeEffect.h
M Source/WebCore/platform/graphics/GraphicsLayer.h
M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
M Source/WebCore/rendering/RenderLayerBacking.cpp
M Source/WebCore/rendering/RenderLayerBacking.h
M Source/WebCore/style/Styleable.cpp
M Source/WebCore/style/Styleable.h
Log Message:
-----------
Compute the animation extent while acceleration is still pending
https://bugs.webkit.org/show_bug.cgi?id=325246
rdar://187828882
Reviewed by Antoine Quint.
RenderLayerBacking::updateGeometry() only computes a layer's animation extent
when
Styleable::isRunningAcceleratedTransformRelatedAnimation() is true, which
requires the
effect to be running accelerated: KeyframeEffect::isRunningAccelerated() wants
an
accelerated representation to exist, to have animated properties, and the
animation to be
unsuspended. GraphicsLayerCA::updateCoverage() meanwhile treats the layer as
animating as
soon as an effect animating a transform-related property is in its accelerated
effect
stack, and when it sees a running transform animation with no extent it attaches
a backing store unconditionally, wherever that layer is.
So for the whole window between an effect entering the layer's stack and its
acceleration
being established, every transform-animated layer holds full backing store no
matter where
it sits. Measured on the tiffany.com site on iOS when opening the hamburger
menu, we allocate
about 1GB of backing stores for animated layers which never become visible.
The gate is stricter than the computation it guards.
Styleable::computeAnimationExtent()
needs only the effect's blending keyframes, which are already resolved in that
window, so
ask instead whether an effect is running or about to run accelerated. The layer
then has
an extent and offscreen animated layers are detached. With the change the same
interaction
with the menu holds 23 backing stores instead of 70, saving about 800MB.
However, that only helps when a geometry update happens to run inside the
window. The accelerated
effect stack is installed by
RenderLayerBacking::updateAcceleratedEffectsAndBaseValues() and the
geometry update it requests does not happen before that frame's layer flush. If
the layer was not
otherwise dirty in that frame, the flush still sees a transform animation with
no extent so it will
also attach a backing store. So we compute the extent right where the stack is
installed. If layout
or z-order lists are dirty we'll attach a backing store as before since the
extent computation could
be wrong and we'd get pop-in.
Deliberately not narrowing GraphicsLayerCA::isRunningTransformAnimation() to
match, and
deliberately not making the unknown-extent clause fail closed: both would
reintroduce
webkit.org/b/173732, where an animation starting outside the viewport had no
backing when it moved into
view. This change only makes the extent available earlier, and if it cannot be
computed the
old conservative behavior still applies.
Test:
LayoutTests/compositing/backing/backing-store-attachment-animating-pseudo-element-outside-viewport.html
*
LayoutTests/compositing/backing/backing-store-attachment-animating-pseudo-element-outside-viewport-expected.txt:
Added.
*
LayoutTests/compositing/backing/backing-store-attachment-animating-pseudo-element-outside-viewport.html:
Added.
* LayoutTests/platform/glib/TestExpectations:
*
LayoutTests/platform/ios/compositing/backing/backing-store-attachment-animating-pseudo-element-outside-viewport-expected.txt:
Added.
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::isRunningOrAboutToRunAcceleratedTransformRelatedAnimation
const):
* Source/WebCore/animation/KeyframeEffect.h:
* Source/WebCore/platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setAnimationExtent):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::ensureStructuralLayer):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAnimationExtent):
(WebCore::RenderLayerBacking::updateGeometry):
(WebCore::RenderLayerBacking::updateAcceleratedEffectsAndBaseValues):
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/style/Styleable.cpp:
(WebCore::Styleable::isRunningOrAboutToRunAcceleratedTransformRelatedAnimation
const):
* Source/WebCore/style/Styleable.h:
Canonical link: https://commits.webkit.org/321981@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications