[@container] Inheritance propagation lost at style query change
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 <futhark@chromium.org>
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1149034}
diff --git a/css/css-contain/container-queries/style-container-invalidation-inheritance.html b/css/css-contain/container-queries/style-container-invalidation-inheritance.html
new file mode 100644
index 0000000..b7aef69
--- /dev/null
+++ b/css/css-contain/container-queries/style-container-invalidation-inheritance.html
@@ -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>