Description
From #6245 (comment):
<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.
- 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 #6245, e.g. extend all typed *-mix()
functions with the capability of pulling progress from a named timeline, and things like that.