github web-platform-tests/wpt merge_pr_48383

latest releases: merge_pr_49470, epochs/three_hourly/2024-12-03_06H, epochs/six_hourly/2024-12-03_06H...
11 months ago

Support :host:has()

Support :host:has() case to check whether a shadow host element has a
relationship between its shadow root node and shadow tree element:

Normally, :has() checks relationship between its anchor element and
the other elements in the same tree.

But in :host:has() case, :has() checks relationship in the shadow
tree of the anchor element. For example, :host(.a):has(> div)
matches a shadow host element if the host has a class value and the
shadow root of the host has a child div element.

To cross tree boundary for testing selector and invalidating styles,
this CL adds 'HasArgumentMatchInShadowTree' flag to the CSSSelector and
sets the flag while parsing selectors.

SelectorChecker and CheckPseudoHasArgumentTraversalIterator cross tree
boundary for :has() argument test traversal if the flag is set.

RuleInvalidationDataVisitor sets 'TreeBoundaryCrossinginvalidation-set flag for non-subject:has()` if the flag is set.

If StyleEngine reaches to a shadow host element while performing :has()
invalidation, it invalidates the host element if the host is affected by
:has() state change.

Bug: 359758910
Change-Id: I69f0813deca4caefcff1f0b5ff8181ba67967a40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5839398
Commit-Queue: Byungwoo Lee blee@igalia.com
Reviewed-by: Rune Lillesveen futhark@chromium.org
Cr-Commit-Position: refs/heads/main@{#1362877}

Don't miss a new wpt release

NewReleases is sending notifications on new releases.