[css-multicol][css-sizing] Intrinsic Sizes of Multi-column Elements

Been looking into the intrinsic size of multi-column elements.
Testcase here:
   http://fantasai.inkedblade.net/style/tests/multi-col/intrinsic-sizing

Here's my suggestions:


col-count only
   min = #cols * min-content [of contents]
   max = #cols * max-content
   Implemented by: Firefox, Chrome, IE

   Rationale:
     Width of columns is totally flexible,
     so pick a size that respects min/max-content

col-width only
   min = min(col-width, min-content)
   max = col-width
   Implemented by: Firefox, IE

   Rationale:
     Widest possible column is column-width*2-ɛ.
     But if columns happen to be column-width (as requested),
     then any content outside that overflows and is clipped.
     It makes sense that the column-width becomes a limit
     on the content's size contribution.

     The narrowest possible column is zero. If the min-content
     is less than the column-width, then we can become that
     small.

col-width + col-count
   min = min(col-width, min-content)
   max = col-count * col-width
   Implemented by: Firefox, IE

   Rationale:
     The layout as the container gets narrower (fewer columns)
     approaches the col-width only case (reduce columns as
     width reduces in order to keep each column >= col-width),
     so it makes sense to have the same behavior.

     The multi-column spec wanted column-width * column-count,
     when both were defined, to be the preferred width, and
     the implementations reflect this. Authors would probably
     prefer that shrink-to-fit sizing landed on this answer
     for maxed-out cases as well.

col-width + height
   min = used col-count == 1 ?
           min-content : column-width * used column count
   max = column-width * used column count
   Implemented by: Nobody

   Rationale:
     Any other answer results in overflow, which no intrinsic
     size should ever result in.

     Also this case hits a number of real-world use cases,
     and they would like the max-content size to be as described.

Notes:
   The original "definition" (goal, really) of max-content
   was the narrowest size that resulted in the shortest
   possible height. However, because of the desire of multicol
   elements to have their column-width respected, it's kindof
   less obvious what the max-content size ought to be.

   Chrome factors in the intrinsic size of the contents in a
   few more cases, e.g. using that as a minimum for the column
   widths. But since multi-column layout doesn't actually work
   that way, this isn't a valid approach. (Once the intrinsic
   size is greater than 2*column-width, the used column width
   *will* be less than the intrinsic size of the content.)

   (We could add the intrinsic size keywords to column-width if
   we want the ability to ensure they are wide enough for their
   contents. Right now said contents are required to be clipped.)

~fantasai

Received on Thursday, 19 March 2015 04:40:56 UTC