Re: [csswg-drafts] [css-values-5] issues with interpolation rules for calc-size() (#10220)

> My understanding is the intent of allowing calc-size() values as the basis was to allow this sort of thing. However, I think a literal reading of the spec currently doesn't allow it.

Ooh, you're right, it looks like I lost the text for this when moving it from the issue to the spec. I'll fix; the intent is indeed that the basis is recursive.

>  if it is allowed, is the correct interpolation behavior to un-nest the calc-size() expression by substituting for the size in the outer expression's calculation, or is it to separately interpolate the calculation and the basis?

The behavior I want to preserve is that the obvious "simplification" one can theoretically do (ignoring, for the moment, billion laughs) results in identical behavior. In other words, `calc-size(calc-size(min-content, size+20px), size * .5)` and `calc-size(min-content, (size + 20px) * .5)` should act exactly the same. (*Actually* un-nesting subjects you to expansion attacks, but a stacked set of equations, each resolving to provide the `size` value for the next, works.)

The other behavior I want to preserve is that calc-size() interpolation is always linear - whatever size the endpoints resolve to, the interpolation acts as if you're just going between those two sizes. The above condition preserves this, tho I suddenly realize my interpolation rules for a len-per basis violate it - going from `calc-size(100%, size)` to `calc-size(0px, 0px)` will interpolate quadratically.

This is fixable, tho. I think what I want to do is, effectively, to pretend that a calc-size() with a len-per basis is already a "nested" calc-size, so I can move the actual len-per calculation into the sum argument. In other words, `calc-size(10% + 20px, size * .5)` should be equivalent to `calc-size(calc-size(hundred-percent, (size * .1 + 20px)), size * .5)`, where `hundred-percent` is a pretend keyword that means "whatever 100% would resolve to". Very possibly I should *actually* define that keyword, in fact, so I can make the equivalency easier to talk about.

Does this sound reasonable? Both the "sequence of calculations" un-nesting concept, and the application of that to a len-per basis? Thoughts on actually defining a keyword for a percentage basis?

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


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

Received on Friday, 3 May 2024 18:35:33 UTC