W3C home > Mailing lists > Public > www-archive@w3.org > March 2018

Re: Fwd: [css-grid] question on clamping grid items to fixed track size

From: fantasai <fantasai.lists@inkedblade.net>
Date: Mon, 26 Mar 2018 12:54:53 -0700
To: "www-archive@w3.org" <www-archive@w3.org>
Message-ID: <952c4895-9824-5ab1-c968-9c8c2ebf931e@inkedblade.net>
-------- Forwarded Message --------
Date: Wed, 14 Feb 2018 18:17:50 -0800
From: fantasai
To: Mats Palmgren
CC: Tab Atkins Jr.

On 02/14/2018 05:55 PM, Mats Palmgren wrote:
 > On 2/15/18 12:07 AM, fantasai wrote:
 >> The min-content size is the width of “foobar”, not the AMS.
 >> The AMS is the used min-width. These are two different concepts,
 >> and the shrinkwrap size (required by justify-self: start) uses
 >> the min-content size, not the min-width in the formula.
 > Ah, that's where my misunderstanding is then.
 > I blame the rather vague term "minimum size" used in §6.6 which
 > I interpreted as a more general concept.
 > I think I've said this before: it's vague undefined terms and phrases
 > like this that leads to implementation bugs and incompatibilities in UAs.
 > I'd strongly encourage the CSS editors to always use terms that have
 > a normatively defined meaning.  In this case, the title of §6.6 should
 > be something like "How to calculate the used value for min-width/height
 > when its computed value is 'auto'".  (I'd recommend removing the term
 > "Automatic Minimum Size" entirely.)

The term “minimum size” is defined in
although I suppose I could make that more explicit. :)

I think the fact that the AMS was just the used value of min-width/height
was more clear in Flexbox, because it was described under the definition
of the 'auto' keyword for 'min-width' and 'min-height'. Now that that's
been factored out into Sizing, it's kindof lost the context... And since
there are so many related concepts, it's easy to get confused. ^_^

 >> I think you're right, per spec, about the container size,
 >> but wrong about the grid item size.
 > I agree.  But it also changes the column size doesn't it?
 > If AMS is simply determining the used value of min-width, then
 > the example is equivalent to:
 > <style type="text/css">
 > .grid {
 >    display: inline-grid;
 >    grid-template-columns: minmax(auto, 0px);
 > }
 > </style>
 > <div class="grid">
 >    <div style="justify-self: start; min-width:0">foobar</div>
 > </div>

Given the clamping rules for the AMS, yes.

 > Both the min/max-content *contribution* of that item is "foobar",
 > so the column size will in fact fill the container when the container
 > is sized under min/max-content constraint.


 > The interesting case though is when sizing the container under
 > "no constraint", i.e. in layout:
 > https://drafts.csswg.org/css-grid/#algo-single-span-items
 > "Otherwise, set its base size to the maximum of its items’ min-size contributions. The min-size contribution of an item is the
 > outer size that would result from assuming the item’s min-width or min-height value (whichever matches the relevant axis) as
 > its specified size if its specified size (width or height, whichever matches the relevant axis) is auto, or else the item’s
 > min-content contribution."
 > It's not clear to me if "min-width or min-height value" there is talking
 > about computed or used values.  So it could be interpreted either as:
 > "min-width:auto; width:auto", or (with AMS = 0) "min-width:0; width:0".
 > The "outer size" in the former case would be "foobar", and zero in
 > the latter case.  The former probably makes more sense, since otherwise
 > you'd still end up with a zero column size and the item overflowing
 > its column (but not the container since it was sized to fit) which
 > would be weird.

Oh, interesting. Yes, I think you're right--clearing that up would solve
the problem!

 >> p.s. Would you mind if I forwarded this discussion to www-archive?
 >> It might be useful to refer back to at some point in the future.
 > You're welcome to make any part of this thread public.

Cool, I'll compile a digest and archive it somewhere for future reference. :)

Received on Monday, 26 March 2018 19:55:22 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:35:51 UTC