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

Re: [css3-flexbox] Flexing algorithm and replaced elements (was: [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, 3 Dec 2012 13:59:49 -0800
Message-ID: <CAAWBYDABKJDxoEjkYcHmR0Kk_RWpN96cdG97zNWEd4ArSo=Tzw@mail.gmail.com>
To: "Kang-Hao (Kenny) Lu" <kanghaol@oupeng.com>
Cc: WWW Style <www-style@w3.org>
On Thu, Nov 1, 2012 at 11:22 PM, Kang-Hao (Kenny) Lu
<kanghaol@oupeng.com> wrote:
> (12/10/28 23:51), Tab Atkins Jr. wrote:
>> However, that brings up a further problem.  If you *first* stretch,
>> but the item is also flexible, the flexing can cause it to no longer
>> fill the flex line.  In other words, it might simply be impossible to
>> simultaneously honor the aspect ratio, the 'stretch' keyword, and a
>> non-zero "flex" value.  This is similar to how you can't always
>> simultaneously honor width, height, and the aspect ratio.  We satisfy
>> the latter by breaking the ratio; we consider an explicit width and
>> height to be stronger than the implicit aspect ratio.
> I think there is a relevant question here:
>   Should a replaced item's, say, min cross size property induce a min
>   main size when an item flexes?
> The current spec
>   # Fix min/max violations. Clamp each item's main size by its min and
>   # max main size properties....
> seems to say it doesn't, but this might produce stretched images when
> the item is laid out after flexing, no matter what 'align-self' it has,
> since min/max properties are strong.
> I think the spec could consider saying that for an replaced element,
> it's the *effective min main size* that's used in this step. The
> *effective min main size* is defined by this formula:
>   max( min main size, min ( min cross size * w/h , max main size ) )
> where
>   w is the intrinsic width, h is the intrinsic height
>   max main size is the maximal of the max main size and the min main
>   size properties
> . And effective max main size would be defined similarly.
> Or was it resolved that the min cross size property should be ignored in
> this case?

We don't generally let aspect ratios transfer sizing constrains from
one dimension to another in CSS, so we've decided to continue this
trend and not have any special behavior here.  The min/max size is
eventually respected, but it may mean that the aspect-ratio is lost
when it's theoretically possible for us to preserve it.

For example, the min-height property does not imply a min-width
constraint in block layout if width is non-auto.

Received on Monday, 3 December 2012 22:00:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:24 UTC