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

> spec based reasoning: spec says to size the element as if it were empty. implicit tracks with a non-zero fixed min track sizing function would have an impact on the size, and only exist if the element is not empty. Therefore, don't take them into account when calculating the size.

@frivoal Well, but the spec says "When calculating the size of the containing box". The [Grid Item Placement Algorithm](https://drafts.csswg.org/css-grid/#auto-placement-algo) is not part of the [Grid Sizing Algorithm](https://drafts.csswg.org/css-grid/#algo-overview), it's a previous step. So if the size containment is supposed to apply not only during sizing but also during previous steps that can affect sizing, then the spec should probably clarify it.

>  if we take the number of elements into account in order to figure out how many implicit tracks we have, and these implicit tracks have a non-zero fixed min track sizing function, then, by applying display:none to grid items, we can change the size of the grid. This would mean that the element is not actually contained

It seems to me this would be more like style containment rather than size containment.

My understanding is that size containment is only supposed to prevent the intrinsic size of an element from depending on the size of the contents. But in this case, the existence of implicit tracks wouldn't depend on the layout of the children, only on their computed style.

So I'm not opposed to avoid creating implicit tracks with size containment, but I'm not convinced that's necessary.

> This is the wrong way to see it IMO. We should run the placement algorithm

@MatsPalmgren But in practice it doesn't matter, right? The placement algorithm places items, if it behaves as having no contents then there are no items to place and the placement algorithm is no-op.

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

Received on Friday, 17 April 2020 18:37:12 UTC