Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web-animations] pause animation scheduling while style-originated animations are being updated #26187

Merged

Conversation

graouts
Copy link
Contributor

@graouts graouts commented Mar 20, 2024

64ea9d3

[web-animations] pause animation scheduling while style-originated animations are being updated
https://bugs.webkit.org/show_bug.cgi?id=271311

Reviewed by Dean Jackson.

When we will be adding animation support for the `display` property (see bug 267762) we will
need to resolve animations even when the underlying style has `display: none` to see whether
animations yield a different value. In that process, we may create style-originated animations
that will ultimately be canceled once we're certain `display: none` is still set. As it stands,
the creation of a style-originated animation will immediately lead to animation scheduling and
possibly be observable through Web content by the dispatch of animation events.

As such, in preparation for supporting the animation of the `display` property, we now pause
animation scheduling while we consider new style-originated animations. We now store new animations
that we create in a list as we start the `Style::TreeResolver::createAnimatedElementUpdate()`
process and once it completes, provided that list is not empty, we notify the `DocumentTimeline`
to schedule animation resolution in a single operation.

The purpose of using a list rather than just a boolean flag to signal style-originated animation
creation is that, as mentioned above, we will need to silently cancel those newly created animations
should the animated style have `display: none`.

* Source/WebCore/animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::animationTimingDidChange):
(WebCore::DocumentTimeline::styleOriginatedAnimationsWereCreated):
* Source/WebCore/animation/DocumentTimeline.h:
* Source/WebCore/animation/WebAnimation.h:
(WebCore::WebAnimation::isEffectInvalidationSuspended const):
(WebCore::WebAnimation::isEffectInvalidationSuspended): Deleted.
* Source/WebCore/animation/WebAnimationTypes.h:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):
* Source/WebCore/style/Styleable.cpp:
(WebCore::Styleable::updateCSSAnimations const):
(WebCore::updateCSSTransitionsForStyleableAndProperty):
(WebCore::Styleable::updateCSSTransitions const):
* Source/WebCore/style/Styleable.h:

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

330a58a

Misc iOS, tvOS & watchOS macOS Linux Windows
⏳ 🧪 style ⏳ 🛠 ios ⏳ 🛠 mac ⏳ 🛠 wpe ⏳ 🛠 wincairo
⏳ 🧪 bindings ⏳ 🛠 ios-sim ⏳ 🛠 mac-AS-debug ⏳ 🧪 wpe-wk2
⏳ 🧪 webkitperl ⏳ 🧪 ios-wk2 ⏳ 🧪 api-mac ⏳ 🧪 api-wpe
⏳ 🧪 webkitpy ⏳ 🧪 ios-wk2-wpt ⏳ 🧪 mac-wk1 ⏳ 🛠 wpe-skia
⏳ 🛠 🧪 jsc ⏳ 🧪 api-ios ⏳ 🧪 mac-wk2 ⏳ 🛠 gtk
⏳ 🛠 🧪 jsc-arm64 ⏳ 🛠 tv ⏳ 🧪 mac-AS-debug-wk2 ⏳ 🧪 gtk-wk2
⏳ 🧪 services ⏳ 🛠 tv-sim ⏳ 🧪 mac-wk2-stress ⏳ 🧪 api-gtk
⏳ 🛠 watch ⏳ 🛠 jsc-armv7
✅ 🛠 🧪 unsafe-merge ⏳ 🛠 watch-sim ⏳ 🧪 jsc-armv7-tests

@graouts graouts self-assigned this Mar 20, 2024
@graouts graouts added the Animations Bugs related to CSS + SVG animations and transitions label Mar 20, 2024
@graouts graouts requested review from anttijk and grorg March 20, 2024 12:40
@graouts graouts changed the title [web-animations] pause animation scheduling while style-originated animations are being updated [web-animations] add interpolation support for the display property Mar 20, 2024
@graouts graouts changed the title [web-animations] add interpolation support for the display property [web-animations] pause animation scheduling while style-originated animations are being updated Mar 20, 2024
@graouts graouts added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Mar 20, 2024
@webkit-commit-queue webkit-commit-queue force-pushed the display-animatable-landing-step-two branch from f4be612 to 330a58a Compare March 20, 2024 18:19
@graouts graouts added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing labels Mar 20, 2024
…imations are being updated

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

Reviewed by Dean Jackson.

When we will be adding animation support for the `display` property (see bug 267762) we will
need to resolve animations even when the underlying style has `display: none` to see whether
animations yield a different value. In that process, we may create style-originated animations
that will ultimately be canceled once we're certain `display: none` is still set. As it stands,
the creation of a style-originated animation will immediately lead to animation scheduling and
possibly be observable through Web content by the dispatch of animation events.

As such, in preparation for supporting the animation of the `display` property, we now pause
animation scheduling while we consider new style-originated animations. We now store new animations
that we create in a list as we start the `Style::TreeResolver::createAnimatedElementUpdate()`
process and once it completes, provided that list is not empty, we notify the `DocumentTimeline`
to schedule animation resolution in a single operation.

The purpose of using a list rather than just a boolean flag to signal style-originated animation
creation is that, as mentioned above, we will need to silently cancel those newly created animations
should the animated style have `display: none`.

* Source/WebCore/animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::animationTimingDidChange):
(WebCore::DocumentTimeline::styleOriginatedAnimationsWereCreated):
* Source/WebCore/animation/DocumentTimeline.h:
* Source/WebCore/animation/WebAnimation.h:
(WebCore::WebAnimation::isEffectInvalidationSuspended const):
(WebCore::WebAnimation::isEffectInvalidationSuspended): Deleted.
* Source/WebCore/animation/WebAnimationTypes.h:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):
* Source/WebCore/style/Styleable.cpp:
(WebCore::Styleable::updateCSSAnimations const):
(WebCore::updateCSSTransitionsForStyleableAndProperty):
(WebCore::Styleable::updateCSSTransitions const):
* Source/WebCore/style/Styleable.h:

Canonical link: https://commits.webkit.org/276414@main
@webkit-commit-queue webkit-commit-queue force-pushed the display-animatable-landing-step-two branch from 330a58a to 64ea9d3 Compare March 20, 2024 20:27
@webkit-commit-queue
Copy link
Collaborator

Committed 276414@main (64ea9d3): https://commits.webkit.org/276414@main

Reviewed commits have been landed. Closing PR #26187 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 64ea9d3 into WebKit:main Mar 20, 2024
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Mar 20, 2024
@graouts graouts deleted the display-animatable-landing-step-two branch March 20, 2024 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Animations Bugs related to CSS + SVG animations and transitions
Projects
None yet
4 participants