[CSS21] Concern about anonymous table objects and whitespace

Consider the following markup (assuming the usual default HTML styling):

   <body style="white-space: pre">
     <div style="display:table-cell">One</div>
     <div style="display:table-cell">Two</div>

with the whitespace exactly as it is in the example.  Let us denote the 
whitespace-only Text node between the two HTMLDivElement nodes by the letter W.

What is the correct rendering?

Per section 16.6.1 [1], any text that is "directly contained inside a block 
element" is treated as an anonymous inline.  Does this apply to W?

Per section 17.2.1 [2], "If the parent P of a 'table-cell' box T is not a 
'table-row', a box corresponding to a 'table-row' will be generated between P 
and T. This box will span all consecutive 'table-cell' sibling boxes of T."  In 
this case, is there a single table-row box?  Or are there two table-row boxes? 
If there is a single table-row, how many table-cell boxes does it contain?

How are these answers affected if the Text node contains non-whitespace 
characters?  And why?  How are they affected if the "white-space" rule is 
removed?  And why?

As far as I can see, the box tree is constructed before section 16.6.1 takes 
effect, so the white-space rule should not affect the box tree.  At the same 
time, if the second <div style="display: table-cell"> were not there, the text 
for node W would most definitely be rendered (e.g. if other text came after it, 
it would take up some space before that text).

This came up because I was looking at Gecko's code for generating the anonymous 
table boxes, and I have to be honest: I don't see a sane way to make this work 
short of just saying that the Text node is treated as an inline box and that 
therefore this example should have two table rows, each containing a single 
table cell.  That seems to defeat the "will span all consecutive" business in 
anonymous table object generation, though, since people do want to put 
whitespace in their markup.


[1] http://www.w3.org/TR/CSS21/text.html#white-space-model
[2] http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes

Received on Friday, 3 August 2007 02:27:35 UTC