Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support :host:has() #48383

Merged
merged 1 commit into from
Oct 2, 2024
Merged

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Sep 30, 2024

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 <[email protected]>
Reviewed-by: Rune Lillesveen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1362877}

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 <[email protected]>
Reviewed-by: Rune Lillesveen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1362877}
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot merged commit b40c843 into master Oct 2, 2024
19 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-5839398 branch October 2, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants