Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 218536cd505174b33e2df2d2031db1bc690ca595
      
https://github.com/WebKit/WebKit/commit/218536cd505174b33e2df2d2031db1bc690ca595
  Author: Kiet Ho <kiet...@apple.com>
  Date:   2025-02-28 (Fri, 28 Feb 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scope-basic-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scope-dynamic-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scope-shadow-flat-tree-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/parsing/anchor-scope-computed-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/parsing/anchor-scope-computed.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/parsing/anchor-scope-parsing-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/parsing/anchor-scope-parsing.html
    M Source/WTF/wtf/Forward.h
    M Source/WTF/wtf/ListHashSet.h
    M Source/WTF/wtf/text/TextStream.h
    M Source/WebCore/rendering/style/NameScope.h
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/style/AnchorPositionEvaluator.cpp
    M Source/WebCore/style/StyleBuilderConverter.h

  Log Message:
  -----------
  [css-anchor-position-1] Implement `anchor-scope`
rdar://129789606
https://bugs.webkit.org/show_bug.cgi?id=275449

Reviewed by Antti Koivisto.

This patch implements the logic for scoping anchor elements/queries using
anchor-scope. This is done by adding a condition to the anchor matching process:
if the anchor element is scoped by an ancestor element, the anchor positioned
element must also belong to the scope (i.e, the anchor and anchor-positioned
element are within the same subtree with the ancestor as the root).

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scope-basic-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scope-dynamic-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scope-shadow-flat-tree-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/parsing/anchor-scope-computed-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/parsing/anchor-scope-computed.html:
    - Add tests to check the order of identifiers in computed value
      matches the order in the declared value.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/parsing/anchor-scope-parsing-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/parsing/anchor-scope-parsing.html:
* Source/WTF/wtf/Forward.h:
    - Forward declare ListHashSet.

* Source/WTF/wtf/ListHashSet.h:
    - Don't declare a default value for template parameter, since it's now
      defined in the forward declaration in wtf/Forward.h

* Source/WTF/wtf/text/TextStream.h:
(WTF::operator<<):
    - Implement operator<<(TextStream ts, ) for ListHashSet.

* Source/WebCore/rendering/style/NameScope.h:
    - Use ListHashSet to represent the name list instead of Vector.
      This allows O(1) lookup, and ListHashSet also preserves the
      insertion order, so the computed order could match the
      original declared value.
(WebCore::operator==):
    - Implement custom equality comparison between NameScopes.
      This is needed because ListHashSet doesn't support operator==.

* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::rareDataChangeRequiresLayout):
    - Trigger layout if the anchor scope is different between RenderStyle.

* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::anchorScopeForAnchorElement):
    - Add function to locate ancestor that establishes an anchor scope
      affecting an anchor element.
(WebCore::Style::elementIsDescendantOfElementInComposedTree):
    - Add function to check if an element is a descendant of another element
      in the composed tree.
(WebCore::Style::isAcceptableAnchorElement):
    - Add anchor scope check.

* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertNameScope):
    - Change to accomodate the switch from Vector to ListHashSet.

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



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

Reply via email to