Re: [csswg-drafts] [css-easing-2] How to generate a computed value for linear-spline() (#7415)

(Small but important nit: this is not about the computed value, it's about the *serialization* of the computed value. The computed value itself is an internal spec concept that can be turned into a string or an object (in principle, at least, if the Typed OM defines rules for it), and should be defined for easy of use in specs and/or ease of mapping to likely internal implementation concepts.)

Gradients *are* weird, but not for no reason. They stick with the general CSS policy that everything that can be (reasonably) implicitly omitted in parsing, *is* omitted when serializing the computed value. Unfortunately, they also have to deal with the fact that %s rely on layout information to resolve, so you cannot (in general) know at computed-value time whether stops are out of order, or how to expand omitted positions. So, fixup and calculation isn't done at all at computed-value time and the stops are kept as-is.

(This isn't an absolute policy - we don't combine same-color stops into a two-position stop, for example, because that requires extra logic to re-coalesce the steps and we felt it's probably more useful for authors to have a consistent model than one that sometimes had double positions and sometimes didn't. There's thus some wiggle room.)

None of this is the case for linear-spline() - %s are the only unit, so you can immediately fill in omitted positions and do fixup. I recommend doing so, then (again, leaning on the principle that a consistent structure for the stops is better than an inconsistent one).

So my proposal, in short:

* Unfold multi-positions into single-position stops
* Do out-of-order fixup, then omitted-position fixup, and serialize the positions with each stop. (Note the fixup order - it's important and will match gradients.)

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


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

Received on Friday, 24 June 2022 17:33:49 UTC