[webkit-changes] [WebKit/WebKit] 5f0104: Add style and layout interleaving for `anchor()`
David Choi
noreply at github.com
Mon Jul 1 11:15:53 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5f0104f4e2cd965e5622fb88090d7425bc464801
https://github.com/WebKit/WebKit/commit/5f0104f4e2cd965e5622fb88090d7425bc464801
Author: David Choi <davidchoi1027 at gmail.com>
Date: 2024-07-01 (Mon, 01 Jul 2024)
Changed paths:
M Source/WebCore/Headers.cmake
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/css/CSSAnchorValue.cpp
M Source/WebCore/css/CSSAnchorValue.h
M Source/WebCore/css/CSSPrimitiveValue.h
M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/dom/Element.cpp
M Source/WebCore/dom/Element.h
M Source/WebCore/page/LocalFrameViewLayoutContext.cpp
A Source/WebCore/style/AnchorPositionEvaluator.cpp
A Source/WebCore/style/AnchorPositionEvaluator.h
M Source/WebCore/style/MatchedDeclarationsCache.cpp
M Source/WebCore/style/StyleBuilderConverter.h
M Source/WebCore/style/StyleResolver.cpp
M Source/WebCore/style/StyleScope.h
M Source/WebCore/style/StyleTreeResolver.cpp
M Source/WebCore/style/StyleTreeResolver.h
Log Message:
-----------
Add style and layout interleaving for `anchor()`
https://bugs.webkit.org/show_bug.cgi?id=275938
rdar://130642534
Reviewed by Antti Koivisto.
This patch introduces an initial implementation of style and layout
interleaving for anchor positioning. For each anchor-positioned element,
we perform a layout to get its containing block, then bounce back to
style resolution to determine its anchors, and then finally attempt
to resolve the element with another style resolution.
The actual resolution of `anchor()` is not implemented yet, (this patch
is a precursor for its implementation). As a result, there are no
behavioral changes.
This patch also is not fully spec-compliant when finding anchors for
each anchor-positioned element. It only attempts to find the last
anchor element in tree order with a matching anchor name. Further
patches will build on this patch to correctly determine anchors and
actually resolve anchor-positioned elements.
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/css/CSSAnchorValue.cpp:
(WebCore::CSSAnchorValue::collectAnchorNames const):
* Source/WebCore/css/CSSAnchorValue.h:
* Source/WebCore/css/CSSPrimitiveValue.h:
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeAnchor):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::resolveStyle):
(WebCore::Document::isInStyleInterleavedLayoutForSelfOrAncestor const):
* Source/WebCore/dom/Document.h:
(WebCore::Document::isInStyleInterleavedLayout const):
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::invalidateAncestorsForAnchor):
(WebCore::Element::invalidateForResumingAnchorPositionedElementResolution):
* Source/WebCore/dom/Element.h:
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::performLayout):
(WebCore::LocalFrameViewLayoutContext::runOrScheduleAsynchronousTasks):
* Source/WebCore/style/AnchorPositionEvaluator.cpp: Added.
(WebCore::Style::AnchorPositionEvaluator::resolveAnchorValue):
* Source/WebCore/style/AnchorPositionEvaluator.h: Added.
* Source/WebCore/style/MatchedDeclarationsCache.cpp:
(WebCore::Style::MatchedDeclarationsCache::isCacheable):
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertLength):
* Source/WebCore/style/StyleResolver.cpp:
* Source/WebCore/style/StyleScope.h:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::popParent):
(WebCore::Style::TreeResolver::resolveComposedTree):
(WebCore::Style::TreeResolver::resolve):
(WebCore::Style::TreeResolver::updateAnchorPositioningState):
(WebCore::Style::TreeResolver::findAnchorsForAnchorPositionedElement):
(WebCore::Style::elementIsInContainingBlockChain):
(WebCore::Style::TreeResolver::findLastAcceptableAnchorWithName):
(WebCore::Style::TreeResolver::updateAnchorPositioningStateInInitialContainingBlock):
* Source/WebCore/style/StyleTreeResolver.h:
(WebCore::Style::TreeResolver::hasUnresolvedAnchorPositionedElements const):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:
Canonical link: https://commits.webkit.org/280543@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list