Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-contain-1] maybe 'contain-size' shouldn't apply to display:table-caption? #2952

Closed
dbaron opened this issue Jul 26, 2018 · 8 comments
Closed
Assignees
Labels

Comments

@dbaron
Copy link
Member

dbaron commented Jul 26, 2018

The definition of contain:size says that contain:size doesn't have an effect on table or on internal table elements. This means it doesn't apply to display:table-cell... but it does apply to display:table-caption, which isn't defined as an internal table element (to my surprise, and in disagreement with Gecko's code).

I don't have a strong opinion here... and I just filed Mozilla bug 1478850... but it's possible the spec should change here?

@frivoal
Copy link
Collaborator

frivoal commented Jul 26, 2018

Leaving out table-caption was intentional, as it is a block box, and as far as I can tell does not have any special rule that would make applying contain:size unusually hard.

CSS2.1 claims:

The caption boxes are block-level boxes that retain their own content, padding, margin, and border areas, and are rendered as normal block boxes inside the table wrapper box

Is it more special than the spec(s) lead me to believe? Setting an explicit width and height on a table caption, including setting them to smaller than the content and to 0, works just fine as it would on any block box, so I think we're good, but maybe I'm missing something.

@frivoal frivoal self-assigned this Jul 26, 2018
@dbaron
Copy link
Member Author

dbaron commented Jul 26, 2018

I think the issue is that in many cases the table-caption's size interacts with the table's size, much like the sizes of table parts interact with each other. In other words, the width of the table definitely causes the caption's width to increase (Firefox and Chrome); vice-versa the caption's contents cause the table's width to increase in Chrome but not Firefox. (Play with adding widths to this testcase.)

(I think this doesn't happen with top-outside and bottom-outside captions which represent the CSS 2.0 top and bottom rather than their redefinition in 2.1... and which we agreed to add for implementations (Gecko) that had actually implemented the 2.0 definitions... but I haven't tested.)

@dbaron
Copy link
Member Author

dbaron commented Jul 26, 2018

Or, to put it another way, I don't think making this work for captions in particularly easier/harder than it is for table cells; it seems odd to allow one but not the other.

That said, it's also not clear to me why this isn't allowed for cells.

@frivoal
Copy link
Collaborator

frivoal commented Jul 27, 2018

That said, it's also not clear to me why this isn't allowed for cells.

Because the effect would be something like setting the table cell's width and height to 0 (if they're not otherwise specified, or to what they're specified, if anything), then layout out the content of the cell without resizing it.

That cannot be done today, as table cells are always enlarged to fit their in flow content, which never overflows, and the width/height properties act more like min-width/min-height. Adding support for contain:size on table cells would therefore mean that we'd need to change how table layout works, which nobody expressed interest in doing.

Unlike table cells, on table captions you can set a width and height, can cause overflow if you set them too small (or to 0). So if contain:size is applied to a table caption with a definite size, you just do the layout with that size, and if it is applied to a table caption without a definite size, you do the layout with the captions's height being 0 and the caption's width being the fill-available width to the table size (where the table's size is not influenced by the intrinsic size of the captions's content, since it's contained away.)

@Loirooriol
Copy link
Contributor

it's also not clear to me why this isn't allowed for cells.

See #1791

@frivoal
Copy link
Collaborator

frivoal commented Aug 24, 2018

I would like to close with no change. Agenda+

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed maybe 'contain-size' shouldn't apply to display:table-caption?, and agreed to the following:

  • RESOLVED: close with an explanation note in the spec and no change
The full IRC log of that discussion <dael> Topic: maybe 'contain-size' shouldn't apply to display:table-caption?
<dael> github: https://github.com//issues/2952#issuecomment-415890334
<dael> florian: This was raised by dbaron because size containment is desc as not apply to table parts. Table caption is not a table part. It is intentional.
<dael> florian: Table cells and the like need no size containment because general table layout you can't make it smaller then inflow content. trying to do so through containment wouldn't work unless we define how it works in terms of layout. Table caoptions do not have that limitation. No strong reason for it to have size containment not work
<dael> florian: Therefore I propose close no change.
<dael> astearns: Even if your reasoning is accepted I think there should be a note
<dael> florian: Perfectly reasonable, yes. Thanks
<dael> astearns: dbaron does it make sense to you?
<dael> dbaron: I guess...I'm still not convinced table captions are that different in characteristics that matter
<dael> florian: If you take a tbale cell with some content with widht 0 it won't have a 0 width. For a caption it will. That's what matters here
<dael> dbaron: Table cell with div inside div can be 0.
<dael> florian: On table cell yes
<dael> dbaron: Interesting thing is how sizes interact rather then how sizes interact with content
<dael> florian: Size containment changes how you find the size. How it influences things around doesn't change.
<dael> dbaron: IN both cases you compute the size in a larger process. You're saying contain size means contents don't influencec size.
<dael> florian: Yes you size as if empty, then layout content without changing that resolved size.
<dael> florian: It is an undefined operation on table cells, defined on table captions.
<dael> dbaron: I'm okay with that
<dael> astearns: Objections to close with an explanation note in the spec and no change?
<dael> RESOLVED: close with an explanation note in the spec and no change

@frivoal frivoal added Agenda+ Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. Closed Rejected as Wontfix by CSSWG Resolution Needs Edits labels Aug 29, 2018
@frivoal
Copy link
Collaborator

frivoal commented Aug 29, 2018

Marked as needs edits to add the note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants