Re: [csswg-drafts] [css-color-4] Computed value and serialization of `Infinity` and `NaN` in color functions (#8629)

What about for `rgb()`/`rgba()` values? I know that there was some discussion [here](https://github.com/w3c/csswg-drafts/issues/8444) stating that `rgb()` was de-facto bounded. 

Currently, Firefox does not parse non-finite inputs. Chromium and Safari do the following:

input: `rgb(calc(infinity), 0, 0)`
parsed: `rgb(255, 0, 0)`
computed: `rgb(255, 0, 0)`

Chrome and Safari also do this, which seems like _definitely_ a bug:

input: `rgb(calc(NaN), 0, 0)`
parsed: `rgb(255, 0, 0)`
computed: `rgb(255, 0, 0)`

Should the proper behavior be:

input: `rgb(calc(infinity), 0, 0)`
parsed: `rgb(calc(infinity), 0, 0)`
computed: `rgb(255, 0, 0)`
and
input: `rgb(calc(NaN), 0, 0)`
parsed: `rgb(calc(NaN, 0, 0)`
computed: `rgb(0, 0, 0)`

With -infinity going to zero as well? Also, what about for alpha channels, I would assume the following:

input: `rgba(0, 0, 0, calc(NaN))`
parsed: `rgba(0, 0, 0, calc(NaN))`
computed: `rgba(0, 0, 0, 0)`

input: `rgba(0, 0, 0, calc(infinity))`
parsed: `rgba(0, 0, 0, calc(infinity))`
computed: `rgb(0, 0, 0)` (fully opaque)

input: `rgba(0, 0, 0, calc(-infinity))`
parsed: `rgba(0, 0, 0, calc(-infinity))`
computed: `rgba(0, 0, 0, 0)`

Safari and Chrome turn `calc(NaN)` into fully opaque, at parse time. If I'm correct in all this I'll add some tests to WPT and to interop 2023.

-- 
GitHub Notification of comment by mysteryDate
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8629#issuecomment-1581131198 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 7 June 2023 16:07:43 UTC