Re: [csswg-drafts] [css-color] Resolving color-mix() (#7302)

Another open question: what should we do for negative `calc` values? From https://w3c.github.io/csswg-drafts/css-values-4/#calc-range:

> Parse-time range-checking of values is not performed within [math functions](https://w3c.github.io/csswg-drafts/css-values-4/#math-function), and therefore out-of-range values do not cause the declaration to become invalid. However, the value resulting from an expression must be clamped to the range allowed in the target context. Clamping is performed on [computed values](https://w3c.github.io/csswg-drafts/css-cascade-5/#computed-value) to the extent possible, and also on [used values](https://w3c.github.io/csswg-drafts/css-cascade-5/#used-value) if computation was unable to sufficiently simplify the expression to allow range-checking. (Clamping is not performed on [specified values](https://w3c.github.io/csswg-drafts/css-cascade-5/#specified-value).)

This would mean that for something like `color-mix(in srgb, red calc(-10%), blue);`, `calc(-10%)` will get accepted, then clamped to zero, so the resulting color will be blue. This is what Firefox is doing, Safari rejects the input.




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


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

Received on Friday, 14 October 2022 15:25:23 UTC