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

On Wednesday 2016-02-17 15:48 -0800, Tab Atkins Jr. wrote:
> On Wed, Feb 17, 2016 at 11:39 AM, Francois Remy <> wrote:
> > Hi Tab, Fantasai,
> >
> > Here are a few comments regarding the "calc" serialization section I just reviewed:
> >
> >
> >
> > ----[0] Thanks for looking into this, you rock, as always!
> >
> >
> > ----[1] I am not confident with the "compatible units" notion, mostly because it isn't defined anywhere (except by example). It is not clear, for instance, what calc(100vw - 20px) resolves to at specified time. Technically, the viewport width does not depend on the element this value is applied on, but at the same time it may vary which would somehow require to keep the values separate to provide the right result over time. It is also not clear to me what happens if we have calc(1cm + 1mm) vs calc(1mm + 1cm). The units are compatible, but which one should we keep? Does order matter?
> It probably does need to be expanded on, but it's the same concept of
> "absolutization" that transforms em into px at computed-value time.

But it seems wrong to apply a computed-value type of process to a
specified value.

Perhaps what should be combined are *identical* units?  Then, for
computed values, many units will have been converted to identical
units, but for specified values, they won't be.

> > ----[2] I have no opinion on the clamping of values at step 2 of the algorithm you want to add. For me it looks fine to drop this step altogether and just serialize "calc(<value>)" whatever <value> is, but I understand some browsers might want to simplify it as soon as possible in order to save memory. This is such an edge case I doubt it is really worth it, though.
> Yeah, this step is based on browsers' current behavior. I'd prefer to
> drop it if specifying fresh.

Gecko and Chromium don't do this.  Testcase:

<!DOCTYPE html>
<p style="margin-left: calc(3px)">


Perhaps what you were observing was part of the calc *computation*
process rather than the calc *serialization* process?


𝄞   L. David Baron                  𝄂
𝄢   Mozilla                   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Thursday, 18 February 2016 03:02:52 UTC