Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b31aa95e64e1bff3b3dd2d9284579623dfbfbf46
      
https://github.com/WebKit/WebKit/commit/b31aa95e64e1bff3b3dd2d9284579623dfbfbf46
  Author: Kiet Ho <[email protected]>
  Date:   2025-03-21 (Fri, 21 Mar 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scope-basic-expected.txt
    M Source/WebCore/style/AnchorPositionEvaluator.cpp

  Log Message:
  -----------
  [css-anchor-position-1] Anchor element can establish an anchor scope 
containing itself
rdar://146986819
https://bugs.webkit.org/show_bug.cgi?id=289737

Reviewed by Antti Koivisto.

An anchor element can establish an anchor scope containing itself.

Given this document:

<div id="anchor" style="anchor-name: --foo; anchor-scope: --foo">
  <div id="anchor-positioned" style="position-anchor: --foo"></div>
</div>

Element #anchor is an anchor named --foo, and also establishes an anchor
scope for its descendants. Therefore #anchor-positioned can access --foo,
which is #anchor. However our current algorithm does not consider #anchor
to be the element establishing an anchor scope for #anchor, because we
only consider ancestors of #anchor.

This patch fixes the anchor scope resolution process by also considering
the anchor itself as the anchor scope before going up the ancestor chain.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scope-basic-expected.txt:
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::anchorScopeForAnchorElement):

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