[webkit-changes] [WebKit/WebKit] 6778ef: [web-animations] account for `display` animations ...
Antoine Quint
noreply at github.com
Thu Mar 21 23:09:17 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6778ef1c00cecfa2d9a145d371db33d01fd3a388
https://github.com/WebKit/WebKit/commit/6778ef1c00cecfa2d9a145d371db33d01fd3a388
Author: Antoine Quint <graouts at webkit.org>
Date: 2024-03-21 (Thu, 21 Mar 2024)
Changed paths:
M LayoutTests/imported/w3c/web-platform-tests/css/css-animations/display-interpolation-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-animations/display-none-dont-cancel.tentative-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-display/animations/display-interpolation-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/display.tentative-expected.txt
M Source/WebCore/animation/KeyframeEffect.cpp
M Source/WebCore/rendering/updating/RenderTreeUpdater.cpp
M Source/WebCore/style/StyleTreeResolver.cpp
M Source/WebCore/style/StyleUpdate.h
M Source/WebCore/style/Styleable.cpp
Log Message:
-----------
[web-animations] account for `display` animations when resolving style
https://bugs.webkit.org/show_bug.cgi?id=271386
Reviewed by Antti Koivisto.
While we added animation support for the `display` property in bug 271372 / 276464 at main, we are
not yet fully accounting for the possibility that the `display` property is animated when resolving
styles in Style::TreeResolver.
There are some subtleties there since, historically, transitions could not be started on an element
with `display: none` and setting `display: none` on an element with running style-originated animations
would cancel those animations.
In this patch we now call `createAnimatedElementUpdate()` under `Style::TreeResolver::resolveElement()`
even when the non-animated style has `display: none`. Within `createAnimatedElementUpdate()`, we now
keep track of the non-animated `display` value prior to updating animations, and when we're done compare
this value to its animated counterpart to determine whether animations affected `display`.
If after updating animations `display: none` is set and that value was not affected by animations, we
cancel any animation created in the process silently (see bug 271365 / 276453 at main) such that Web content
may not observe that those animations ever were created.
We also make sure to keep track of whether `display` was affected by updating animations as a new member
of the `ElementUpdate` struct such that when updating renderers in `RenderTreeUpdater::updateElementRenderer()`
we only cancel style-originated animations with a `display: none` style if that that `display` value did not
come from an animation. Otherwise, style-originated animations setting `display: none` would cancel themselves.
These changes allow us to pass the remainder of the WPT test coverage for animating `display`.
* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/display-interpolation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/display-none-dont-cancel.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-display/animations/display-interpolation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/display.tentative-expected.txt:
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::ticksContinuouslyWhileActive const):
* Source/WebCore/rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateElementRenderer):
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::affectsRenderedSubtree):
(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):
* Source/WebCore/style/StyleUpdate.h:
* Source/WebCore/style/Styleable.cpp:
(WebCore::Styleable::updateCSSAnimations const):
(WebCore::Styleable::updateCSSTransitions const):
Canonical link: https://commits.webkit.org/276531@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list