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

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-anchoring/anchor-used-height-change-does-not-suppress-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-anchoring/anchor-used-height-change-does-not-suppress.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-anchoring/negative-layout-overflow-on-anchor-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-anchoring/negative-layout-overflow-on-anchor.html
    M Source/WebCore/page/scrolling/ScrollAnchoringController.cpp

  Log Message:
  -----------
  [Scroll Anchoring] Reddit page becomes blank and jumps to top after clicking 
"View more comments"
https://bugs.webkit.org/show_bug.cgi?id=308788
rdar://170889205

Reviewed by Brent Fulgham.

On the reddit page, there's an intermediate state where the wrapper for the 
comments (`SHREDDIT-COMMENT-TREE`)
has its content removed; its only child is a flexbox which has not been laid 
out yet, so we pick the wrapper
as the anchor. The wrapper happens to have large overflow into negative top and 
left, and this overflow
changes pre- to post-layout, so anchoring goes haywire.

Fix by trimming negative overflow when computing the local anchor rect; we 
actually just use the anchor's
border box, extended in the block direction by layout overflow (since anchoring 
only affects scrolling on
the block progression axis).

Added two new tests. `negative-layout-overflow-on-anchor.html` tests anchoring 
with changing negative
overflow on the anchor. `anchor-used-height-change-does-not-suppress.html` was 
added to test another scenario
I investigated while coming up with the fix, which is an anchor whose used 
height changes; in all browsers
this does not suppress anchoring.

Tests: 
imported/w3c/web-platform-tests/css/css-scroll-anchoring/anchor-used-height-change-does-not-suppress.html
       
imported/w3c/web-platform-tests/css/css-scroll-anchoring/negative-layout-overflow-on-anchor.html

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-anchoring/anchor-used-height-change-does-not-suppress-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-anchoring/anchor-used-height-change-does-not-suppress.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-anchoring/negative-layout-overflow-on-anchor-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-anchoring/negative-layout-overflow-on-anchor.html:
 Added.
* Source/WebCore/page/scrolling/ScrollAnchoringController.cpp:
(WebCore::candidateLocalRectForAnchoring):
(WebCore::ScrollAnchoringController::computeScrollerRelativeRects const):
(WebCore::ScrollAnchoringController::adjustScrollPositionForAnchoring):

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



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

Reply via email to