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

I think I agree with your answers to @Loirooriol's questions but let me clarify one point to avoid any misunderstanding:

> > When sizing a grid container with size containment under a min/max-content constraint,
> > 
> > 1. Should we run the placement algorithm (creating implicit tracks if needed)?
> >    Florian says we shouldn't? Chromium does, Firefox does not.
> 
> No, that would defeat the point of using size containment.

This is the wrong way to see it IMO.  We _should_ run the placement algorithm, and all other algorithms for that matter, it's just that when we treat the container as empty then we have zero items and thus we don't create any implicit tracks. IOW, _when calculating the container's intrinsic size_ for `<container style="...; contain:size">X</container>` it's **always** calculated identically to `<container style="...; contain:size"></container>` regardless of what the `...` expands to.

So the spec changes I would suggest are:

1. change "_When calculating the size of the containing box, including when computing its intrinsic size, it must be treated as having no contents._" to "_When calculating the intrinsic size of the containing box, it must be treated as having no contents._". Perhaps also add a parenthetical clarification: "_(including any pseudo-elements)_" at the end.

2. remove the note that follows that text since it's now redundant and just adds FUD

3. Change "_Then, its contents must then be laid out into the containing box's resolved size._" to "_Then, its contents is laid out into the containing box's resolved size normally, i.e. `contain:size` has no effect in this phase._"

(3 is needed to clarify that the [Resolve Intrinsic Track Sizes](https://drafts.csswg.org/css-grid/#algo-content) step for Grid should not treat the container as empty during layout. (Perhaps there are other cases (multicol? flexbox?) where this also matters, I haven't checked.))



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

Received on Friday, 17 April 2020 09:28:27 UTC