[wpt-sync] Sync PR 62570 - Add style query tests for powerless color components (CSS Color 4 step 1)
Categories
(Core :: CSS Parsing and Computation, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
(Blocks 1 open bug, )
Details
(Whiteboard: [wptsync downstream])
Attachments
(1 file)
|
261.65 KB,
text/plain
|
Details |
Sync web-platform-tests PR 62570 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/62570
Details from upstream follow.
Chris Lilley <chris@w3.org> wrote:
Add style query tests for powerless color components (CSS Color 4 step 1)
style()container queries on a custom property registered as<color>match when the two values are equivalent colors. Step 1 of that algorithm converts powerless components to missing components before anything is compared, so two colors that differ only in a powerless hue are equivalent.There is no existing coverage for this.
query-style-color.htmlcompares many spellings ofblackagainst each other, which exercises the sRGB grouping and the conversion to oklab in step 4, but every pair in it differs in notation. Nothing tests two colors in the same<color-space>whose hues differ but are powerless — which is precisely the case both engines currently get wrong.What the test covers
container queried expected why oklch(50% 0 40)oklch(50% 0 200)match chroma 0, hue powerless lch(50% 0.001 30)lch(50% 0.001 200)match chroma inside the ε of 0.0015 lch(50% 0.002 30)lch(50% 0.002 200)no match chroma above the ε — control hsl(0 0% 50%)hsl(200 0% 50%)match saturation 0, hue powerless hwb(30 60% 40%)hwb(200 60% 40%)match W + B = 100, hue powerless oklch(50% 0.2 40)oklch(50% 0.2 200)no match chromatic — control lch(50% 0.0015 30)lch(50% 0.0015 200)match chroma exactly the lch()εlch(50% 0.0016 30)lch(50% 0.0016 200)no match one step above that ε — control oklch(50% 0.000004 40)oklch(50% 0.000004 200)match chroma exactly the oklch()εhsl(0 0.001% 50%)hsl(200 0.001% 50%)match saturation exactly the hsl()εhwb(30 59.999% 40%)hwb(200 59.999% 40%)match W + B exactly the hwb()εThe
oklch()andlch()positive cases isolate step 1: both colors of each pair are in the same<color-space>, so neither the sRGB grouping nor step 4's conversion to oklab can produce the result. Thehsl()andhwb()cases are reachable by step 1 or by the sRGB grouping, since those notations are considered to be insrgb.The three negative controls keep the test from passing vacuously in an implementation that never matches anything, and the
lch()pair at 0.0015 and 0.0016 pins that ε from both sides.The epsilon is inclusive
The last subtests sit exactly on each space's ε. That is well defined: § 4.4.1 says a hue is powerless when the colorfulness "is less than or equal to the epsilon (ε) specified for that color space", matching the per-space tables —
hsl()S <= 0.001,hwb()W + B >= 99.999,lch()C <= 0.0015,oklch()C <= 0.000004. The prose previously read "is less than the epsilon", which contradicted the tables at exactly ε; that was fixed in https://github.com/w3c/csswg-drafts/commit/18434b34.
hwb(30 59.999% 40%)relies on the sum, so it is worth noting that 59.999 + 40 is exactly 99.999 in IEEE 754 doubles — the subtest does not depend on rounding going a particular way.Current results
Measured on Edge 152 (Chromium) and Firefox Nightly 157: 3 pass, 8 fail in each, agreeing on every subtest. The three that pass are the negative controls; every positive subtest fails. The failures are interoperable, so this is not a case of one engine lagging another: step 1 appears unimplemented in both.
Filed against implementations:
- Chromium: https://issues.chromium.org/issues/559142618
- Gecko: https://bugzilla.mozilla.org/show_bug.cgi?id=2070595
Related
query-style-color.html, added for https://github.com/w3c/csswg-drafts/issues/13157- CSS Color 4 § 12, § 4.4.1
🤖 Generated with Claude Code
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 1•2 months ago
|
||
CI Results
Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 319 tests
Status Summary
Firefox
OK : 1[GitHub] 16[Gecko-windows11-32-25h2-opt] 207[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 3[GitHub] 62[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 128[Gecko-windows11-32-25h2-opt] 1252[Gecko-windows11-32-25h2-debug] 1290[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 1292[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt] 1299[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview]
FAIL: 6[GitHub] 9[Gecko-windows11-32-25h2-opt] 241[Gecko-windows11-32-25h2-debug] 243[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview] 250[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt] 252[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
Chrome
OK : 1
PASS: 3
FAIL: 6
Safari
OK : 1
PASS: 5
FAIL: 4
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
(See attachment for full changes)
Comment 3•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/fc3b4a583a5c
https://hg.mozilla.org/mozilla-central/rev/28056025c3d2
Comment 4•2 months ago
|
||
| bugherder | ||
Description
•