Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 20f1014b6f5dbc5ca3dc9dd969b88cacb50e96cf
      
https://github.com/WebKit/WebKit/commit/20f1014b6f5dbc5ca3dc9dd969b88cacb50e96cf
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-06-26 (Fri, 26 Jun 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-nested-containers-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-snap-target-containing-focused-element-expected.txt
    M LayoutTests/platform/mac/TestExpectations
    M Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp

  Log Message:
  -----------
  [CSS Scroll Snap] Re-snap does not prefer a snap area that contains the 
focused or fragment-targeted element
https://bugs.webkit.org/show_bug.cgi?id=317915
rdar://180707984

Reviewed by Simon Fraser.

When selecting between multiple aligned snap areas, the re-snap algorithm
(https://drafts.csswg.org/css-scroll-snap-1/#multiple-aligned) prioritizes a box
that "is focused or has a focused descendant", then one that "is targeted or has
a targeted descendant". WebCore only flagged a snap area when it *was* the 
focused
or fragment-targeted element, missing the common case where that element is a
descendant of the snap area (e.g. a focusable control inside a snapping 
section).

Flag a snap area as focused/targeted when it is, or contains, the focused or
fragment-targeted element.

* LayoutTests/TestExpectations: Unskip now-passing
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-nested-containers-expected.txt:
 Progression
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-snap-target-containing-focused-element-expected.txt:
 Ditto
* LayoutTests/platform/mac/TestExpectations: Unskip now-passing
* Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::updateSnapOffsetsForScrollableArea): Use Node::contains() so a snap 
area
that contains the focused/targeted element is treated as focused/targeted.

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



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

Reply via email to