Re: [css-values] Comments on Serialization of calc

On 4/4/16, 4:27 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:

>On Sun, Apr 3, 2016 at 10:33 AM, Alan Stearns <stearns@adobe.com> wrote:
>
>> My current understanding is that since the current simplification proposal is not the most aggressive one, there are current cases that will not be able to be expressed in the simple OM - something like calc(1em + 1ex + 10px). Is that correct?
>
>No, that works just fine.  Can you elaborate on why you think that
>would be problematic?  It sounds like there's a pretty fundamental
>disconnect in what people are thinking about, which might explain the
>confusion.

For some reason I though part of the motivation for simplification was to get down to the sum of *two* unit’d values. But now I’m past that misconception - thanks.

>
>> Are there other edge cases that will need a more complicated OM?
>
>No, Level 3 calc() is 100% representable in the object-based OM,
>assuming structural simplifications (that result in equivalent
>expressions) are allowed.

So in the current Typed OM proposal there’s *one* px value, which is why you’d need to combine (10px + 10px). Without that simplification, you’d need to be able to handle arbitrary numbers of px-unit values.

But if those two 10px values are actually separate things the author has specified, wouldn’t it be better for the Typed OM to retain them as separate entities in the specified style? Say I had a number of calc values in a pattern like:

calc(10px + 300px + 10px)
calc(10px + 10% + 10px)
calc(10px + 50% + 10px)

And I decided that the first 10px component needed to be replaced by 1em. I’d prefer an API that let me remove a 10px value and add a 1em value, instead of subtracting 10 from the combined px component and adding 1 to the combined em component.


If I had some additional values like calc(10px + 50px) and wanted to replace all of the 10px components with 1em, I’d be out of luck with the current Typed OM - I wouldn’t know which calcs had one 10px value and which had two.

Would it really be that hard to represent and work with multiple values of the same unit?


Thanks,

Alan

Received on Tuesday, 5 April 2016 01:28:03 UTC