Re: [css3-flexbox] auto margins and flex-align: baseline

On 04/04/2012 04:37 PM, Alex Mogilevsky wrote:
> ± I see a few ways to handle this:
> ± 1) Do an extra pass after margin:auto to determine the new max ascent.  This 
> ± works, but it's slow.
> ± 2) margin: auto always causes flex-align/flex-pack to be ignored so we can 
> ± ignore it when computing the max ascent.
> 
> Actually it is (2), as currently defined in the spec:
[...]
> 	* Immediately before pack and align steps, if there are 
>         any auto margins on items in the direction of alignment 
>         and there is positive free space, the free space is 
>         distributed equally to the auto margins. 

It's almost (2), with one exception.

The spec does currently use "flex-item-align" for the purpose of computing
cross axis size, and that happens *before* we've resolved auto-margins in
that axis.

Flexbox Layout Algorithm Step 7 ("Calculate the cross size of each flexbox
line") in particular says...
[[[
collect all the flexbox items with a ‘flex-item-align’ of ‘baseline’. Find
the maximum of the distances from their baseline to the cross-start edge
of their margin box, and the maximum of the distances from their baseline
to the cross-end edge of their margin box. Sum these two values.
]]]
...and that ends up potentially determining the cross size of the flexbox
line.

Then in Step 10 (3 steps later), we resolve 'auto' margins in the cross axis.

I think I agree that Tony's suggestion #2 is the sanest behavior --
perhaps we should address the point I brought up above by explicitly
calling for auto margins to nullify the effects of flex-item-align in
Flexbox Layout Algorithm step 7?  Then, the section I quoted above would
then begin like so:
[[[
collect all the flexbox items with a ‘flex-item-align’ of ‘baseline’ {and
with no 'auto' margins in the cross axis}.
]]]
where my suggested new text is in curly-braces.

Thanks,
~Daniel

Received on Thursday, 5 April 2012 04:49:16 UTC