[css-grid] repeat(auto-fit, <tracks>)

Last week the CSSWG discussed extending the repeat() function in grid layout
to handle this case
   https://lists.w3.org/Archives/Public/www-style/2014Oct/0108.html
and François Remy's extension
   https://lists.w3.org/Archives/Public/www-style/2015May/0113.html
by introducing the
   auto-fill
and
   auto-fit
keywords as repeat values, respectively.

The 'auto-fill' keyword will create as many columns as will fit, and
the 'auto-fit' keyword will create as many columns as will fit, but
also drop any repetitions that are empty after grid item placement
is complete.

I have attempted to edit this resolution into the spec:
   https://hg.csswg.org/drafts/rev/3b3554d893e9
   https://drafts.csswg.org/css-grid/#repeat-auto

One issue that I ran into was the issue of what gets dropped for
auto-fit. It's easy to drop any repeated columns that happen to
be empty. It's less easy to track the repetitions which are empty,
because that's not a simple flag on the column which is empty --
you have to also keep track of which columns form a single repetition.

Anyway, now that we have gutters, I think the vast majority of the
use cases for this feature will be single column widths, not patterns
of varying track sizes, so I suggest that we limit the auto-repeat
patterns to single tracks rather than entire track listings, at least
for this level.

To summarize, the options are:

   A) Allow auto-repeats to repeat entire track listings.
      UAs must track which tracks belong to a repetition in order
      to drop them together when they are completely empty for
      'auto-fit'.

   B) Restrict auto-fit repeats to single track sizes.
      UAs need only keep track of whether a track is a repeated
      track, and drop that track if it is itself empty.

   C) Restrict both auto-fit and auto-fill repeats to single
      track sizes. Same as B), except auto-fill and auto-fit
      have the same syntactic restriction.

Thoughts? I have a preference for C, since it is the least amount
of work for implementers and testers and, together with gutters
and the alignment properties, lets us solve probably >95% of the
need for this feature.

~fantasai

Received on Monday, 31 August 2015 20:44:41 UTC