[webkit-changes] [WebKit/WebKit] f16c26: [css-anchor-position-1] Support ::before/::after a...

Antti Koivisto noreply at github.com
Wed Oct 16 02:45:42 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f16c267dbdee11b9090e666477a9fd5dd57756f6
      https://github.com/WebKit/WebKit/commit/f16c267dbdee11b9090e666477a9fd5dd57756f6
  Author: Antti Koivisto <antti at apple.com>
  Date:   2024-10-16 (Wed, 16 Oct 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/pseudo-element-anchor-dynamic-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/pseudo-element-anchor-expected.txt
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBoxModelObject.cpp
    M Source/WebCore/rendering/RenderBoxModelObject.h
    M Source/WebCore/rendering/RenderView.cpp
    M Source/WebCore/rendering/RenderView.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

  Log Message:
  -----------
  [css-anchor-position-1] Support ::before/::after as anchors
https://bugs.webkit.org/show_bug.cgi?id=281509
rdar://137975699

Reviewed by Alan Baradlay.

Also simplify the data structures and logic.

* LayoutTests/TestExpectations:

Scrolling feature is not implemented yet, passes were not real.

* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/pseudo-element-anchor-dynamic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/pseudo-element-anchor-expected.txt:
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::willBeDestroyed):
(WebCore::RenderBox::styleWillChange):
* Source/WebCore/rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::styleWillChange):

Refactor to track anchors as RenderBoxModelObjects instead of Elements.
Register and unregister anchors.

* Source/WebCore/rendering/RenderBoxModelObject.h:
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::registerAnchor):
(WebCore::RenderView::unregisterAnchor):
* Source/WebCore/rendering/RenderView.h:
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::AnchorPositionEvaluator::evaluate):

Remove FinishedCollectingAnchorNames state which is not needed.
Add name from position-anchor property here too.

(WebCore::Style::penultimateContainingBlockChainElement):
(WebCore::Style::isAcceptableAnchorElement):
(WebCore::Style::findLastAcceptableAnchorWithName):
(WebCore::Style::collectAnchorsForAnchorName):

Build a temporary map of anchor names using currently registered anchors.

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

Move the state update code from TreeResolver here.

* Source/WebCore/style/AnchorPositionEvaluator.h:
* Source/WebCore/style/StyleScope.cpp:

Remove anchor maps. AnchorPositioningState is the only persistent state now.
This will make invalidation etc easier.

(WebCore::Style::Scope::clearAnchorPositioningState):
* Source/WebCore/style/StyleScope.h:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolve):

If we have performanced an interleaved layout update the anchor states.

(WebCore::Style::TreeResolver::updateAnchorPositioningState):

Almost nothing needs to be done here now.
We also avoid one unnecessary resolution round.

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