Re: [csswg-drafts] [css-typed-om-1][css-syntax-3][css-values-4] Clarify interaction between CSSNumericValue.parse() and `simplify a calculation tree` (#9870)

Would this mean that [`reify a math expression`](https://drafts.css-houdini.org/css-typed-om/#reify-a-math-expression) would have to be reworked, or could one add a final step that calls `simplify a calculation tree`? 

Either would hopefully solve the issue for math function color components, like in the example below. [Reifying](https://drafts.css-houdini.org/css-typed-om/#reify-a-numeric-value) the numeric color component would call the updated `reify a math expression` that would simplify the result.
```css
CSSColorValue.parse('rgb(calc(255 - 128), 127, 127)')
```

I don't think it would solve percentage color components though. These too seem to simplify in Chrome Beta, resolving the percentage against the [percent reference range](https://drafts.csswg.org/css-color-4/#rgb-functions).
```css
CSSColorValue.parse('rgb(100%, 100%, 100%)')
```

A solution could be to treat each color component as if it were the contents of a calc() expression, similar to how the `min()` and `max()`functions are reified: 
> Let values be the result of [reifying](https://drafts.css-houdini.org/css-typed-om/#reify-a-math-expression) the arguments to the expression, treating each argument as if it were the contents of a [calc()](https://drafts.csswg.org/css-values-4/#funcdef-calc) expression.

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


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

Received on Thursday, 10 July 2025 18:45:51 UTC