W3C home > Mailing lists > Public > www-style@w3.org > September 2015

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 4 Sep 2015 14:49:11 -0700
Message-ID: <CAAWBYDB=fJaMSeVNHXmTOGkeqG-JDAk=LUox8WKvqyGSUhEsvA@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: "www-style@w3.org" <www-style@w3.org>, Rossen Atanassov <Rossen.Atanassov@microsoft.com>
On Mon, Aug 31, 2015 at 1:44 PM, fantasai <fantasai.lists@inkedblade.net> wrote:
> 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.

That's not hard.  There's a fixed number of tracks *before* the
auto-repeat, and the auto-repeat defines a particular number of tracks
per repetition.  It's super-trivial math.

> 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.

I'm fine with the simplicity of C for now, but I also don't have a
problem with A.  But heck, might as well keep this simple for now, and
I agree that single-track auto-repeat + gutters solves nearly
everything.

~TJ
Received on Friday, 4 September 2015 21:50:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:56 UTC