Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 43c5d324c08a2c8f6c5ba88a499435f50975b73e
      
https://github.com/WebKit/WebKit/commit/43c5d324c08a2c8f6c5ba88a499435f50975b73e
  Author: Elika Etemad <fantasai.b...@inkedblade.net>
  Date:   2025-09-16 (Tue, 16 Sep 2025)

  Changed paths:
    A LayoutTests/fast/scrolling/anchor-overscroll-fixed-expected.html
    A LayoutTests/fast/scrolling/anchor-overscroll-fixed.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-006-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-007-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-008-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-009-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-010-expected.txt
    R 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-002-expected.txt
    R 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-004-expected.txt
    R 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-005-expected.txt
    R 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-006-expected.txt
    R 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-007-expected.txt
    R 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-008-expected.txt
    R 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-009-expected.txt
    R 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-010-expected.txt
    M Source/WebCore/page/LocalFrameViewLayoutContext.cpp
    M Source/WebCore/page/LocalFrameViewLayoutContext.h
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/style/AnchorPositionEvaluator.cpp
    M Source/WebCore/style/AnchorPositionEvaluator.h

  Log Message:
  -----------
  Fix bad interaction of anchor positioning and overscroll
https://bugs.webkit.org/show_bug.cgi?id=298031
rdar://159356009

Reviewed by Antti Koivisto.

This patch fixes several problems that are triggered during overscroll:
1. We need to clamp the scroll position to avoid laying out into the
   overscroll area.
2. We need to not recapture scroll positions when we are running layout
   only on the children (and therefore not recalculating the rect itself).
3. We need to ensure that a scroll-dependent anchor() gets recalculated
   whenever layout triggers a recapture of the scroll positions, so that
   the capture and the anchor() resolution don't get out of sync.

* LayoutTests/fast/scrolling/anchor-overscroll-fixed-expected.html: Added.
* LayoutTests/fast/scrolling/anchor-overscroll-fixed.html: Added.

Add test.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-006-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-007-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-008-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-009-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-010-expected.txt:
* 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-002-expected.txt:
 Removed.
* 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-004-expected.txt:
 Removed.
* 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-005-expected.txt:
 Removed.
* 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-006-expected.txt:
 Removed.
* 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-007-expected.txt:
 Removed.
* 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-008-expected.txt:
 Removed.
* 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-009-expected.txt:
 Removed.
* 
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-010-expected.txt:
 Removed.

Pass more tests.

* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::registerAnchorScrollAdjuster):
* Source/WebCore/page/LocalFrameViewLayoutContext.h:

Return whether or not the recapture differs.

* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::simplifiedLayout):

Don't capture during layout that skips rect calculation, so that the
rect and the capture stay in sync.

* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::constrainedScrollPosition const):

Add helper method to get the constrained scroll position.

* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::AnchorScrollAdjuster::recaptureDiffers const):

Add helper method to identify differing captures.

(WebCore::AnchorScrollAdjuster::addSnapshot):
(WebCore::AnchorScrollAdjuster::addViewportSnapshot):
(WebCore::AnchorScrollAdjuster::adjustmentForViewport const):

Constrain the scroll position.

(WebCore::Style::AnchorPositionEvaluator::captureScrollSnapshots):

Allow calling captureScrollSnapshots() from style resolution.
Trigger style invalidation when the capture differs.

(WebCore::Style::offsetFromAncestorContainer):
(WebCore::Style::AnchorPositionEvaluator::computeAnchorRectRelativeToContainingBlock):

Constrain the scroll position.

(WebCore::Style::AnchorPositionEvaluator::updateAnchorPositioningStatesAfterInterleavedLayout):

Capture scroll positions when resolving anchor() functions so they can
be compared to the positions captured during layout.

* Source/WebCore/style/AnchorPositionEvaluator.h:

Update API for above changes.

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



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

Reply via email to