Re: [css-flexbox] Intrinsic Cross Size Definition Totally Wrong

On 08/24/2015 06:48 PM, fantasai wrote:
>   # The min-content cross size and max-content cross size
>   # of a flex container are the cross size of the flex
>   # container after performing layout into the given
>   # available main-axis space and infinite available
>   # cross-axis space.
>
> This might be correct if the cross-axis is the block axis
> (I'm not entirely sure), but it's completely wrong if the
> cross-axis is the inline axis.

Okay, so Tab and I worked on this issue today.

For a single-line flex container, the answer is very straightforward,
and we updated the spec with the following:

  # The min-content cross size and max-content cross size of
  # a single-line flex container is the largest min-content
  # contribution or max-content contribution (respectively)
  # of its flex items.

For a multi-line flex container, however, we don't have a very
good answer. The spec currently contains an explanation of the
issue...

In an ideal world, the multi-line cross size would be calculated
by, one by one, laying out elements with the constraint applied
into the flex lines, and whenever a new largest cross-size in a
line is found, redoing layout for all previous items in the line
to match that width (so you get accurate line-breaking).

Current browsers perform an approximation of this, finding the
largest intrinsic cross-size among *all* items and then
shrink-to-fit sizing everything into that much available space.

Our question to the list is: Is this approximation sufficiently
useful to specify? Can we do better?

Side note: current browsers also set the *flex container’s* inner
size to that largest value, which is clearly wrong, as it is
guaranteed to cause overflow if there are multiple lines. We would
need to require the cross-size to be the sum of the line’s cross
sizes after doing item layout and linebreaking as outlined above.

~fantasai and TJ

Received on Thursday, 3 December 2015 21:43:48 UTC