Skip to content

Commit

Permalink
Bug 1921832 [wpt PR 48383] - Support :host:has(), a=testonly
Browse files Browse the repository at this point in the history
Automatic update from web-platform-tests
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:
- w3c/csswg-drafts#10693

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 'TreeBoundaryCrossing` invalidation-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 <bleeigalia.com>
Reviewed-by: Rune Lillesveen <futharkchromium.org>
Cr-Commit-Position: refs/heads/main{#1362877}

--

wpt-commits: b40c843d18efb71ab2f1343ce53e82d06cdf7702
wpt-pr: 48383

UltraBlame original commit: 7bd6a635665974228495e9f678104df70bdae688
  • Loading branch information
marco-c committed Oct 15, 2024
1 parent 0f6a4d0 commit 337384a
Show file tree
Hide file tree
Showing 2 changed files with 2,720 additions and 0 deletions.
Loading

0 comments on commit 337384a

Please sign in to comment.