w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.36k stars 641 forks source link

[css-color][css-values] Should calc(NaN) and calc(infinity) be serialized as part of the CSS colors #10424

Open weinig opened 4 weeks ago

weinig commented 4 weeks ago

There are a few tests that require calc(NaN) and calc(infinity)/calc(-infinity) to be serialized as part of a color value.

For instance in css/css-color/parsing/color-valid-color-function.html:

    test_valid_value("color", `color(${colorSpace} 0 calc(infinity) 0)`, `color(${colorSpace} 0 calc(infinity) 0)`);

and

    test_valid_value("color", `color(${colorSpace} calc(NaN) 0 0)`, `color(${colorSpace} calc(NaN) 0 0)`);

From my reading of https://drafts.csswg.org/css-values/#calc-ieee, it seems like NaN and infinity should never "escape" top-level calculation, and should be censored to 0.

I am not entirely sure what "escape" means though, so I am not sure what is correct.

@tabatkins @fantasai , can one of you shed light on this?

cdoublev commented 4 weeks ago

This was also my understanding before this https://github.com/w3c/csswg-drafts/issues/8629#issuecomment-1480092533.