RE: [css3-flexbox] min-width & min-height "auto" value -- applies to both axes, or just main axis?

± From: Daniel Holbert [mailto:dholbert@mozilla.com] 
± Sent: Tuesday, June 12, 2012 12:13 PM
± 
± On 06/11/2012 06:07 PM, Alex Mogilevsky wrote:
± > ± So right now, the spec is calling for all flexbox items to have 
± > *both* their min- ± width *and* their min-height default to "min-content".
± > ±
± > ± I'd thought we only wanted this magic for the main axis's min-size 
± > property, not ± for both min-size properties. Maybe I misunderstood though?
± > 
± > We want the magic in both direction
± 
± To be clearer / more specific: do we want "min-height:auto" to ever compute to 
± something nonzero on a flex item in a horizontal flexbox?
±
± I don't think we do.  Now -- in the *main* axis, there's a good reason for the 
± magic, because without it, common values of the "flex" shorthand could easily 
± end up shrinking an item below its min-content width.  But in the cross axis, 
± there aren't any flexbox-specific sizing surprises like that, IIUC.  So I don't 
± see a good reason for the cross-axis min-size property to have a magical 
± default there when it computes to 0 everywhere else.

Min/max 'auto' should have no meaning on cross axis (therefore zero, as you suggest). I expect that item's cross size should calculate the same way used height is calculated in normal flow, after which it may increase if alignment is 'stretch'. I believe the spec currently defines exactly that.

± > The actual magic that we want is "minimum size of content when laid out 
± within constraints of cross size of flexbox".
± 
± This makes sense to me (for the main-axis min-size property), though what 
± you're describing is much more nuanced & complex than what the WD currently 
± says...

Opened a bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17475 

Proposed algorithm change (instead of two bullets that start with "otherwise"):

<algorithm>
Otherwise, lay out the item using available space with following dimensions: 

* On main axis: 
    - if flex-basis is auto: infinite
    - if flex-basis 'fit-available' or 'fit-content':  
      flex-container's main size, constrained by its 
      min and max size.

* On cross axis:  flex container's cross size, constrained 
  by its min and max size.

The flex base size is the item's resulting measure.
</algorithm>

Alex

Received on Tuesday, 12 June 2012 22:11:08 UTC