Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4d7e3112bb6a8f7b2e579cd9680bb4e7c91f61bb
https://github.com/WebKit/WebKit/commit/4d7e3112bb6a8f7b2e579cd9680bb4e7c91f61bb
Author: Anne van Kesteren <[email protected]>
Date: 2026-09-16 (Wed, 16 Sep 2026)
Changed paths:
M LayoutTests/TestExpectations
A LayoutTests/fast/shadow-dom/host-featureless-matching-expected.txt
A LayoutTests/fast/shadow-dom/host-featureless-matching-no-jit-expected.txt
A LayoutTests/fast/shadow-dom/host-featureless-matching-no-jit.html
A LayoutTests/fast/shadow-dom/host-featureless-matching.html
A LayoutTests/fast/shadow-dom/resources/host-featureless-matching.js
A
LayoutTests/imported/w3c/web-platform-tests/css/selectors/featureless-006-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/selectors/featureless-006.html
A
LayoutTests/imported/w3c/web-platform-tests/css/selectors/featureless-007-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/selectors/featureless-007.html
M LayoutTests/imported/w3c/web-platform-tests/css/selectors/w3c-import.log
M Source/WebCore/css/SelectorChecker.cpp
M Source/WebCore/style/ElementRuleCollector.cpp
M Source/WebCore/style/RuleSet.cpp
M Source/WebCore/style/RuleSet.h
Log Message:
-----------
Improve :host selector matching
https://bugs.webkit.org/show_bug.cgi?id=283062
rdar://140284766
Reviewed by Antti Koivisto.
The shadow host is featureless when matched from inside its own shadow tree: it
only matches selectors it is explicitly allowed to match. checkOne() let
functional pseudo-classes through so that :is(:host) works, but excluded :not()
entirely, so :not(:not(:host)) never matched the host.
Whether a selector is allowed to match a featureless element depends on the
selector alone, not on what it matched. That is what separates :not(:not(:host))
from :not(.foo:host) and :not(:host > .foo). The latter two never match, even
though the host has no such class and is not its own descendant. So add a
predicate over the selector and use it to gate :not(). Negation is the only
place
it is needed, since it is the only place a nested failure becomes a success.
matchHostPseudoClassRules() collected the whole universal bucket whenever any
rule in the RuleSet mentioned :host or :scope, so rules that can never match the
host were matched against it, and did match: neither the rule hash shortcut nor
a
compiled selector implements featureless matching. A rule can only match the
host
if its own subject compound contains :host or :scope, so keep just those in
their
own vector and collect that instead. That is less work per shadow host, and it
means nothing reaching either of those two paths can match on bucket membership
or compile, which is now asserted.
Tests: fast/shadow-dom/host-featureless-matching-no-jit.html
fast/shadow-dom/host-featureless-matching.html
imported/w3c/web-platform-tests/css/selectors/featureless-006.html
imported/w3c/web-platform-tests/css/selectors/featureless-007.html
Tests upstream: https://github.com/web-platform-tests/wpt/pull/62706
Canonical link: https://commits.webkit.org/321263@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications