Re: [css3-flexbox] flex-basis initial value should be 0px

On Tue, May 22, 2012 at 1:15 PM, Anton Prowse <prowse@moonhenge.net> wrote:

> On 22/05/2012 01:08, Ojan Vafai wrote:
>
>> I think this was probably an oversight in the recent changes to the spec,
>> but at some point, the default value of flex-basis changed from 0px to
>> auto.
>>
>> "‘flex:<positive-number>’
>> Equivalent to ‘flex:<positive-number>  1 0px’. This value makes the flex
>> item flexible, and sets the flex basisto zero, resulting in an item that
>> receives the specified proportion of the free space in the flex container.
>> If all items in the flex container use this pattern, their sizes will be
>> proportional to the specified flex ratio."
>>
>> That seems like the correct default behavior. Having auto as the preferred
>> size is considerably slower and often not what the developer wants. It
>> should not be the default value.
>>
>
> By "default value", do you mean initial value?  If so, I interpret your
> concern as being that if you create a flexbox but don't specify any flex-*
> properties, you get flex: 1 1 auto.  (I'm not entirely sure I've understood
> you, to be honest!)
>

Yes.


> I'm interested to understand how the fact that one value is slower than
> another is a valid concern in deciding what to define as the initial value
> of a property.  It seems to me that the author wants whatever behaviour
> they want; if the initial value of a property doesn't meet their needs in a
> given situation then they'll explicitly specify something else.  It's not
> like they'll just say "well, that rendering will do, I guess" and stick
> with the "default" out of laziness.  (At least, not in my experience!
>  Authors tend to be pretty exacting.)
>

In this case, I believe it's both what the author usually wants and
considerably more performance. But it's hard to tell what the common case
here will be. There are significant use-cases both both flex-basis:auto and
flex-basis:0px. All other things being equal, we should default to the one
that is fundamentally more performant. Auto-sized flex-basis requires doing
a second layout in many cases.

Ojan

Received on Tuesday, 22 May 2012 20:49:53 UTC