Re: [csswg-drafts] [css-color-5] Should colors nested in a parent color function (RCS, color-mix, light-dark, color-contrast) serialize in their most precision saving form (#10328)

@weinig @svgeesus 

> it seems quite unlikely that any content has come to depend on these edge cases in the time since this has been shipped. Ultimately, this is about serialization, and serialization is something that browsers have historically not aligned on very well so depending on specifics is pretty uncommon.

That's my intuition and hope as well, but there have been many surprises in the past on what existing content is dependent on.

> So, I am unsure what do do now. We have a WG resolution and WPT has been updated, but it results in a lot of failing tests. I also think the new behavior is better, but am reluctant to apply the agreed spec changes if we are going to have to back them out again.

Can we sit on the spec changes for a bit longer? I'm right now in the process of landing changes in Blink to support currentcolor in relative color syntax. Not far behind that will be a change to defer resolving all relative colors until used-value time, to align to the new test expectations. How well that change sticks should give us more data.

---

I also had one question on the new test expectations. For cases such as:

```js
fuzzy_test_valid_color(`${rgbFunction}(from rebeccapurple r calc(g * 2) 10)`, `rgb(from rebeccapurple r calc(2 * g) 10)`);
fuzzy_test_valid_color(`${rgbFunction}(from rebeccapurple b calc(r * .5) 10)`, `rgb(from rebeccapurple b calc(0.5 * r) 10)`);
fuzzy_test_valid_color(`${rgbFunction}(from rebeccapurple r calc(g * .5 + g * .5) 10)`, `rgb(from rebeccapurple r calc((0.5 * g) + (0.5 * g)) 10)`);
fuzzy_test_valid_color(`${rgbFunction}(from rebeccapurple r calc(b * .5 - g * .5) 10)`, `rgb(from rebeccapurple r calc((0.5 * b) - (0.5 * g)) 10)`);
```

The expectation has the order of terms in the `calc()` expressions flipped from what was specified. The new spec text refers to "calc() serializing in its simplified form" but looking at [Simplification in Values and Units 4](https://drafts.csswg.org/css-values-4/#calc-simplification) I didn't see anything that would cover changing the order of the terms like this. Is there spec text elsewhere about this? Or should the test harness be changed to accept any ordering?

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


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

Received on Tuesday, 3 September 2024 23:49:40 UTC