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

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),
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.

~TJ

Received on Thursday, 24 May 2012 22:34:34 UTC