Skip to content

Commit f46909d

Browse files
jfkthamemoz-wptsync-bot
authored andcommitted
Add a few equality tests for colors that include 'none' components.
Differential Revision: https://phabricator.services.mozilla.com/D293501 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=2030624 gecko-commit: 1a669761ca71aa9d801213e78c6fa08e14bf8476 gecko-commit-git: 3a382100c8038ca8810121c348d9c73f093c1b5d gecko-reviewers: firefox-style-system-reviewers, dshin
1 parent 22a83e8 commit f46909d

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

css/css-conditional/container-queries/query-style-color-ref.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,13 @@
5454
<div style="--c: oklch(0 0 0)"></div>
5555
<div style="--c: oklab(from black l a b)"></div>
5656
</div>
57+
<hr>
58+
<div class="outer">
59+
<div style="--c: hwb(none 0 100)"></div>
60+
<div style="--c: hsl(none 0 0)"></div>
61+
<div style="--c: color(srgb none 0 0)"></div>
62+
<div style="--c: color(srgb-linear 0 none 0)"></div>
63+
<div style="--c: oklch(0 0 none)"></div>
64+
<div style="--c: oklab(0 none none)"></div>
65+
</div>
5766
</body>

css/css-conditional/container-queries/query-style-color.html

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
font-family: system-ui, sans-serif;
1919
}
2020

21-
.outer {
21+
.outer,
22+
.outer-ne {
2223
display: grid;
2324
grid-template-columns: repeat(auto-fill, minmax(20em, 1fr));
2425
gap: .5em;
2526
}
2627

27-
.outer div {
28+
.outer div,
29+
.outer-ne div {
2830
border-left: 1em solid var(--c);
2931
color: white;
3032
}
@@ -41,11 +43,25 @@
4143
background: green;
4244
}
4345
}
46+
47+
.outer-ne div::before {
48+
content: attr(style);
49+
display: block;
50+
padding: .5em;
51+
background: green;
52+
}
53+
54+
@container style(--c: black) {
55+
.outer-ne div::before {
56+
background: red;
57+
}
58+
}
4459
</style>
4560

4661
<body>
4762
<p>All items should have a green background:</p>
4863
<div class="outer">
64+
<!-- All the colors here should "equal" black. -->
4965
<div style="--c: black"></div>
5066
<div style="--c: #000"></div>
5167
<div style="--c: #000f"></div>
@@ -65,4 +81,15 @@
6581
<div style="--c: oklch(0 0 0)"></div>
6682
<div style="--c: oklab(from black l a b)"></div>
6783
</div>
84+
<hr>
85+
<div class="outer-ne">
86+
<!-- Although these render as black, they are not considered equal to it,
87+
so the container-style query to set a red background does NOT apply. -->
88+
<div style="--c: hwb(none 0 100)"></div>
89+
<div style="--c: hsl(none 0 0)"></div>
90+
<div style="--c: color(srgb none 0 0)"></div>
91+
<div style="--c: color(srgb-linear 0 none 0)"></div>
92+
<div style="--c: oklch(0 0 none)"></div>
93+
<div style="--c: oklab(0 none none)"></div>
94+
</div>
6895
</body>

0 commit comments

Comments
 (0)