mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-21 11:40:34 -10:00
Automatic update from web-platform-tests [@scope] Treat kScopeActivation as a special kSubSelector The internal selector relation kScopeActivation is inserted by the selector parser for selectors within @scope. This relation, when encountered in the selector, basically figures out if we're in scope [1], what the scoping roots are (there may be multiple), and tries to match the rest of the selector with context.scope set to those roots. However, kScopeActivation is not a combinator: it does not change the current element being considered for matching. In this respect, it's much like the kSubSelector relation. This CL treats it as such in SelectorChecker::MatchSelector, by skipping the combinator- related checks for exceeding the scope [2] and dynamic_pseudo matching (i.e. exactly the same as kSubSelector). I've moved the handling of kScopeActivation to a separate function (MatchForScopeActivation) to make it more clear that it's a special case (like MatchForSubSelector), and not like the other relations. This fixes a bug where selectors with pseudo-elements within @scope would match the originating element instead (due to missing dynamic_pseudo). [1] https://drafts.csswg.org/css-cascade-6/#in-scope [2] Although we already skipped this for kScopeActivation. Fixed: 335337303 Change-Id: I6f421c317c00efba5be8ca1407455f03e414a174 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5476369 Reviewed-by: Rune Lillesveen <[email protected]> Commit-Queue: Anders Hartvoll Ruud <[email protected]> Cr-Commit-Position: refs/heads/main@{#1291819} -- wpt-commits: e70c25a52544b0c1d140a2725526734a123a4f18 wpt-pr: 45846
77 lines
1.3 KiB
HTML
77 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<title>@scope - pseudo-elements</title>
|
|
<link rel="help" href="https://drafts.csswg.org/css-cascade-6/#scoped-styles">
|
|
<link rel="help" href="https://drafts.csswg.org/selectors-4/#link">
|
|
<link rel="match" href="scope-pseudo-element-ref.html">
|
|
|
|
<!-- Cosmetic -->
|
|
<style>
|
|
body > div {
|
|
display: inline-block;
|
|
width: 100px;
|
|
height: 100px;
|
|
border: 1px solid black;
|
|
vertical-align:top;
|
|
}
|
|
</style>
|
|
|
|
<!-- ::before -->
|
|
<style>
|
|
@scope (#before_test > main) {
|
|
:scope {
|
|
background-color: skyblue;
|
|
}
|
|
:scope::before {
|
|
content: "B";
|
|
width: 20px;
|
|
height: 20px;
|
|
display: inline-block;
|
|
background-color: tomato;
|
|
}
|
|
}
|
|
</style>
|
|
<div id=before_test>
|
|
<main>
|
|
Foo
|
|
</main>
|
|
</div>
|
|
|
|
<!-- ::after -->
|
|
<style>
|
|
@scope (#after_test > main) {
|
|
:scope {
|
|
background-color: skyblue;
|
|
}
|
|
:scope::after {
|
|
content: "A";
|
|
width: 20px;
|
|
height: 20px;
|
|
display: inline-block;
|
|
background-color: tomato;
|
|
}
|
|
}
|
|
</style>
|
|
<div id=after_test>
|
|
<main>
|
|
Foo
|
|
</main>
|
|
</div>
|
|
|
|
<!-- ::marker -->
|
|
<style>
|
|
@scope (#marker_test li) {
|
|
:scope {
|
|
background-color: skyblue;
|
|
}
|
|
:scope::marker {
|
|
content: "M";
|
|
}
|
|
}
|
|
</style>
|
|
<div id=marker_test>
|
|
<ul>
|
|
<li>One</li>
|
|
<li>Two</li>
|
|
</ul>
|
|
</div>
|