Bug 18346 - Desire to define "Block container element"
Desire to define "Block container element"
Status: ASSIGNED
Product: CSS
Classification: Unclassified
Component: CSS Level 2
unspecified
All All
: P2 normal
: ---
Assigned To: Bert Bos
public-css-bugzilla
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-21 10:43 UTC by Anton P
Modified: 2012-09-20 08:37 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anton P 2012-07-21 10:43:10 UTC
The term "Block container element" is not defined in CSS21 (although block container /box/ is, in 9.2.1.).

In places where the context is elements (such as the "Applies to" line of properties) we have tended to write "block containers", deliberately omitting the final word so as to make the phrase suitably ambiguous to work around the lack of definition. In some places we don't even make that effort: 10.8.1 refers to "block container elements" after the definition of the 'vertical-align' and 'line-height' properties and even links back to 9.2.1 where of course there is no definition.  The term "block container element" is likely to be useful in proposals to solve Bug 17778 and Bug 17782.
Comment 1 Anton P 2012-07-21 10:47:33 UTC
Proposal B:

  # 9.2 Controlling box generation
  #
  # The following sections describe the types of boxes that may be
  # generated in CSS 2.1. A box's type affects, in part, its behavior
  # in the visual formatting model. The 'display' property, described
  # below, specifies a box's type.
  #
  # <ins>Each _block-level element_<link to 9.2.1>, inline block,
  # inline table and table cell generates a *principal box* that contains
  # descendant boxes and generated content and is also the box involved
  # in any positioning scheme. Some block-level elements may generate
  # additional boxes in addition to the principal box: 'list-item'
  # elements. These additional boxes are placed with respect to the
  # principal box.</ins>
  #
  # 9.2.1 Block-level elements and block boxes
  #
  # *Block-level elements* are those elements of the source document
  # that are formatted visually as blocks (e.g., paragraphs). The
  # following values of the 'display' property make an element
  # block-level: 'block', 'list-item', and 'table'.
  #
  # <del>Block-level boxes are boxes that participate in a _block
  # formatting context_. Each block-level element generates a principal
  # block-level box that contains descendant boxes and generated
  # content and is also the box involved in any positioning scheme.
  # Some block-level elements may generate additional boxes in
  # addition to the principal box: 'list-item' elements. These
  # additional boxes are placed with respect to the principal box.</del>
  #
  # <ins>The principal box of a block-level element is a block-level
  # box. *Block-level boxes* are boxes that participate in a _block
  # formatting context_.</ins> Except for table boxes, which are
  # described in a later chapter, and <ins>the principal box of</ins>
  # replaced elements, a block-level box is also a block container box.
  # A *block container box* either contains only block-level boxes or
  # establishes an _inline formatting context_<link to 9.4.2> and thus
  # contains only _inline-level boxes_<link to 9.2.2>.  <del>Not all
  # block container boxes are block-level boxes: non-replaced inline
  # blocks and non-replaced table cells are block containers but not
  # block-level boxes.</del> Block-level boxes that are also block
  # containers are called block boxes.
  #
  # <ins>*Block container elements* are elements whose principal box
  # is a block container box. The following values of the
  # 'display' property make an element a block container: 'block',
  # 'list-item', 'table', 'inline-block', 'inline-table'.  Non-replaced
  # inline blocks and non-replaced table cells are block containers but
  # are not block-level.</ins>
  #
  # The three terms "block-level box," "block container box," and
  # "block box" are sometimes abbreviated as "block" where unambiguous. 


Note: the changes introduced in this proposal are limited to shuffling a couple of existing sentences around and introducing two new concepts:

(i) The definition of "principal block-level box" is extended to "principal box" for a wider range of elements (inline block, inline table and table cell in addition to block-level elements).  This has no effect on the rest of the spec, since the only cases where the principal box is referred to is in the context of block-level elements/boxes.

(ii) The term "block container element" is introduced to mean an element whose principal box is a block container box, ie a block, list-item, inline-block, table, inline-table or table-cell in CSS21.


Note: all instances in the spec where "block container(s)" is used without the word "box" in a context where one expects elements to be referred to, and all instances where "block container element(s)" is already used, remain correct with this proposal.


Note: The part about list items and their additional box has been moved to 9.2.  Whilst not strictly necessary for this proposal since that sentence is currently about block-level elements, the new location permits a further clarification that inline-level tables also generate an additional box, which aids proposals for Bug 17782.


Proposal: http://lists.w3.org/Archives/Public/www-style/2012Jul/0415.html
Comment 2 Anton P 2012-07-21 10:48:49 UTC
The following proposal factors the block container stuff out to 9.2 in addition to the principal box stuff factored out in Proposal B.

Proposal C:

  # 9.2 Controlling box generation
  #
  # The following sections describe the types of boxes that may be
  # generated in CSS 2.1. A box's type affects, in part, its behavior
  # in the visual formatting model. The 'display' property, described
  # below, specifies a box's type.
  #
  # <ins>Each _block-level element_<link to 9.2.1>, inline block,
  # inline table and table cell generates a *principal box* that
  # contains descendant boxes and generated content and is also the
  # box involved in any positioning scheme. Some block-level elements
  # may generate additional boxes in addition to the principal box:
  # 'list-item' elements. These additional boxes are placed with
  # respect to the principal box.</ins>
  #
  # <ins>*Block container elements* are non-replaced elements whose
  # principal box is a block container box. A *block container box*
  # either contains only _block-level boxes_<link to 9.2.1> or
  # establishes an _inline formatting context_<link to 9.4.2> and thus
  # contains only _inline-level boxes_<link to 9.2.2>. The following
  # values of the 'display' property make a non-replaced element a
  # block container: 'block', 'list-item', 'table', 'inline-block',
  # 'inline-table'.</ins>
  #
  #
  # 9.2.1 Block-level elements and block boxes
  #
  # *Block-level elements* are those elements of the source document
  # that are formatted visually as blocks (e.g., paragraphs). The
  # following values of the 'display' property make an element
  # block-level: 'block', 'list-item', and 'table'.
  #
  # <del>Block-level boxes are boxes that participate in a block
  # formatting context. Each block-level element generates a principal
  # block-level box that contains descendant boxes and generated
  # content and is also the box involved in any positioning scheme.
  # Some block-level elements may generate additional boxes in
  # addition to the principal box: 'list-item' elements. These
  # additional boxes are placed with respect to the principal box.</del>
  #
  # <ins>The principal box of a block-level element is a block-level
  # box. *Block-level boxes* are boxes that participate in a block
  # formatting context.</ins> Except for table boxes, which are
  # described in a later chapter, and <ins>the principal box of</ins>
  # replaced elements, a block-level box is also a block container box.
  # <del>A block container box either contains only block-level boxes
  # or establishes an inline formatting context and thus contains only
  # inline-level boxes. Not all block container boxes are block-level
  # boxes: non-replaced inline blocks and non-replaced table cells are
  # block containers but not block-level boxes.</del> Block-level boxes
  # that are also block containers are called block boxes.
  #
  # <ins>Non-replaced inline blocks and non-replaced table cells are
  # block containers but are not block-level.</ins>
  #
  # The three terms "block-level box," "block container box," and
  # "block box" are sometimes abbreviated as "block" where unambiguous.


The Notes for Proposal B above apply to Proposal C too.  Proposal C also reiterates the fact that block container elements are non-replaced.


Proposal: http://lists.w3.org/Archives/Public/www-style/2012Jul/0504.html
Comment 3 Anton P 2012-07-23 23:10:37 UTC
Proposal C omitted 'table-cell' from the list of 'display' values which make a non-replaced element a block container element.  The following proposal corrects that by adding that single term to the list.

The following proposal factors the block container stuff out to 9.2 in addition
to the principal box stuff factored out in Proposal B.

Proposal D:

  # 9.2 Controlling box generation
  #
  # The following sections describe the types of boxes that may be
  # generated in CSS 2.1. A box's type affects, in part, its behavior
  # in the visual formatting model. The 'display' property, described
  # below, specifies a box's type.
  #
  # <ins>Each _block-level element_<link to 9.2.1>, inline block,
  # inline table and table cell generates a *principal box* that
  # contains descendant boxes and generated content and is also the
  # box involved in any positioning scheme. Some block-level elements
  # may generate additional boxes in addition to the principal box:
  # 'list-item' elements. These additional boxes are placed with
  # respect to the principal box.</ins>
  #
  # <ins>*Block container elements* are non-replaced elements whose
  # principal box is a block container box. A *block container box*
  # either contains only _block-level boxes_<link to 9.2.1> or
  # establishes an _inline formatting context_<link to 9.4.2> and thus
  # contains only _inline-level boxes_<link to 9.2.2>. The following
  # values of the 'display' property make a non-replaced element a
  # block container: 'block', 'list-item', 'table', 'inline-block',
  # 'inline-table', 'table-cell'.</ins>
  #
  #
  # 9.2.1 Block-level elements and block boxes
  #
  # *Block-level elements* are those elements of the source document
  # that are formatted visually as blocks (e.g., paragraphs). The
  # following values of the 'display' property make an element
  # block-level: 'block', 'list-item', and 'table'.
  #
  # <del>Block-level boxes are boxes that participate in a block
  # formatting context. Each block-level element generates a principal
  # block-level box that contains descendant boxes and generated
  # content and is also the box involved in any positioning scheme.
  # Some block-level elements may generate additional boxes in
  # addition to the principal box: 'list-item' elements. These
  # additional boxes are placed with respect to the principal box.</del>
  #
  # <ins>The principal box of a block-level element is a block-level
  # box. *Block-level boxes* are boxes that participate in a block
  # formatting context.</ins> Except for table boxes, which are
  # described in a later chapter, and <ins>the principal box of</ins>
  # replaced elements, a block-level box is also a block container box.
  # <del>A block container box either contains only block-level boxes
  # or establishes an inline formatting context and thus contains only
  # inline-level boxes. Not all block container boxes are block-level
  # boxes: non-replaced inline blocks and non-replaced table cells are
  # block containers but not block-level boxes.</del> Block-level boxes
  # that are also block containers are called block boxes.
  #
  # <ins>Non-replaced inline blocks and non-replaced table cells are
  # block containers but are not block-level.</ins>
  #
  # The three terms "block-level box," "block container box," and
  # "block box" are sometimes abbreviated as "block" where unambiguous.


The Notes for Proposal B above apply to Proposal D too.  Proposal D also
reiterates the fact that block container elements are non-replaced.


Proposal: based on http://lists.w3.org/Archives/Public/www-style/2012Jul/0504.html , adding 'table-cell' to the list of 'display' values giving rise to a block container element.
Comment 4 Alan Stearns 2012-08-01 17:13:46 UTC
(In reply to comment #3)

Should table-caption also be on the list?

Is a ::before {display:block} a "block container element"?
Comment 5 Anton P 2012-08-02 06:27:15 UTC
(In reply to comment #4)

I've replied on the public mailing list: http://lists.w3.org/Archives/Public/www-style/2012Aug/0054.html
Comment 6 Anton P 2012-09-20 08:30:29 UTC
Proposal F:

  : 9.2 Controlling box generation
  :
  : The following sections describe the types of boxes that may be
  : generated in CSS 2.1. A box's type affects, in part, its behavior
  : in the visual formatting model. The 'display' property, described
  : below, specifies a box's type.
  :
  : <MovedFrom9.2.1><DEL>Each block-level element generates</DEL>
  : <INS>Certain values of the 'display' property cause an element of
  : the source document to generate</INS> a
  : *principal <DEL>block-level</DEL> box* that contains descendant
  : boxes and generated content and is also the box involved in any
  : positioning scheme. Some <DEL>block-level</DEL> elements may
  : generate additional boxes in addition to the principal box:
  : 'list-item' elements. These additional boxes are placed with
  : respect to the principal box.</MovedFrom9.2.1>
  :
  : 9.2.1 Block-level elements and block boxes
  :
  : Block-level elements <DEL>are</DEL> <INS> – </INS> those elements of
  : the source document that are formatted visually as blocks (e.g.,
  : paragraphs)<DEL>.</DEL> <INS> – are elements which generate a
  : block-level principal box.</INS> <DEL>The following values</DEL>
  : <INS>Values</INS> of the 'display' property <INS>that</INS> make an
  : element block-level<DEL>:</DEL> <INS>include</INS> 'block',
  : 'list-item', and 'table'. <MovedFromBelow>*Block-level boxes* are
  : boxes that participate in a
  : _block formatting context_.</MovedFromBelow>
  :
  : <MovedToAbove>Block-level boxes are boxes that participate in a
  : block formatting context.</MovedToAbove> <MovedTo9.2>Each
  : block-level element generates a principal block-level box that
  : contains descendant boxes and generated content and is also the box
  : involved in any positioning scheme. Some block-level elements may
  : generate additional boxes in addition to the principal box:
  : 'list-item' elements. These additional boxes are placed with
  : respect to the principal box.</MovedTo9.2>
  :
  : <DEL>Except for table boxes, which are described in a later
  : chapter, and replaced elements, a block-level box is also a block
  : container box.</DEL> <INS>Most block-level boxes are also block
  : container boxes.</INS> A block container box either contains only
  : block-level boxes or establishes an
  : _inline formatting context_<link to 9.4.2> and thus contains only
  : _inline-level boxes_<link to 9.2.2>. <INS>An element whose
  : principal box is a block container box is a
  : *block container element*. Values of the 'display' property that
  : make a non-replaced element generate a block container include
  : 'block', 'list-item' and 'inline-block'.</INS> Not all block
  : container boxes are block-level boxes: non-replaced inline blocks
  : and non-replaced table cells are block containers but
  : <INS>are</INS> not block-level <DEL>boxes</DEL>. <INS>Similarly,
  : not all block-level boxes are block container boxes: in CSS2.1,
  : table boxes and replaced elements are can be block-level, but are
  : not block containers.</INS> Block-level boxes that are also block
  : containers are called block boxes.
  :
  : The three terms "block-level box," "block container box," and
  : "block box" are sometimes abbreviated as "block" where unambiguous.


  : 9.2.4 The 'display' property
  :
  : [...]
  :
  : The values of this property have the following meanings:
  :
  : block
  :   This value causes an element to generate a <INS>principal</INS>
  :   block box.
  :
  : inline-block
  :   This value causes an element to generate <DEL>an</DEL>
  :   <INS>a principal</INS> inline-level block container.
  :   <INS>(</INS>The inside of an inline-block is formatted as a block
  :   box, and the element itself is formatted as an atomic
  :   inline-level box.<INS>)</INS>


  : 17.4 Tables in the visual formatting model
  :
  : In terms of the visual formatting model, a table can behave
  : like a block-level (for 'display: table') or inline-level (for
  : 'display: inline-table') element.
  :
  : In both cases, the table generates a principal block
  : <INS>container</INS> box called the table wrapper box that
  : contains the table box itself and any caption boxes (in
  : document order). The table box is a block-level box that contains
  : the table's internal table boxes. The caption boxes are
  : <INS>principal</INS> 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. Whether the
  : caption boxes are placed before or after the table box is decided
  : by the 'caption-side' property, as described below.
  :
  : The table wrapper box is <DEL>a 'block' box if the table is
  : block-level</DEL> <INS>block-level for 'display: table'</INS>, and
  : <DEL>an 'inline-block' box if the table is inline-level</DEL>
  : <INS>inline-level for 'display: inline-table'</INS>. [...]

Notes

(1) The definition of "principal block-level box" is extended to
"principal box" for a wider range of elements (in CSS21: inline block,
inline table and table cell in addition to block-level elements). This
has no effect on the rest of the spec, since the only cases where the principal box is referred to is in the context of block-level elements/boxes.  The definition is moved to 9.2 since it is no longer specific to block-level elements.

(2) The term "block container element" is introduced to mean an
element whose principal box is a block container box (in CSS21:
block, inline-block, list-item, table, inline-table, table-caption, table-cell).

(3) Technical terms used are linked to their definitions further down the chapter.

(4) The term "block-level element", which is currently only fuzzily defined, is formally defined in 9.2.1 to mean an element whose principal box is block-level.  The incomplete list of 'display' values which make an element block-level is explicitly called out as non-exhaustive.

(5) The discussion of the relationship between block container boxes and block-level boxes is qualified as being specific to CSS21, thus making this section forwards-compatible with future levels.

(6) The description of the values of the 'display' property in 9.2.4 are made more careful, ensuring that generated boxes are explicitly stated to be principal boxes where necessary (thus ensuring that the spec is clear about which elements are block-level and/or block containers).  An existing sentence is parenthesized in the 'inline-block' value description, since it is both slightly woolly and redundant.

(7) A couple of tweaks are made to 17.4 (Tables in the visual formatting model) to ensure that the descriptions used tie in correctly with the other changes, eg as per (6) above.

(8) All instances in the spec where "block container(s)" is used without the
word "box" in a context where one expects elements to be referred to, and all
instances where "block container element(s)" is already used, remain correct
with this proposal.

(9) The part about list items and their additional box has been moved to 9.2. Whilst not strictly necessary for this proposal since that sentence is
currently about block-level elements, the new location permits a further
clarification that inline-level tables also generate an additional box, which
aids proposals for Bug 17782.
Comment 7 Anton P 2012-09-20 08:37:01 UTC
The WG resolved[1,2] to accept Proposal F in Comment 6, on the understanding that Bug 18930 be resolved too (at least in the case of inline elements) and that both resolutions proceed in parallel.

[1] http://lists.w3.org/Archives/Public/www-style/2012Sep/0369.html
[2] http://lists.w3.org/Archives/Public/www-style/2012Sep/0358.html