Re: [csswg-drafts] [css-values-5] Do not make the type of `*-progress()` consistent with its input calculations? (#10840)

I disagree. The % in the calculations needs to have a consistent source for resolving itself, and the clear answer in general is to take it from the property context (so you can do useful things with the box's size in 'width', for example).

So, your example would be invalid - the `0%` is typed as `{percent -> 1}` since it resolves against `<number>`, but that *can* be added to the `{length -> 1}` from `100px`. The function's type is thus `{}` and a percent hint of "length", which fails to match 'opacity's `<number>` grammar, since it has a non-null percent hint. This is good, since the % in this instance is not *intended* to be resolved against lengths.

(Hm, I should really capture that fact explicitly; the tip-toeing I do around percentages sometimes would be a little better if the percent hint could be non-null when it resolves against number or just as itself, so it'll fail earlier, at type-addition time, rather than later when matching the type against a grammar.)

There is certainly a *potential* for an MQ to accept a non-trivial percentage, such that you'd actually want its value. In that case, we'll have to create some clear way to obtain it. But there's no examples of this so far.

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


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

Received on Monday, 7 October 2024 17:24:36 UTC