Skip to content

Commit 34637df

Browse files
emiliomoz-wptsync-bot
authored andcommitted
Propagate allowed to support color components in math functions.
Thanks to the recent changes by Sajid and the changes in bug 2043078, which make color components properly return numbers for type-checking purposes, this is now trivial. We could add an "allowed but only numbers" or so, but type checking will basically deal with it (in fact we should probably allow parsing ~everything all the time and rely on unit() doing the type-checking). Differential Revision: https://phabricator.services.mozilla.com/D303375 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1951206 gecko-commit: 84b5d08285154e0c7b1feb1604dc5302ca2ae024 gecko-commit-git: 8a7d2d52762439c5a429d6a73e0c272046d309e2 gecko-reviewers: sajidanwar
1 parent 7e268df commit 34637df

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

css/css-color/parsing/color-computed-relative-color.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,16 @@
893893
fuzzy_test_computed_color(`var(--mygray)`, `lch(62.75 0 326.96)`, 0.02);
894894
fuzzy_test_computed_color(`lch(from var(--mygray) l 30 h)`, `lch(62.75 30 326.96)`, 0.02);
895895
fuzzy_test_computed_color(`LCH(from var(--accent) l c calc(h + 180 * sibling-index()))`, `lch(65.49 39.45 10.11)`, 0.02);
896+
897+
// https://github.com/w3c/csswg-drafts/issues/13938
898+
fuzzy_test_computed_color(`hsl(from hsl(200 50 50) h s calc(l + sin(3) * 100))`, `color(srgb 0.46168 0.700933 0.82056)`);
899+
fuzzy_test_computed_color(`hsl(from hsl(200 50 50) h s calc(sin(pi / 4) * 100))`, `color(srgb 0.56066 0.755922 0.853553)`);
900+
fuzzy_test_computed_color(`hsl(from hsl(200 50 50) h s calc((sin(50) + 2) * 20))`, `color(srgb 0.173763 0.405446 0.521288)`);
901+
fuzzy_test_computed_color(`hsl(from hsl(200 50 50) h s calc((sin(l) + 2) * 20))`, `color(srgb 0.173763 0.405446 0.521288)`);
902+
fuzzy_test_computed_color_using_currentcolor(`hsl(from currentColor h s calc((sin(l) + 2) * 20))`, `color(srgb 0.173763 0.405446 0.521288)`, `hsl(200 50 50)`);
903+
904+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1951206
905+
fuzzy_test_computed_color(`oklch(from green pow(l, 1) c h)`, `oklch(0.519752 0.176858 142.4953)`);
896906
</script>
897907
</body>
898908
</html>

0 commit comments

Comments
 (0)