Skip to content

Commit

Permalink
[@container] Inheritance propagation lost at style query change
Browse files Browse the repository at this point in the history
Based modified the StyleRecalcChange on style query evaluation changes
instead of the child_change that captured the change from
RecalcOwnStyle.

Base on child_change instead.

Bug: 1445876
Change-Id: I2e064b03c2ef3f823cc51a7f733bf04ab2574b59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4565675
Commit-Queue: Rune Lillesveen <[email protected]>
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1149034}
  • Loading branch information
Rune Lillesveen authored and chromium-wpt-export-bot committed May 25, 2023
1 parent 9079b57 commit 414a38c
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<title>CSS Container Query Test: named style container query change with inherited custom property</title>
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-rule">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/cq-testcommon.js"></script>
<style>
#container {
container-name: container;
}
.match {
--match: true;
}
#inner {
color: red;
}
@container container style(--match: true) {
#inner {
color: green;
}
}
</style>
<div id="container">
<div id="outer">
<div id="inner"></div>
</div>
</div>
<script>
setup(() => assert_implements_container_queries());

test(() => {
assert_equals(getComputedStyle(inner).color, "rgb(255, 0, 0)");
assert_equals(getComputedStyle(inner).getPropertyValue("--match"), "");
assert_equals(getComputedStyle(outer).getPropertyValue("--match"), "");
assert_equals(getComputedStyle(container).getPropertyValue("--match"), "");
}, "Pre-conditions");

test(() => {
container.className = "match";
assert_equals(getComputedStyle(inner).color, "rgb(0, 128, 0)");
assert_equals(getComputedStyle(inner).getPropertyValue("--match"), "true");
assert_equals(getComputedStyle(outer).getPropertyValue("--match"), "true");
assert_equals(getComputedStyle(container).getPropertyValue("--match"), "true");
}, "Changed --match inherits down descendants and affects container query");
</script>

0 comments on commit 414a38c

Please sign in to comment.