From 1a1f712325a416d47b92c59e7e09efec681eb21c Mon Sep 17 00:00:00 2001 From: Anders Hartvoll Ruud Date: Wed, 22 Feb 2023 08:24:58 -0800 Subject: [PATCH] [@scope] Support @scope (:host) In CalculateActivations, we'd previously just call Element.parentElement up the ancestor chain, therefore never reach the host. Additionally, we did not propagate the original SelectorCheckerContext.scope which is needed for :host to match. This CL uses ParentOrShadowHostElement, and adds the concept of "activation ceiling" to deal with the fact that we need to look at one element *above* the current activation root when that root is a ShadowRoot. Note that :scope is supposed to be able to match "virtual" roots [1] (like a ShadowRoot), but Blink does not support this in general. This CL does not address this issue. [1] https://github.com/w3c/csswg-drafts/issues/7261 Bug: 1280240 Change-Id: I2d0be103f4cd02ec576711b959e075a5118e694a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4272396 Commit-Queue: Anders Hartvoll Ruud Reviewed-by: Rune Lillesveen Cr-Commit-Position: refs/heads/main@{#1108363} --- css/css-cascade/scope-shadow.html | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 css/css-cascade/scope-shadow.html diff --git a/css/css-cascade/scope-shadow.html b/css/css-cascade/scope-shadow.html new file mode 100644 index 00000000000000..6083e08b4ccaa4 --- /dev/null +++ b/css/css-cascade/scope-shadow.html @@ -0,0 +1,60 @@ + +@scope - ShadowDOM + + + + + +
+ +
+ + +
+ +
+