Skip to content

Commit

Permalink
[@container] style() query unset on root element crashes
Browse files Browse the repository at this point in the history
Discovered when trying to fix issue 376834363.

StyleResolver::ComputeValue() does not set up a parent style for the
root element which meant applying unset would crash. There was already a
check for inherit. Do the same for unset.

Bug: 376834363
Change-Id: I075dd462668436f98a6f7924929f5baba6eeba09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5999996
Commit-Queue: Rune Lillesveen <[email protected]>
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1379181}
  • Loading branch information
Rune Lillesveen authored and chromium-wpt-export-bot committed Nov 6, 2024
1 parent 3a14200 commit 92228c4
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<title>CSS Container Queries Test: query unset style for custom property on :root should always match</title>
<link rel="help" href="https://drafts.csswg.org/css-conditional-5/#style-container">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/cq-testcommon.js"></script>
<style>
:root { container-name: --root; }
@container --root style(--foo: unset) {
#target { color: green; }
}
</style>
<div id="target"></div>
<script>
setup(() => assert_implements_style_container_queries());

test(() => {
assert_equals(getComputedStyle(target).color, "rgb(0, 128, 0)");
}, "Match style(--foo: unset) on :root element");
</script>

0 comments on commit 92228c4

Please sign in to comment.