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

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

From: Ojan Vafai <ojan@chromium.org>
Date: Thu, 24 May 2012 15:47:34 -0700
Message-ID: <CANMdWTt+4qxCs3BmWNgQg_C31KYshmrVycCoqNoT6tjhOR=03Q@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Tony Chang <tony@chromium.org>, Sylvain Galineau <sylvaing@microsoft.com>, fantasai <fantasai.lists@inkedblade.net>, "www-style@w3.org" <www-style@w3.org>
On Thu, May 24, 2012 at 3:33 PM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:

> On Thu, May 24, 2012 at 3:29 PM, Tony Chang <tony@chromium.org> wrote:
> > Why does computing the min-height for a column flexbox require a full
> > layout?  In the case of column flexboxes, I don't think we have to do any
> > extra work because we can't end up smaller than the min-content (the
> height
> > is already the min).
>
> The min-content height of a block is the height of the content after
> doing layout.  It's not like min-content width, where you can do a
> much less expensive poll of your contents and take the max.
>
>
> > That said, flex-basis: auto is about twice as slow as flex-basis: 0 (or
> any
> > other fixed value).  This is because before you can do the flex
> algorithm,
> > you need to compute the the basis (layout the child), then after you've
> run
> > the flex algorithm, you have to do a second layout at the computed width.
> >
> > I would prefer that the initial value of flex-basis be 0.  As Tab
> mentioned
> > up thread, this won't cause overflow anymore than flex-basis: auto.
>
> If dealing with the min-content restriction is indeed much cheaper
> than a full layout in WebKit (I already know that it's cheaper in FF),
>

It is. Like Tony, I also wasn't fully thinking through the problem to
realize that min-content doesn't need a full layout. It's often more
expensive, but it's not crazy more expensive the way that a second layout
is.


> then yeah, I don't see any particular reason to default to 'auto' over
> '0'.  They're equally safe, and neither seems to be obviously more
> desirable as a default layout strategy.  Favoring the faster layout
> system here seems like a win.
>

This satisfies me.
Received on Thursday, 24 May 2012 22:48:25 GMT

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