Re: [csswg-drafts] Can we reinstate `<number-percentage>` and friends? (#9955)

The [type arithmetic](https://drafts.css-houdini.org/css-typed-om-1/#numeric-typing) doesn't allow `<number-percentage>`, so we will never allow a calc tree that adds a number to a percentage.

On the other hand, the usage in the examples looks totally legit, because there's a clear context that the percentages should be resolved into numbers.

So can we solve it at parsing time? We introduce a treat-percentage-as-number mode for parsing certain `<number>` values (like a color channel), so that percentages are immediately converted into numbers at parsing time, and we never really create a `<number-percentage>` value. This also follows the idea of [calc simplification](https://www.w3.org/TR/css-values-4/#calc-simplification) that calc expressions are eagerly simplified at the earliest possible time.

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


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

Received on Tuesday, 20 February 2024 03:53:18 UTC