Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3c4400d8165838b1ae3e2ae72d77f0595875fe0c
https://github.com/WebKit/WebKit/commit/3c4400d8165838b1ae3e2ae72d77f0595875fe0c
Author: Antti Koivisto <[email protected]>
Date: 2026-05-21 (Thu, 21 May 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/css/css-values/attr-pseudo-elem-invalidation-2-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-values/attr-pseudo-element-originating-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-values/attr-pseudo-element-originating.html
M Source/WebCore/style/AttributeChangeInvalidation.cpp
M Source/WebCore/style/RuleFeature.cpp
M Source/WebCore/style/RuleFeature.h
M Source/WebCore/style/StyleBuilderState.cpp
M Source/WebCore/style/StyleBuilderState.h
M Source/WebCore/style/StyleResolver.cpp
M Source/WebCore/style/StyleSubstitutionResolver.cpp
Log Message:
-----------
[css-values-5 attr()] Support pseudo-elements with non-trivial originating
element
https://bugs.webkit.org/show_bug.cgi?id=315263
rdar://177595332
Reviewed by Anne van Kesteren.
CSS Values 5 ยง8.7: "If [attr()] is applied to a pseudo-element, the
attribute is looked up on the pseudo-element's originating element."
For pseudo-element rules cascading from outside the styled element's tree
scope (::part() across one or more open shadow boundaries, document
author rules matching UA-shadow pseudos like ::placeholder,
::file-selector-button, ::details-content), the styled element is a
shadow descendant rather than the rule's match target. The attribute
lookup landed on the shadow node, which has no author attributes, so
the substitution always failed and never reflected attribute changes on
the host.
Resolve the originating element from the property's style scope ordinal
(re-using the existing hostForScopeOrdinal walk, which already handles
deep ::part() across exportparts). Extend
BuilderState::registerSubstitutionAttribute with an optional target
scope so the substitution dependency is registered on the originating
element's resolver, not just the resolver running this resolution; and
extend AttributeChangeInvalidation to invalidate the host's shadow
subtree when a substitution-referenced attribute changes on the host.
Spec: https://drafts.csswg.org/css-values-5/#funcdef-attr
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/attr-pseudo-elem-invalidation-2-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/attr-pseudo-element-originating-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/attr-pseudo-element-originating.html:
Added.
* Source/WebCore/style/AttributeChangeInvalidation.cpp:
(WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
* Source/WebCore/style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::registerSubstitutionAttribute):
* Source/WebCore/style/StyleBuilderState.h:
* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::setGlobalStateAfterApplyingProperties):
* Source/WebCore/style/StyleSubstitutionResolver.cpp:
(WebCore::Style::SubstitutionResolver::substituteAttrFunction):
Canonical link: https://commits.webkit.org/313684@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications