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

Re: [css3-flexbox] Bad result in flex algorithm when combining stretch, and elements with an aspect ratio

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 29 Oct 2012 09:18:51 +0100
Message-ID: <CAAWBYDBfPixCRPZCWVFW1iRJqCEtP4Xy4EYT0JuSp8_EJ74eSg@mail.gmail.com>
To: "Kang-Hao (Kenny) Lu" <kanghaol@oupeng.com>
Cc: www-style list <www-style@w3.org>
On Mon, Oct 29, 2012 at 8:30 AM, Kang-Hao (Kenny) Lu
<kanghaol@oupeng.com> wrote:
> I think you just need to come up an with an algorithm that avoids
> circular dependency in a case like, say:
>
> <flexbox direction=row flex-wrap=wrap width=500px>
>   <image intrinsic-width=100px intrinsic-height=200px align-self=stretch />
>   <div width=400px height=400px flex=1 />
> </flexbox>
>
> Is it:
>
> == Result 1 ==
> Line 1 (height: 400px): 100px x 400px, 400px x 400px
>
> or
>
> == Result 2 ==
> Line 1 (height: 400px): 200px x 400px
> Line 2 (height: 400px): 400px x 400px
>
> or
>
> == Result 3 ==
> Line 1 (height: 200px): 100px x 200px
> Line 2 (height: 400px): 400px x 400px

Ah, good point.  I was assuming that the cross size of the flexbox was
known already.

I still think my suggested change is the best for such a situation,
but it's not complete.  When the cross size of the flexbox isn't
known, you can't do an early stretch.  In that case, we'll just have
to do a late stretch and ignore the aspect ratio (anything else would
either result in over/underflow, or require iterative layout).

~TJ
Received on Monday, 29 October 2012 08:19:40 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:01 GMT