W3C home > Mailing lists > Public > www-style@w3.org > August 2010

[CSS21] 9.2 Anonymous boxes

From: Anton Prowse <prowse@moonhenge.net>
Date: Sun, 01 Aug 2010 23:45:47 +0200
Message-ID: <4C55EB0B.8030700@moonhenge.net>
To: "www-style@w3.org" <www-style@w3.org>
Several issues arise concerning anonymous block boxes.


9.2.1 (Block-level elements and block boxes) says:[1]

   # Block-level elements (except for display 'table' elements, which are
   # described in a later chapter) generate a principal block box that
   # contains either only block boxes or only inline boxes.

9.2.1.1 (Anonymous block boxes) says:[2]

   # In a document like this:
   #
   # <DIV>
   #   Some text
   #   <P>More text
   # </DIV>
   #
   # (and assuming the DIV and the P both have 'display: block'), the DIV
   # appears to have both inline content and block content. To make it
   # easier to define the formatting, we assume that there is an
   # anonymous block box around "Some text".
   #
   # In other words: if a block box (such as that generated for the DIV
   # above) has another block box or run-in box inside it (such as the P
   # above), then we force it to have only block boxes and run-in boxes
   # inside it.

OK. But we also have the following from 16.6.1 (The 'white-space'
processing model)[3] (which will likely be moved to Ch.9; see [4]):

16.6.1:
   # Any text that is directly contained inside a block element (not
   # inside an inline element) should be treated as an anonymous inline
   # element.

Issue 1:

Does that mean that there's an anonymous inline box around "Some text"
or that there's one around "Some text <P>More text" (which would mean
that the rules for breaking an inline box around a block then come into
play)?  In fact it doesn't matter, since we end up with an anonymous
block containing an anonymous inline containing "Some text" in both
interpretations.  But what if it were
"Some text <SPAN>More text</SPAN> End text"?  In this case the two
interpretations – anonymous inline boxes around "Some text" and "End
text" or one anonymous inline box around everything – yield different
results.

I think the sentence from 16.6.1 says that it's the first
interpretation, in each case.  I'd be grateful for confirmation of that!


9.2.1.1:
   # When an inline box contains a block box, the inline box (and its
   # inline ancestors within the same line box) are broken around the
   # block. The line boxes before the break and after the break are
   # enclosed in anonymous boxes, and the block box becomes a sibling of
   # those anonymous boxes. [...]

Issue 2:

s/contains a block box/contains an in-flow block box/

since containing a float doesn't cause the inline content to be split
between two different blocks.


Issue 3:

What /does/ happen when an inline box contains a float?  Does the run of
inlines+floats in which it sits get wrapped in an anonymous block box
which becomes the sibling of the floats?  If so, this needs stating.


Issue 4:

Is it the case that, with the exception of an anonymous table box, an
anonymous block box contains either only block boxes or only inline
boxes, much like a principal block box?  (This is essentially the same
question I'm asking in [5] as part of the great box cleanup; we'll need
to ensure we get the same answer!)


9.2.1.1:
   # This model would apply in the following example if the following
   # rules:
   #
   # body { display: inline }
   # p    { display: block }
   #
   # were used with this HTML document:
   #
   # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
   # <HEAD>
   # <TITLE>Anonymous text interrupted by a block</TITLE>
   # </HEAD>
   # <BODY>
   # This is anonymous text before the P.
   # <P>This is the content of P.</P>
   # This is anonymous text after the P.
   # </BODY>
   #
   # The BODY element contains a chunk (C1) of anonymous text followed by
   # a block-level element followed by another chunk (C2) of anonymous
   # text. The resulting boxes would be an anonymous block box around the
   # BODY, containing an anonymous block box around C1, the P block box,
   # and another anonymous block box around C2.

Issue 5:

Why would there be an anonymous block box around the BODY?  Surely the
principal block box of the (implied[6]) HTML is what surrounds the
anonymous block box around C1, the principal block box of the P, and the
anonymous block box around C2.


[1] http://www.w3.org/TR/CSS2/visuren.html#block-boxes
[2] http://www.w3.org/TR/CSS2/visuren.html#anonymous-block-level
[3] http://www.w3.org/TR/CSS2/text.html#white-space-model
[4] http://lists.w3.org/Archives/Public/www-style/2010Jul/0440.html
[5] http://lists.w3.org/Archives/Public/www-style/2010Aug/0004.html
[6] http://www.w3.org/TR/html5/syntax.html#optional-tags

Cheers,
Anton Prowse
http://dev.moonhenge.net
Received on Sunday, 1 August 2010 21:47:29 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:30 GMT