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

-------- Forwarded Message --------
Date: Mon, 12 Feb 2018 16:52:20 -0800
From: fantasai
To: Mats Palmgren

On 02/12/2018 04:40 PM, Mats Palmgren wrote:
 > On 2/13/18 1:20 AM, fantasai wrote:
 >> On 02/12/2018 04:14 PM, Mats Palmgren wrote:
 >>> On 2/12/18 10:09 PM, fantasai wrote:
 >>>  > No, you're correct. The clamping only applies to the AMS. But it applies
 >>>  > to the AMS no matter what constraint the grid is being sized as. Is that
 >>>  > making sense now?
 >>>
 >>> But that means that the issue Rego reported in
 >>> https://bugzilla.mozilla.org/show_bug.cgi?id=1427608
 >>> is NOT a bug and that the rendering of his testcase in Nightly
 >>> is the correct one.
 >>
 >> Sorry, I got confused about your question; missed the part about the grid item.
 >>
 >>  > As I understand it, the grid item width, column size, and grid container
 >>  > width should all be zero in this case.  Is this correct?
 >>
 >> Afaict, under the current spec, the column size and grid container
 >> width will be zero, but the grid item will be width: 20px, since
 >> there is nothing that would reduce its size. (The only thing that
 >> would reduce its size from the specified 20px would be a max-width.)
 >> (It's AMS would be zero, but the specified width is greater than zero
 >> so it uses its specified width.)
 >
 > OK, I'll check again tomorrow the width:20px case (it's 1:40am here).
 >
 > However his test in that bug actually has width:auto, so the max-content
 > size is the width of the "foobar" text.  Let's assume that the item in
 > that test has justify-self:start to avoid having stretching confuse
 > the matter.  What is the correct grid item width, column size, and grid
 > container width in that case?
 >
 > We currently make the grid container's intrinsic size wide enough to fit
 > the text (since clamping doesn't affect the max-content size), but
 > the column size and item width is zero since item's size is clamped under
 > a min-content/no constraint. (why? it's described in detail in the bug).

If the width of the item is 'auto' and it has 'justify-self: start'
(shrinkwraps), then its min-width is zero but its specified width is
fit-content(track-size); with a track-size of zero (minmax(0px, 0px))
this yields a grid track of zero, a grid container of zero, and an
item just large enough for its min-content width, i.e. the width of
“foobar”.

(This is assuming we don't adjust the spec to make minmax(auto, 0px)
not clamp AMS at zero due to the min winning against the max. If we
make that change, the track would resolve to minmax(foobar, 0px),
and thus the track size and grid container would also be sized to
foobar.)

~fantasai

Received on Monday, 26 March 2018 19:52:13 UTC