Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c1dbbbee21268435cb02a16d1dc354d11a79f338
      
https://github.com/WebKit/WebKit/commit/c1dbbbee21268435cb02a16d1dc354d11a79f338
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-05 (Sun, 05 Jul 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-horizontal-wm-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-horizontal-wm-001-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-horizontal-wm-001.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-vertical-wm-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-vertical-wm-001-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-vertical-wm-001.html
    M Source/WebCore/style/AnchorPositionEvaluator.cpp

  Log Message:
  -----------
  anchor-center in a vertical writing mode is not scroll-adjusted along the 
block axis
https://bugs.webkit.org/show_bug.cgi?id=318618
rdar://181413103

Reviewed by Simon Fraser.

In AnchorScrollAdjuster, the block-axis (Y) scroll-adjustment check for
anchor-center read alignSelf().isAnchorCenter() in both the horizontal and
vertical writing-mode arms of the ternary. The horizontal-axis (X) check
correctly pairs justify-self/align-self per axis, but the vertical arm of the
Y check was a copy-paste of the horizontal arm.

For a vertical containing writing mode, the block (Y) axis is controlled by
justify-self, not align-self, so an abspos box using anchor-center never set
m_needsYAdjustment. As a result it was not compensated for its anchor's scroll
offset and drifted away from the anchor after scrolling.

Pair the vertical arm with justifySelf().isAnchorCenter(), matching the
per-axis logic already used by the position-area block above.

Tests: 
imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-horizontal-wm-001.html
       
imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-vertical-wm-001.html

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-horizontal-wm-001-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-horizontal-wm-001-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-horizontal-wm-001.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-vertical-wm-001-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-vertical-wm-001-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-center-scroll-vertical-wm-001.html:
 Added.
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::AnchorScrollAdjuster::AnchorScrollAdjuster):

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



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

Reply via email to