W3C home > Mailing lists > Public > www-style@w3.org > June 2012

Re: [css3-flexbox] "flex-basis: auto" means completely different things as specified value vs. computed value

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 5 Jun 2012 15:07:49 -0700
Message-ID: <CAAWBYDB7AMkoi12A7M=z4U_pSXYNyp2WWDR2308BLbfEE0i_=w@mail.gmail.com>
To: Daniel Holbert <dholbert@mozilla.com>
Cc: www-style <www-style@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
On Mon, Jun 4, 2012 at 2:25 PM, Daniel Holbert <dholbert@mozilla.com> wrote:
> On 06/04/2012 10:53 AM, Tab Atkins Jr. wrote:
>>> MAIN CONCERN: It's weird to have a particular value ("auto" in this
>>> case) mean two completely different things as a specified value vs. as a
>>> computed value.
>>
>> Yeah, it's a little weird, but the alternative is to come up with
>> *another* term meaning the same thing as 'auto', just for stacked-auto
>> situations like this.
>
> That's _one_ alternative (the first one I mentioned at the end of this
> email), but it's not the only one.
>
> The other/better alternative (which I was lobbying for) is to make
> "flex-basis:auto" simply compute to "auto", which has one and only one
> meaning.  (look at the 'width' or 'height' property and use that)
>
> As I noted before, that is how "auto" is specced for "width" and
> "height" (getComputedStyle hacks aside), so there's definitely precedent
> for this behavior.

'auto' width and height *cannot* be resolved at computed-value time.
They require layout information to turn them into lengths.

'auto' flex-basis *can* be resolved at computed-value time, since it
just means "whatever the width/height property is".

Thus, the current spec behavior is consistent with our general policy
of "computed values should always be the value resolved as far as
possible without needing layout or network resolution".  We only break
this rule when there's a really good reason.


However, thinking about your cases more, I think there's a good reason
to do as you say, and defer flex-basis:auto resolution until
used-value time.  As you point out, the current behavior is that the
same keyword 'auto' means different things as a specified value and a
computed value.  The example you produced earlier, while you drew the
wrong conclusion from it initially, was still actually *quite weird*.

So, I'll go ahead and make this minor change, so that
'flex-basis:auto' computes to itself, and the used value is the used
value of width/height.

~TJ
Received on Tuesday, 5 June 2012 22:08:44 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:55 GMT