W3C home > Mailing lists > Public > www-style@w3.org > April 2016

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

From: Alan Stearns <stearns@adobe.com>
Date: Tue, 5 Apr 2016 01:27:33 +0000
To: Tab Atkins Jr. <jackalmage@gmail.com>
CC: fantasai <fantasai.lists@inkedblade.net>, Rossen Atanassov <Rossen.Atanassov@microsoft.com>, Greg Whitworth <gwhit@microsoft.com>, "L. David Baron" <dbaron@dbaron.org>, Francois Remy <frremy@microsoft.com>, "CSS WG" <www-style@w3.org>
Message-ID: <54663863-B935-4635-8AB8-444579D5FB98@adobe.com>
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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:02 UTC