Re: [csswg-drafts] [css-grid][css-contain] Clarify that `contain:size` affects track sizing (#4931)

> The [definition of intrinsic sizes](https://drafts.csswg.org/css-sizing-3/#intrinsic-size) is explicitly about the min-content size and max-content size, not about track sizes or any other sizable aspect of an box (grid track sizes, multicol column sizes, etc).

But to calculate the intrinsic size of a grid container you need to calculate its track sizes first, since the [Grid spec](https://drafts.csswg.org/css-grid/#intrinsic-sizes) literally says that its intrinsic size is derived from those.  Hence the question of how they should be calculated for `contain:size` arise.

> So by my reading (and by my intent when writing it), the spec calls for finding out the min-content width and height and max-content width and height (if you ever need them) and the width and height of the element as if it were empty, and once you've done that, you do full layout using these sizes.

But the [contain:size](https://drafts.csswg.org/css-contain/#containment-size) spec says that it should be treated as empty in _more cases_ than just for intrinsic sizing though:
"_When calculating the size of the containing box, including when computing its intrinsic size, it must be treated as having no contents._"

If you meant that it should only affect the intrinsic size of the container's box then you need to change it to "_When calculating the intrinsic size of the containing box, it must be treated as having no contents._" so that it excludes the "when laying out the grid into that size" phase (to use your phrasing).

The ambiguity with Grid layout though is that the track sizes are calculated _again_ during the layout phase and that part of layout is considered an [intrinsic sizing step](https://drafts.csswg.org/css-grid/#algo-content) (not the container's intrinsic size, but the track sizes). So I think the Containment spec needs to make it clear that that step is excluded from the "treat the container as empty" condition.

> Anyway, If I understand correctly, you're not necessarily advocating for "option A", merely saying that the spec could be read that way, and want it to be clearer on whether it means A or B.

Correct, I claim that the `contain:size` spec is ambiguous (for Grid at least). I haven't advocated for any particular behavior (so far).

> By the way, the reason why the grid text is in a note is that no additional normative requirement is meant on grid, and this is just an illustration/reminder of how the preceding normative text is meant to be applied to grid.

Right, but the problem is that, for a few of the possible interpretations of the spec, it's not just clarifying the preceding text. If we go for the "it should be treated as empty so implicit tracks aren't created" option then yes, in that case it's only a clarifying note. Otherwise, it's not just clarifying but instead modifies/contradicts the preceding text and thus shouldn't be in a note.

-- 
GitHub Notification of comment by MatsPalmgren
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4931#issuecomment-615143271 using your GitHub account

Received on Friday, 17 April 2020 09:25:44 UTC