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

> > When calculating the size of the containing box, including when computing its intrinsic size, it must be treated as having no contents.
> 
> This is effectively just an early out when computing the intrinsic sizes for an element.

The "_including_ when computing its intrinsic size" (my emphasis) seems to imply that it affects more size calculations than just the intrinsic size of the box itself. I don't see anything in the spec that supports the idea that it _only_ affects the intrinsic box size.
You can think of the calculation of [_intrinsic_ track sizes](https://drafts.csswg.org/css-grid/#intrinsic-sizing-function) as an "intrinsic sizing calculation" if that helps since it's based on the intrinsic sizes of the items (the chapter is even named [Resolve Intrinsic Track Sizes](https://drafts.csswg.org/css-grid/#algo-content)).

> `<div style="display:inline-grid; width: 0px;">`

Did you forget the `height:0`? The [`contain:size`](https://drafts.csswg.org/css-contain/#valdef-contain-size) spec is pretty clear that the children shouldn't affect the size: "This ensures that the containing box can be laid out without needing to examine its descendants." so clearly you don't want the container to have its height sized by the item.

Anyway, the Containment spec already [says](https://drafts.csswg.org/css-contain/#containment-size) that "this does not necessarily make the element zero-sized: properties set on the element itself, such as the columns property or the grid property, continue to be taken into account.". I read "taken into account" there as "run the TSA pretending that the grid container has no items", which is what I suggested in the OP. I don't think there is a way to take the grid properties into account in any other way.
 IOW, what I'm suggesting is merely making concrete what the spec is already suggesting as I see it.



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

Received on Thursday, 9 April 2020 18:17:10 UTC