Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8347f2294551a54adb88315196f6908e97a1ba61
      
https://github.com/WebKit/WebKit/commit/8347f2294551a54adb88315196f6908e97a1ba61
  Author: Antti Koivisto <[email protected]>
  Date:   2025-07-02 (Wed, 02 Jul 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-006-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-007-expected.txt
    M Source/WebCore/platform/BoxSides.h
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/rendering/style/RenderStyleInlines.h
    M Source/WebCore/rendering/style/RenderStyleSetters.h
    M Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
    M Source/WebCore/rendering/style/StyleRareNonInheritedData.h
    M Source/WebCore/style/AnchorPositionEvaluator.cpp
    M Source/WebCore/style/AnchorPositionEvaluator.h
    M Source/WebCore/style/StyleTreeResolver.cpp

  Log Message:
  -----------
  [css-anchor-position-1] Scroll compensation should be determined per-axis
https://bugs.webkit.org/show_bug.cgi?id=295277
rdar://problem/154762565

Reviewed by Alan Baradlay.

"An absolutely positioned box abspos compensates for scroll in the horizontal 
or vertical axis if both of the following conditions are true:
- abspos has a default anchor box.
- abspos has an anchor reference to its default anchor box or at least to 
something in the same scrolling context"

https://drafts.csswg.org/css-anchor-position-1/#scroll

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-006-expected.txt:
* Source/WebCore/platform/BoxSides.h:
(WebCore::boxAxisToFlag):
(WebCore::boxAxisForSide):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::anchorFunctionScrollCompensatedAxes const):
* Source/WebCore/rendering/style/RenderStyleSetters.h:
(WebCore::RenderStyle::setAnchorFunctionScrollCompensatedAxes):
* Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
(WebCore::StyleRareNonInheritedData::dumpDifferences const):

Add style bits to record the scroll compensated axes.

* Source/WebCore/rendering/style/StyleRareNonInheritedData.h:
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::anchorSideMatchesInsetProperty):
(WebCore::Style::AnchorPositionEvaluator::addAnchorFunctionScrollCompensatedAxis):

Record the scroll compensated axes for anchor functions axes to the style.

(WebCore::Style::AnchorPositionEvaluator::scrollOffsetFromAnchor):

Only apply offset to the compensated axes.

(WebCore::Style::AnchorPositionEvaluator::findAnchorForAnchorFunctionAndAttemptResolution):

Anchors are boxes, return a renderer directly.

(WebCore::Style::AnchorPositionEvaluator::evaluate):
(WebCore::Style::AnchorPositionEvaluator::evaluateSize):
(WebCore::Style::AnchorPositionEvaluator::updateAnchorPositionedStateForDefaultAnchor):

Always resolve the default anchor, scroll compensation computation needs it 
even if it not referenced.

(WebCore::Style::AnchorPositionEvaluator::updateSnapshottedScrollOffsets):
(WebCore::Style::scrollOffsetFromAnchor): Deleted.
(WebCore::Style::AnchorPositionEvaluator::updateAnchorPositionedStateForLayoutTimePositioned):
 Deleted.
* Source/WebCore/style/AnchorPositionEvaluator.h:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::updateAnchorPositioningState):

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



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

Reply via email to