[csswg-drafts] [css-values-4] Abandon mix()? (#9343)

andruud has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values-4] Abandon mix()? ==
From https://github.com/w3c/csswg-drafts/issues/6245#issuecomment-930355155:

> <TabAtkins> smfr: Would this be like a calc()?
<TabAtkins> fantasai: Like, but wider.
<fantasai> fantasai: It has to be able to interpolate every possible computed value in the entire space of CSS
<TabAtkins> smfr: **It requires UAs to have a parallel version of calc trees, for every possible value**
<TabAtkins> fantasai: You kinda already have that since everything can interp
<TabAtkins> fantasai: Like, how do you interp between currentcolor and blue? No way to represent that right now. (color-mix() is coming, but this is a wider issue)
<TabAtkins> fantasai: So we have lots of places where we want to interp things that don't have intermediate values
<TabAtkins> smfr: That makes sense, we also invented cross-fade() to hit the image case
<TabAtkins> smfr: **I'd like to hear from other impls about their thoughts on impl complexity**, and whether it makes sense to think of it in terms of calc()

(cc @smfr)

If my understanding is correct, `mix()` as currently defined is asking for way too much for not nearly enough benefit.

> It has to be able to interpolate every possible computed value in the entire space of CSS

This would indeed require that _any_ computed value that we currently store in a space-efficient manner now needs to deal with the possibility of being a _function_ instead, which then needs to be interpreted further used-value time (@bfgeek). This is _probably_ a non-starter, but it also doesn't seem that necessary. E.g. do we really need to be able to represent `display: mix(inline; block; 50%)` as a computed value when no meaningful mix between inline/block exists (I hope)?

The current path we're on elsewhere in CSS, with type-specific mix functions (`color-mix`, `font-palette-mix`) seems way more sensible:

 - There are no issues with "must be sole value" or other weirdness.
   - https://github.com/w3c/csswg-drafts/issues/9341
   - https://github.com/w3c/csswg-drafts/issues/9342
 - They can support detailed interpolation behavior (e.g. interpolation a given color space). Only a matter of time until we run into "interpolate HOW" if everything uses `mix()`.
 - We only grant mixing capabilities where it actually matters and has meaning.
 - It's possible to implement and ship gradually.

So ideally we should just abandon `mix()`. We can probably find other ways of doing everything we want in https://github.com/w3c/csswg-drafts/issues/6245, e.g. extend all _typed_ `*-mix()` functions with the capability of pulling progress from a named timeline, and things like that.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9343 using your GitHub account


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

Received on Tuesday, 12 September 2023 09:35:52 UTC