Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2d9d00fde2da68e148583639633bba2e871a73fc
      
https://github.com/WebKit/WebKit/commit/2d9d00fde2da68e148583639633bba2e871a73fc
  Author: Antoine Quint <[email protected]>
  Date:   2024-11-22 (Fri, 22 Nov 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    A 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-quirks-mode-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-quirks-mode.html
    A 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-scrollable-body-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-scrollable-body-quirks-mode-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-scrollable-body-quirks-mode.html
    A 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-scrollable-body.html
    A 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source.html
    M Source/WebCore/animation/ScrollTimeline.cpp
    M Source/WebCore/animation/ScrollTimeline.h

  Log Message:
  -----------
  [scroll-animations] scroll timelines should use the document's scrolling 
element as their default and root source
https://bugs.webkit.org/show_bug.cgi?id=283412
rdar://140268956

Reviewed by Simon Fraser.

Our scroll timeline code assumed that the document element was the root-most 
scroller in all cases,
whereas in quirks mode it is the <body> element. This manifested itself in the 
WPT test
`scroll-animations/scroll-timelines/animation-with-root-scroller.html` which 
runs in quirks mode
and we'd fail to return a valid `ScrollableArea` for `<body>` because 
`scrollableAreaForSourceRenderer()`
would only match against the document element. As a result, that test's 
animation would never resolve
its `ready` promise since the scroll timeline would never return a resolved 
current time.

We make several changes to address this.

First, we get rid of `sourceElementForProgressCalculation()` and instead 
resolve the correct source in
the `source()` getter accounting for the `Scroller` value set for anonymous 
timelines (those originated
by a `scroll()` value in CSS). This means that anonymous timelines will also 
report the right source
through the JS API and not just within our internal source resolution.

Then in `scrollableAreaForSourceRenderer()` we correctly check for the 
document's `scrollingElement()`
instead of the document element to look for the right `ScrollableArea`.

While working in `scrollableAreaForSourceRenderer()`, we also move it to the 
protected section since
it's only used from within `ScrollTimeline` and its subclass `ViewTimeline`. 
Additionally, we make
its element parameter `const` and change the `Ref<>` parameter to a bare 
reference per the guidelines,
creating a `Ref` as needed within the function's body.

Finally, we extend the WPT test coverage to check the anonymous timeline source 
is correct in quirks mode
and non-quirks mode, including when the `<body>` can be scrolled independently 
from the document viewport.

* LayoutTests/TestExpectations:
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-quirks-mode-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-quirks-mode.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-scrollable-body-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-scrollable-body-quirks-mode-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-scrollable-body-quirks-mode.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source-scrollable-body.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-anonymous-source.html:
 Added.
* Source/WebCore/animation/ScrollTimeline.cpp:
(WebCore::ScrollTimeline::source const):
(WebCore::ScrollTimeline::scrollableAreaForSourceRenderer):
(WebCore::ScrollTimeline::computeTimelineData const):
(WebCore::ScrollTimeline::sourceElementForProgressCalculation const): Deleted.
* Source/WebCore/animation/ScrollTimeline.h:
(WebCore::ScrollTimeline::source const): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to