[webkit-changes] [WebKit/WebKit] aafd67: [css-anchor-position-1] Properly handle anchor ele...
Kiet Ho
noreply at github.com
Fri Oct 11 11:30:27 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: aafd675c6a611d09090e6c575448a71778ead010
https://github.com/WebKit/WebKit/commit/aafd675c6a611d09090e6c575448a71778ead010
Author: Kiet Ho <kiet.ho at apple.com>
Date: 2024-10-11 (Fri, 11 Oct 2024)
Changed paths:
A LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-name-005-expected.html
A LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-name-005.html
A LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/reference/anchor-name-005-ref.html
M Source/WebCore/style/StyleTreeResolver.cpp
Log Message:
-----------
[css-anchor-position-1] Properly handle anchor elements with multiple anchor names
rdar://137567711
https://bugs.webkit.org/show_bug.cgi?id=281119
Reviewed by Antti Koivisto.
This fixes a bug where an anchor element with multiple anchor names can only
be referred to by the first name.
An element is an anchor element when it has one or more anchor names.
(e.g: `anchor-name: --a1, --a2, --a3`) During style resolution, if the
current element is an anchor, we perform the following logic to
register it:
for each anchor name of the element:
if this element is not in the known anchor element set:
add this element to the known anchor element set
[perform steps to register the anchor name]
This logic has a bug: on the first anchor name, the element is not in
the anchor set, so the first name is registered. On subsequent names,
the element is already in the set, so the names aren't registered.
Consequently, only the first anchor name is registered and can be
referred to by anchor().
This patches changes the logic to ensure all anchor names are registered
and could be used:
if this element is not in the known anchor element set:
add this element to the known anchor element set
for each anchor name of the element:
[perform steps to register the anchor name]
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-name-005-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-name-005.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/reference/anchor-name-005-ref.html: Added.
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::updateAnchorPositioningState):
Canonical link: https://commits.webkit.org/285030@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