[webkit-changes] [WebKit/WebKit] 319e2f: [scroll-animations] https://scroll-driven-animatio...
Antoine Quint
noreply at github.com
Sat Dec 14 01:10:41 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 319e2fc273efed67ae7e06d3daf850fbaef86e5d
https://github.com/WebKit/WebKit/commit/319e2fc273efed67ae7e06d3daf850fbaef86e5d
Author: Antoine Quint <graouts at webkit.org>
Date: 2024-12-14 (Sat, 14 Dec 2024)
Changed paths:
M LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-nearest-dirty-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-root-dirty-expected.txt
A LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/siblings-with-anonymous-timelines-expected.txt
A LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/siblings-with-anonymous-timelines.html
M LayoutTests/imported/w3c/web-platform-tests/scroll-animations/view-timelines/contain-alignment-expected.txt
M Source/WebCore/animation/CSSAnimation.cpp
M Source/WebCore/animation/ScrollTimeline.cpp
M Source/WebCore/animation/ScrollTimeline.h
M Source/WebCore/animation/ViewTimeline.cpp
M Source/WebCore/animation/ViewTimeline.h
M Source/WebCore/css/CSSScrollValue.h
M Source/WebCore/css/CSSToStyleMap.cpp
M Source/WebCore/css/CSSViewValue.h
M Source/WebCore/css/ComputedStyleExtractor.cpp
M Source/WebCore/platform/animation/Animation.cpp
M Source/WebCore/platform/animation/Animation.h
Log Message:
-----------
[scroll-animations] https://scroll-driven-animations.style/demos/parallax-carousel/css/ does not work
https://bugs.webkit.org/show_bug.cgi?id=284534
rdar://141356306
Reviewed by Antti Koivisto.
The Scroll-driven Animations demo at https://scroll-driven-animations.style/demos/parallax-carousel/css/ uses
an `animation-timeline: view()` property set via a CSS rule on a number of sibling `<img>` elements. In WebKit,
these elements share style.
However, the anonymous `ViewTimeline` created by `animation-timeline: view()` is stored on an `Animation` object
owned by `RenderStyle` through its `AnimationList` for CSS Animations accessed via `RenderStyle::animations()`.
If elements that are using an anonymous timeline share style, then they'll share their timeline even though those
need to be unique to each element.
To address this, we no longer create a `ScrollTimeline` or `ViewTimeline` when finding an anonymous timeline set
for the `animation-timeline` property and instead use a dedicated small struct for each type which we add to the
`std::variant<>` used to represent timelines on `Animation`. Then, when we deal with a style change on the associated
`CSSAnimation`, we create a new `ScrollTimeline` or `ViewTimeline` using the struct hosted on `Animation`.
This change yields a fair bit of refactoring to deal with the expanded variant but yields some WPT progressions as
well as fixing the demo.
We also add a new WPT test specifically testing timeline uniqueness for this case.
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-nearest-dirty-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-root-dirty-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/siblings-with-anonymous-timelines-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/siblings-with-anonymous-timelines.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/view-timelines/contain-alignment-expected.txt:
* Source/WebCore/animation/CSSAnimation.cpp:
(WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
* Source/WebCore/animation/ScrollTimeline.cpp:
(WebCore::ScrollTimeline::create):
(WebCore::operator<<):
(WebCore::ScrollTimeline::createFromCSSValue): Deleted.
(WebCore::ScrollTimeline::dump const): Deleted.
(WebCore::ScrollTimeline::toCSSValue const): Deleted.
* Source/WebCore/animation/ScrollTimeline.h:
* Source/WebCore/animation/ViewTimeline.cpp:
(WebCore::ViewTimeline::createFromCSSValue): Deleted.
(WebCore::ViewTimeline::dump const): Deleted.
(WebCore::ViewTimeline::toCSSValue const): Deleted.
* Source/WebCore/animation/ViewTimeline.h:
* Source/WebCore/css/CSSScrollValue.h:
* Source/WebCore/css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapAnimationTimeline const):
* Source/WebCore/css/CSSViewValue.h:
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::valueForAnimationTimeline):
* Source/WebCore/platform/animation/Animation.cpp:
(WebCore::operator<<):
* Source/WebCore/platform/animation/Animation.h:
(WebCore::Animation::AnonymousScrollTimeline::operator== const):
(WebCore::Animation::AnonymousViewTimeline::operator== const):
Canonical link: https://commits.webkit.org/287836@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