Skip to content

Commit

Permalink
[@scope] Add parent @scope rules as implicit scope triggers
Browse files Browse the repository at this point in the history
We keep a list of "implicit scope triggers" on Element, which represents
which implicit StyleScope objects will be activated inside that element.
This triggers are added from StyleScopes seen on the RuleSet, but we
currently only consider StyleScopes that *directly* hold on to at least
one style rule. This means any implicit parent @scope rules without
any style rules of their own won't be considered.

Fixed by traversing the StyleScope chain during
ForEachImplicitScopeTrigger.

Fixed: 364913801
Change-Id: I451767efbf939747d21d12275c8ef91fadc9f54b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6031030
Commit-Queue: Anders Hartvoll Ruud <[email protected]>
Reviewed-by: Rune Lillesveen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1384321}
  • Loading branch information
andruud authored and chromium-wpt-export-bot committed Nov 18, 2024
1 parent bd9c53c commit fb6c27f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions css/css-cascade/scope-implicit.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,30 @@
assert_equals(getComputedStyle(outer).zIndex, '3');
}, 'Proximity calculation of multiple implicit @scope');
</script>

<!-- https://issues.chromium.org/issues/377647716 -->
<template id=test_implicit_sandwich>
<div id=outer>
<div class=foo>
<style>
@scope (#outer) {
@scope {
@scope (#inner) {
:scope {
z-index: 1;
}
}
}
}
</style>
<div id=inner></div>
</div>
</div>
</template>
<script>
test((t) => {
t.add_cleanup(() => main.replaceChildren());
main.append(test_implicit_sandwich.content.cloneNode(true));
assert_equals(getComputedStyle(inner).zIndex, '1');
}, 'Implicit @scope sandwiched between non-implicit scopes');
</script>

0 comments on commit fb6c27f

Please sign in to comment.