Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 755cd64e24a56c80bf33dca159d61c94519fce32
      
https://github.com/WebKit/WebKit/commit/755cd64e24a56c80bf33dca159d61c94519fce32
  Author: Kiet Ho <[email protected]>
  Date:   2025-10-02 (Thu, 02 Oct 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    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
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-011-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/base-style-invalidation-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/last-successful-intermediate-ignored-expected.txt
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/rendering/RenderView.cpp
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/style/RenderStyle.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/StyleScope.cpp
    M Source/WebCore/style/StyleScope.h
    M Source/WebCore/style/StyleTreeResolver.cpp
    M Source/WebCore/style/StyleTreeResolver.h

  Log Message:
  -----------
  [css-anchor-position-1] Remember last-successful position option at 
ResizeObserver delivery time
rdar://159225250
https://bugs.webkit.org/show_bug.cgi?id=297932

Reviewed by Antti Koivisto.

RenderStyle::lastSuccessfulPositionTryFallbackIndex is _actually_ the index of 
the position
option being applied to the style. Because we stop trying as soon as we find a 
working option,
given a box's style after style resolution, 
lastSuccessfulPositionTryFallbackIndex is _also_
the index of the last successful position option. This implies that the last 
successful position
option is remembered at style resolution time. However, the spec [1] dictates 
that the
last successful position option is remember _when_ ResizeObserver events are 
dispatched.
This patch aligns with that behavior by separating trying position options into 
two phases:

* During style resolution, each option is tried, and 
RenderStyle::usedPositionOptionIndex
(renamed from ::lastSuccessfulPositionTryFallbackIndex) is set for each style 
to denote
what's the option used to generate the style.
* When ResizeObserver events are dispatched (after style resolution), we loop 
through
each position-try box and save the usedPositionOptionIndex of each box. This is 
the
last successful position option of the box.
* At the next style resolution, we use the saved last successful position 
option to
adjust which option should be tried first.

[1]: 
https://drafts.csswg.org/css-anchor-position-1/#last-successful-position-option

* LayoutTests/TestExpectations:
* 
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/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-011-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/base-style-invalidation-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/last-successful-intermediate-ignored-expected.txt:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::updateResizeObservations):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::unregisterPositionTryBox):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::usedPositionOptionIndex const):
(WebCore::RenderStyle::setUsedPositionOptionIndex):
(WebCore::RenderStyle::lastSuccessfulPositionTryFallbackIndex const): Deleted.
(WebCore::RenderStyle::setLastSuccessfulPositionTryFallbackIndex): Deleted.
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
(WebCore::StyleRareNonInheritedData::dumpDifferences const):
* Source/WebCore/rendering/style/StyleRareNonInheritedData.h:
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::AnchorPositionEvaluator::recordLastSuccessfulPositionOptions):
* Source/WebCore/style/AnchorPositionEvaluator.h:
* Source/WebCore/style/StyleScope.cpp:
(WebCore::Style::Scope::lastSuccessfulPositionOptionIndexFor):
(WebCore::Style::Scope::setLastSuccessfulPositionOptionIndexMap):
(WebCore::Style::Scope::forgetLastSuccessfulPositionOptionIndex):
* Source/WebCore/style/StyleScope.h:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::shouldInvalidateLastSuccessfulPositionOptionIndex):
(WebCore::Style::TreeResolver::styleForStyleable):
(WebCore::Style::TreeResolver::resolvePseudoElement):
(WebCore::Style::TreeResolver::generatePositionOptionsIfNeeded):
(WebCore::Style::TreeResolver::PositionOptions::currentOption const):
(WebCore::Style::TreeResolver::sortPositionOptionsIfNeeded):
(WebCore::Style::TreeResolver::tryChoosePositionOption):
(WebCore::Style::lastSuccessfulPositionTryFallbackIndex): Deleted.
* Source/WebCore/style/StyleTreeResolver.h:

Canonical link: https://commits.webkit.org/300890@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