Re: [css-flexbox][css-grid] Percentages resolving against definite max-height

On 11/04/2015 04:27 PM, Tab Atkins Jr. wrote:
> But for some reason, both Chrome and Firefox agree that the items are
> 15px tall (modulo padding/etc).  This seems like reasonable, useful
> behavior, but we can't find a justification for it in the flex layout
> algorithm.
> 
> Can one of the implementors explain how they got this behavior?  We
> need to know where in the algo to spec this, so we can apply the same
> behavior to Grid.

In Firefox, this happens between Step 5 ("Collect flex items into flex
lines") and Step 6 ("Resolve the flexible lengths of all the flex items").
https://drafts.csswg.org/css-flexbox-1/#main-sizing

At that point (just after generating flex lines) if the flex container's
main size is unknown, we resolve it to be the size of the longest flex
line, clamped to the flex container's min/max main-size property.  (Note
also that unless we're multi-line & have forced breaks, there can only
be one flex line at this point, so that one line is by definition "the
longest flex line".)

I guess according to the spec, we're *supposed* to resolve the flex
container's main size in Step 4 (before we've generated flex lines),
"using the rules of the formatting context in which it participates".
I'm not sure what this means, though, for an auto-height vertical flex
container whose lines we haven't generated yet.

~Daniel

Received on Thursday, 5 November 2015 19:02:01 UTC