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

[scroll-animations] make animation-timeline, animation-range-start and animation-range-end reset-only longhands of the animation shorthand #40351

Conversation

graouts
Copy link
Contributor

@graouts graouts commented Feb 10, 2025

91fb05a

[scroll-animations] make `animation-timeline`, `animation-range-start` and `animation-range-end` reset-only longhands of the `animation` shorthand
https://bugs.webkit.org/show_bug.cgi?id=287398

Reviewed by Tim Nguyen.

The CSS WG resolved in w3c/csswg-drafts#6946 (comment) to make the
new CSS properties introduced to support Scroll-driven Animations – `animation-timeline`, `animation-range-start`
and `animation-range-end` – reset-only longhands of the `animation` shorthand.

To that end, we add those properties to the `"longhands"` property for `animation` in `CSSProperties.json`
and deal with them when relevant:

- in `CSSPropertyParser.cpp` we set `nullptr` values for those properties to reset any value previously set
and ensure those properties have the right initial values for serialization purposes.

- in `ComputedStyleExtractor.cpp` we return an empty value whenever we attempt to serialize the `animation`
shorthand in the computed style when one of those reset-only longhands was otherwise set.

- in `ShorthandSerializer.cpp` we do similar work when serializing the specified value.

* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-shorthand-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-shorthand-expected.txt:
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::animationShorthandValue):
* Source/WebCore/css/ShorthandSerializer.cpp:
(WebCore::ShorthandSerializer::serializeLayered const):
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::initialValueForLonghand):
(WebCore::consumeAnimationValueForShorthand):
(WebCore::CSSPropertyParser::consumeAnimationShorthand):

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

260cd38

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 🧪 mac-intel-wk2 ✅ 🛠 playstation
✅ 🛠 🧪 unsafe-merge ✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@graouts graouts self-assigned this Feb 10, 2025
@graouts graouts added the Animations Bugs related to CSS + SVG animations and transitions label Feb 10, 2025
@graouts graouts force-pushed the eng/scroll-animations-make-animation-timeline-animation-range-start-and-animation-range-end-reset-only-longhands-of-the-animation-shorthand branch from 8656c6a to 260cd38 Compare February 10, 2025 13:19
@graouts graouts added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Feb 10, 2025
…` and `animation-range-end` reset-only longhands of the `animation` shorthand

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

Reviewed by Tim Nguyen.

The CSS WG resolved in w3c/csswg-drafts#6946 (comment) to make the
new CSS properties introduced to support Scroll-driven Animations – `animation-timeline`, `animation-range-start`
and `animation-range-end` – reset-only longhands of the `animation` shorthand.

To that end, we add those properties to the `"longhands"` property for `animation` in `CSSProperties.json`
and deal with them when relevant:

- in `CSSPropertyParser.cpp` we set `nullptr` values for those properties to reset any value previously set
and ensure those properties have the right initial values for serialization purposes.

- in `ComputedStyleExtractor.cpp` we return an empty value whenever we attempt to serialize the `animation`
shorthand in the computed style when one of those reset-only longhands was otherwise set.

- in `ShorthandSerializer.cpp` we do similar work when serializing the specified value.

* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-shorthand-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-shorthand-expected.txt:
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::animationShorthandValue):
* Source/WebCore/css/ShorthandSerializer.cpp:
(WebCore::ShorthandSerializer::serializeLayered const):
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::initialValueForLonghand):
(WebCore::consumeAnimationValueForShorthand):
(WebCore::CSSPropertyParser::consumeAnimationShorthand):

Canonical link: https://commits.webkit.org/290168@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/scroll-animations-make-animation-timeline-animation-range-start-and-animation-range-end-reset-only-longhands-of-the-animation-shorthand branch from 260cd38 to 91fb05a Compare February 10, 2025 16:28
@webkit-commit-queue
Copy link
Collaborator

Committed 290168@main (91fb05a): https://commits.webkit.org/290168@main

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

@webkit-commit-queue webkit-commit-queue merged commit 91fb05a into WebKit:main Feb 10, 2025
@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 Feb 10, 2025
@graouts graouts deleted the eng/scroll-animations-make-animation-timeline-animation-range-start-and-animation-range-end-reset-only-longhands-of-the-animation-shorthand branch February 10, 2025 16:46
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
Development

Successfully merging this pull request may close these issues.

4 participants