Re: [css-grid] a few questions on auto-fill / auto-fit in the repeat() function

On Thu, Dec 17, 2015 at 2:37 PM, Mats Palmgren <mats@mozilla.com> wrote:
> On 12/10/2015 22:44, fantasai wrote:
>>
>> On 12/02/2015 06:39 PM, Mats Palmgren wrote:
>>>
>>> https://drafts.csswg.org/css-grid/#valdef-repeat-auto-fill
>>> 4. How should a zero track size in the repeat() be handled?
>>
>>
>> We've added the following paragraph for now:
>>
>>          For the purpose of finding the number of auto-repeated tracks,
>>          the UA must floor the track size to a UA-specified value
>>          to avoid division by zero.
>>          It is suggested that this floor be ''1px'' or less.
>
> Seems reasonable to me.  The text needs to be more precise though.
> Does the above mean that the tracks from repeat(auto-fill, 0)
> is treated as having minmax(0, 1px) in the Track Sizing algorithm?
> (and repeat(auto-fill, minmax(0,auto)) as minmax(1px,auto) etc)
>
> Or is it restricted to finding the number of repeated tracks only
> and will use the non-floored track sizing function everywhere else?

It's "For the purpose of finding the number of auto-repeated tracks",
nothing else.

>>> 6. In general, "positive integer" means one or more.  But it seems
>>>     undesirable to generate a track if it causes overflow so I'm really
>>>     not sure what you mean by that term here.
>>
>>
>> Yes, it always generates at least one track. The auto-repeat
>> semantically indicates that you want to fill in some content
>> there, so it's likely confusing if it's possible to get
>> *nothing* to show up there. In the case that the window gets
>> too narrow, you still want at least one column to put the
>> content into--you don't want the auto-fill area to just
>> disappear.
>
>
> OK.  The problem is that the spec is rather vague about that and
> can be read in different ways.  With the current language, I read
> the "don't create overflow" as the more important criteria.  Perhaps
> you could use "one or more tracks" or something to explicitly rule out
> zero tracks as an alternative (in the auto-fill section)?

I disagree that it's vague (positive integer is very precise, and
excludes zero), but reading it again, I find that it's *incomplete* -
if 1 track would overflow, then there is no positive integer, "largest
possible" or otherwise, that fulfills the criteria.  I've added a
phrase clarifying that you use 1 if none fit.

>>> 7. When the size is indefinite, and the min size is definite but zero,
>>>     how many tracks should be generated?  for example:
>>>
>>> <div style="display: grid;
>>>              grid-template: repeat(auto-fill,10px) / 10px;
>>>              min-width: 0;">
>>
>>
>> The spec currently says
>>    “Otherwise, if the grid container has a definite min size
>>     in the relevant axis, the number of repetitions is the
>>     largest possible positive integer that fulfills that
>>     minimum requirement.”
>> which is actually an error, it should be s/largest/smallest/ :)
>> but in any case the requirement is "positive integer", so
>> one repetition, not zero.
>
>
> OK, but again: the spec language is vague.  A reader really shouldn't
> have to guess what is meant.  Zero tracks "fulfills" a zero size IMO.
> Again, I'd suggest using the more explicit "one or more" here, and instead
> of "fulfills" perhaps "such that the sum of their sizes (including grid
> gaps) is greater than or equal to the min size"

This one's neither vague nor incomplete.  Zero tracks would fulfill a
zero size, yes, but zero isn't a positive integer.  The smallest
possible positive integer that fulfills a zero size is 1.

~TJ

Received on Thursday, 17 December 2015 23:05:29 UTC