Skip to content

Commit 30a0ef9

Browse files
lilleschromium-wpt-export-bot
authored andcommitted
[@container] Always create ContainerQueryEvaluator on demand
Creating them eagerly for size containers and lazily for style containers made the code confusing and hard to reason about. Also there was a bug with incorrect evaluation of style queries for size containers with unknown results for it size features. That is fixed by making sure we do not create ContainerQueryEvaluators without a MediaQueryEvaluator. Bug: 1450054 Change-Id: I9af679badaff645da3d2b20a816821a7d1b266f5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4567559 Reviewed-by: Anders Hartvoll Ruud <[email protected]> Commit-Queue: Rune Lillesveen <[email protected]> Cr-Commit-Position: refs/heads/main@{#1151733}
1 parent 0b432de commit 30a0ef9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<title>CSS Container Queries Test: style and size query against container without a principal box</title>
3+
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries">
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script src="support/cq-testcommon.js"></script>
7+
<style>
8+
#container {
9+
container-type: inline-size;
10+
display: contents;
11+
--foo: bar;
12+
}
13+
@container (width >= 0px) or style(--foo: bar) {
14+
#target { color: green; }
15+
}
16+
</style>
17+
<div id="container">
18+
<div id="target">Should be green</div>
19+
</div>
20+
<script>
21+
setup(() => assert_implements_container_queries());
22+
23+
test(() => {
24+
assert_equals(getComputedStyle(target).color, "rgb(0, 128, 0)");
25+
}, "width query should evaluate to unknown and style query to true");
26+
</script>

0 commit comments

Comments
 (0)