Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 344b0fc11db6bd68cbafaaf0a40fed35cbd86d7b
https://github.com/WebKit/WebKit/commit/344b0fc11db6bd68cbafaaf0a40fed35cbd86d7b
Author: Elika Etemad <[email protected]>
Date: 2026-03-30 (Mon, 30 Mar 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-to-sticky-005-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-to-sticky-005-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-to-sticky-005.html
M Source/WebCore/style/AnchorPositionEvaluator.cpp
M Source/WebCore/style/AnchorPositionEvaluator.h
Log Message:
-----------
Fixed boxes anchored to children of sticky boxes should stick
https://bugs.webkit.org/show_bug.cgi?id=310239
rdar://172884148
Reviewed by Antti Koivisto.
We were only tracking the sticky offset of the anchor itself, but not of its
ancestors. Update the AnchorScrollAdjuster to be able to track the ancestor
chain, using a structure analogous to how we manage ancestor scrollers.
While we're here, also fix the bug where we are incorrectly performing scroll
compensation for absolutely positioned boxes trapped within a fixed-positioned
containing block, so we can write a good reference for the WPT test.
Tests:
imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-to-sticky-005-ref.html
imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-to-sticky-005.html
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-to-sticky-005-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-to-sticky-005-ref.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-to-sticky-005.html:
Added.
Add tests.
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::AnchorStickySnapshot::AnchorStickySnapshot):
(WebCore::AnchorStickySnapshot::adjustmentForCurrentScrollPosition const):
Implement core methods for new AnchorStickySnapshot struct.
(WebCore::AnchorScrollAdjuster::isEmpty const):
(WebCore::AnchorScrollAdjuster::AnchorScrollAdjuster):
(WebCore::AnchorScrollAdjuster::recaptureDiffers const):
(WebCore::AnchorScrollAdjuster::addScrollSnapshot):
(WebCore::AnchorScrollAdjuster::addStickySnapshot):
(WebCore::AnchorScrollAdjuster::accumulateAdjustments const):
Update AnchorScrollAdjuster to manage AnchorStickySnapshots.
(WebCore::Style::isFixed):
Add convenience method, since we're repeating this pattern multiple times.
(WebCore::Style::AnchorPositionEvaluator::captureScrollSnapshots):
1. Hook up sticky snapshotting to our ancestor walk for scrollers.
2. Also, check for a fixed containing block before creating a viewport snapshot.
(WebCore::AnchorScrollAdjuster::addSnapshot): Deleted.
* Source/WebCore/style/AnchorPositionEvaluator.h:
Create new AnchorStickySnapshot struct parallelling AnchorScrollSnapshot
and hook it up to the AnchorScrollAdjuster.
Canonical link: https://commits.webkit.org/310255@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications