Repository navigation
[css-display] What owns display types, elements or boxes? #1480
Description
Some quotes suggest that display types are owned by boxes:
Boxes [...]. They’re often referred to by their display type
The display property defines box’s display type
the principal box’s inner display type defaults to flow
the principal box’s outer display type defaults to block.
table-cell boxes have a flow-root inner display type
table-caption boxes have a flow-root inner display type.
Boxes with layout-specific display types generate anonymous wrapper boxes
sets the box’s outer display type to block or inline (respectively)
If a block flow box is inlinified, its inner display type is set to flow-root
If an inline flow box is inlinified, it recursively inlinifies all of its in-flow children
If a layout-internal box is blockified, its inner display type converts to flow
A run-in box with a flow inner display type inlinifies its contents.
A non-replaced inline-level box whose inner display type is flow.
Any inline-level box whose inner display type is not flow establishes a new formatting context of the specified inner display type.
Some quotes suggest that display types are owned by elements (including ::before, ::after and ::marker pseudo-elements):
The inner display of a replaced element
The <display-outside> keywords specify the element’s outer display type
the element’s inner display type defaults to flow.
The <display-inside> keywords specify the element’s inner display type
the element’s outer display type defaults to block
both the inner display type and the outer display type of elements using these display values are set to the given keyword.
Elements with either of these values do not have inner or outer display types
The root element’s display type is always blockified.
If the element [...]. Otherwise, it is made to establish a BFC by changing its inner display type to flow-root.
The difference is important because a single element can generate multiple boxes, e.g. an element with display: block table generates a table wrapper box and a table box. Do these boxes have display types? If they do, I guess the table wrapper box has block flow-root and the table box has block table. But then, wouldn't the table box generate another table wrapper box according to https://drafts.csswg.org/css-display-3/#valdef-display-table?
Activity
[-][css-display] What owns dysplay types, elements or boxes?[/-][+][css-display] What owns display types, elements or boxes?[/+]tabatkins commentedon Jun 12, 2017
Both. Elements have display types, which they use to figure out what boxes to generate; these boxes also have display types.
We probably do need to be a little more precise in this terminology.
Loirooriol commentedon Jun 12, 2017
I think elements (and pseudo-elements) should have these characteristics:
inline,block,run-in, <layout-internal>flow,flow-root,table,flex,grid,ruby, <layout-internal>And boxes should have these characteristics:
Of course there is a lot of overlap, e.g. an
inlineouter display type produces an inline-level box (in flow layout). Butrun-inalso generates an inline-level box (at some other place, or with some extra box wrapper).fantasai commentedon Jul 11, 2017
No, table elements generate two boxes: a table wrapper box and a table box. The table wrapper box isn't generated as a result of a naked table box being generated (that just never happens), so there's no recursion.
Yes, we need to clarify this point a bit... Fixed in 76a59eb
This is a good summary. We are not quite so precise as to have display types only used to describe elements, but being a little handwavy on this point doesn't seem to be an actual problem. The second set of terms are fairly rigorously defined.
Let us know if you still think there's a problem.
Loirooriol commentedon Jul 11, 2017
Thanks, problem fixed. A bit of wandwaving may be OK in some cases, but technically I think display types should belong to elements (and pseudo-elements), as they do now.