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

[css3-flexbox] corrections/clarifications on updated flexbox algorithm

From: Daniel Holbert <dholbert@mozilla.com>
Date: Wed, 15 Feb 2012 12:49:05 -0800
Message-ID: <4F3C1A41.6080908@mozilla.com>
To: "www-style@w3.org list" <www-style@w3.org>
CC: Alex Mogilevsky <alexmog@microsoft.com>, "Tab Atkins Jr." <jackalmage@gmail.com>
Hi www-style,

I was just reading through the updated flexbox algorithm, and I have a 
few corrections/questions about the updated flexbox algorithm. I've 
labeled these (a) through (k) below.

Link to the algorithm:
   http://dev.w3.org/csswg/css3-flexbox/#layout-algorithm

QUOTING STEP 2:
{{
   2. Layout the flexbox items using the shrink-to-fit algorithm. If the 
main size of a flexbox item is flexible, treat it as the preferred size 
of that flexible length. Do not apply min/max-width/height constraints 
to the preferred size of flexible lengths - those constraints are 
handled elsewhere in this algorithm, and doing so will produce incorrect 
results.
   Each flexbox item now has a hypothetical main size.
}}

   (a) Here, are we still laying out each child *as if it were the only 
child* (as a previous version of the ED stated about this part)?

   (b) "using the shrink-to-fit algorithm" -- could this link to 
somewhere where that algorithm is definitively defined?

   (c) The second sentence is very open to being misunderstood. I think 
it means to say something like "treat the flexible width as being 
inflexible and equal to its preferred size component", but it currently 
could be read to mean something different. (I initially read it to say 
"use the flexible width as the item's preferred size", which isn't what 
you want to do here since you don't want flexibility yet.)

   (d) On the final sentence about hypothetical main size, it'd be nice 
to say something like "This will produce..." rather than "Each flexbox 
item now has..." (so it's clear where the size came from)

   (e) Also -- each flexbox item also now has a hypothetical *cross* 
size, too, right?  Might as well state that here as well.  (Later on, 
Step 5 will tell us to "Update" the hypothetical cross sizes, without 
ever having established where these sizes were originally set.)


QUOTING STEP 3.1:
{{
If the main size depends on the flexbox's content, then:
     * for ‘min-content’, [...]
     * for ‘max-content’, [...]
     * for ‘fit-content’, [...]
}}

  (f) Seems like above should say what to do for "auto" here -- AFAIK 
auto-sized flexboxes should shrink-wrap, & hence they depend on the 
flexbox's content.  They probably want to share a line with fit-content, 
I imagine?


QUOTING STEP 4:
{{
   4. Find the actual main size of the flexbox. If the flexbox's main 
size doesn't rely on its contents, it's actual main size is calculated 
per the appropriate rules.
}}

   (g) s/it's/its/


QUOTING STEP 7.2 - 7.3:
{{
   7. Calculate the cross size of each flexbox line [...]
     2. Collect all the flexbox items with a ‘flex-item-align’ of 
‘start’, ‘end’, ‘center’, or ‘stretch’, or a value of ‘baseline’ and a 
cross axis parallel to their inline axis
     3. Collect all the flexbox items with a ‘flex-item-align’ of 
‘baseline’ and a cross axis perpendicular to their inline axis [...]
}}

   (h) This would be much clearer if we reversed the order of 7.2 and 
7.3 -- that way, the existing-7.2-text could simply refer to "the 
remaining flexbox items" without having to explicitly list their many 
flex-item-align possibilities.

   (i) The language "a cross axis parallel to their inline axis" makes 
it sound like the cross axis can differ for each flexbox-item (which it 
can't).  It'd probably be clearer to say "an inline axis parallel to the 
flexbox's cross axis".  (This applies to both 7.2 and 7.3)


QUOTING STEP 9:
{{
   9. For each flexbox line, align the flexbox items per ‘flex-align’.
}}

   (j) s/flex-align/flex-item-align/


QUOTING STEP 10:
{{
  10. Align the flexbox lines per ‘flex-item-align’. The leftover 
free-space is calculated by subtracting the sum of the flexbox line's 
cross sizes from the cross size of the flexbox's content box.
}}

   (k) s/flex-item-align/flex-line-pack/


That's all I've got for now -- more coming later, possibly. :)

~Daniel
Received on Wednesday, 15 February 2012 20:49:33 GMT

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