Skip to content

[css-display] What owns display types, elements or boxes? #1480

Closed

Description

@Loirooriol

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

  1. changed the title [-][css-display] What owns dysplay types, elements or boxes?[/-] [+][css-display] What owns display types, elements or boxes?[/+] on May 30, 2017
  2. tabatkins commented on Jun 12, 2017

    @tabatkins
    Member

    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.

  3. Loirooriol commented on Jun 12, 2017

    @Loirooriol
    ContributorAuthor

    I think elements (and pseudo-elements) should have these characteristics:

    • Outer display type: inline, block, run-in, <layout-internal>
    • Inner display type: flow, flow-root, table, flex, grid, ruby, <layout-internal>
    • Whether it generates a ::marker

    And boxes should have these characteristics:

    • Box-level: inline-level, block-level, flex-level, grid-level, <layout-internal>
    • Container type: inline box, block container, table wrapper box, table box, flex container, grid container, ruby container, <layout-internal>
    • Formatting context: none, inline, block, table, flex, grid, ruby

    Of course there is a lot of overlap, e.g. an inline outer display type produces an inline-level box (in flow layout). But run-in also generates an inline-level box (at some other place, or with some extra box wrapper).

  4. fantasai commented on Jul 11, 2017

    @fantasai
    Collaborator

    But then, wouldn't the table box generate another table wrapper box according to https://drafts.csswg.org/css-display-3/#valdef-display-table?

    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.

    But run-in also generates an inline-level box

    Yes, we need to clarify this point a bit... Fixed in 76a59eb

    I think elements (and pseudo-elements) should have these characteristics ...
    And boxes should have these characteristics ...

    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.

  5. Loirooriol commented on Jul 11, 2017

    @Loirooriol
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions