Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fada6de9d9a6463838ac524cff4d37f29fc18ed9
      
https://github.com/WebKit/WebKit/commit/fada6de9d9a6463838ac524cff4d37f29fc18ed9
  Author: Antti Koivisto <[email protected]>
  Date:   2026-05-10 (Sun, 10 May 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/has-in-is-non-subject-compound-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/has-in-is-non-subject-compound.html
    M Source/WebCore/style/RuleFeature.cpp

  Log Message:
  -----------
  [:has()] Invalidation fails with some complex nested cases with :is()
https://bugs.webkit.org/show_bug.cgi?id=314503
rdar://176719780

Reviewed by Alan Baradlay.

For rules like `#outer:is(:has(.test) .outer)`, where :has() sits in a
non-subject compound of an enclosing :is() argument, the has-bearer is
some ancestor of the :is() subject, not the :is() subject itself. The
scope selector built from outerCompoundSelectors + :has() peers
(`#outer` here) therefore points at the wrong element, and the
scope-bounded ancestor walk in StyleInvalidator skips the actual
has-bearer and misses invalidation entirely.

A related case is :is()/:not() appearing inside a :has() argument: those
peers describe descendants of the has-bearer (e.g. `.descendant` in
`.red:has(.descendant:is(.x .y))`) rather than ancestors and must not be
merged into the scope compound either.

Track combinator crossings in the current walk and add
hasInNonSubjectCompoundOfLogical, set at :has() entry when both
outerCompoundSelectors is non-empty and a combinator was crossed before
reaching :has(). When set, scope generation produces an empty (scope-
breaking) result so the invalidator falls through to a universal walk.
Also gate the outerCompoundSelectors append so :is()/:not() inside :has()
no longer pollutes the scope compound.

Test: 
imported/w3c/web-platform-tests/css/selectors/invalidation/has-in-is-non-subject-compound.html
* 
LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/has-in-is-non-subject-compound-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/has-in-is-non-subject-compound.html:
 Added.
* Source/WebCore/style/RuleFeature.cpp:
(WebCore::Style::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to