Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7bdd6f4aabffd6a17c4c5663b6d4e26a90190c63
      
https://github.com/WebKit/WebKit/commit/7bdd6f4aabffd6a17c4c5663b6d4e26a90190c63
  Author: Simon Fraser <[email protected]>
  Date:   2026-02-28 (Sat, 28 Feb 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/input/snap-area-overflow-boundary-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/resnap-on-layout-is-immediate-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/resnap-on-layout-is-immediate.html
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebCore/platform/ScrollableArea.cpp

  Log Message:
  -----------
  [Scroll snap] YouTube shorts scroll to the next video and back
https://bugs.webkit.org/show_bug.cgi?id=308913
rdar://166596210

Reviewed by Wenson Hsieh and Alan Baradlay.

The YouTube shorts page uses scroll snap. When the page first loads, there's a 
`<div id='initial-player-container’>`
item above the first short with non-zero height, pushing the first video (which 
has the first snap point) down. We
scroll down to snap to it, and then a layout changes the height of `<div 
id='initial-player-container’>` to zero,
triggering a scroll back to 0. However, a message comes back from the UI 
process for the first scroll, and resets
the scroll position closer to the second video, so we scroll back down (and 
then the page calls `scrollIntoView()`
and the scroll position animates back up).

The bug here was that the scroll-snap related scrolls were not marked as 
programmatic, so they did not cause
synchronous scroll position updates in the web process, and thus mis-handled 
the messages coming back from
the UI process (logic fixed in 308215@main).

The fix uses a `ScrollTypeScope` to mark resnapping scrolls as programmatic.

Test: 
imported/w3c/web-platform-tests/css/css-scroll-snap/resnap-on-layout-is-immediate.html

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/input/snap-area-overflow-boundary-expected.txt:
 Fails
in a different way now.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/resnap-on-layout-is-immediate-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/resnap-on-layout-is-immediate.html:
 Added.
* LayoutTests/platform/mac-wk2/TestExpectations: One new pass.
* Source/WebCore/platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::resnapAfterLayout):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to