Re: [css-containment] What does "contain:layout" do on table parts?

> On 30 Jul 2015, at 22:05, Daniel Holbert <dholbert@mozilla.com> wrote:
> 
> Hi www-style (Tab in particular),
> 
> What should happen if someone sets "contain:layout" on a table-part? (An
> element with one of the various "display: table-*" values from
> http://www.w3.org/TR/CSS21/visuren.html#propdef-display )
> 
> For example, on a row:
> <table border>
>   <tr style="contain:layout"><td>First Row</td></tr>
>   <tr><td>Second Row</td></tr>
> </table>
> 
> The spec just says the following:
> # When laying out the containing element, it must be
> # treated as having no contents. After layout of the
> # element is complete, its contents must then be laid
> # out into the containing element’s resolved size.
> http://dev.w3.org/csswg/css-containment/#containment
> 
> Is this really what we want to happen for a table-row? I can imagine
> that in my example above, this would meant the <tr> would have 0 height,
> and its cell would overflow the second row (with beveled borders
> behaving a bit oddly...)  I suppose we could do something similar for
> table and table-row-group as well. Is that what's supposed to happen?

Probably something like that, although it wouldn't hurt to try and be more explicit in the spec. I don't think laying out content into tables parts sized as if they were empty is a clearly defined operation.

> I tend to think "contain:layout" doesn't really make sense on most table
> parts, except maaaybe on "display:table-cell"...

Right. Putting contain:layout on any element without giving it an explicit size is asking for trouble, table or otherwise. And since table parts have limitations in terms of how you can size them explicitly, then indeed, this does not look like an auspicious combination.

This is particularly true for rows, row groups and the like, as you cannot explicitly size them in both dimensions at all. But even table cells are tricky, since setting the width and height of a non empty table cell to 0 will not make it 0 sized with overflowing content, but instead will keep it at it's "natural size".

I think there are use cases to justify figuring this out (e.g. a spreadsheet), but I agree this probably needs clarifications. Maybe a lot of them.

 - Florian

Received on Friday, 31 July 2015 09:24:36 UTC