Re: [CSS21] Proposal for a replacement for section 17.2.1 (table anonymous objects)

On 03/30/2010 09:54 PM, Boris Zbarsky wrote:
> On 3/30/10 12:44 PM, fantasai.lists@inkedblade.net wrote:
>> Ah, right. *rereads stuff a few times* Um. Remind me again why my
>> original
>> proposal doesn't handle Item 2 of
>> http://lists.w3.org/Archives/Public/www-style/2009May/0213.html
>> ?
>>
>> Step 1: Leading and trailing white space in the table<div> is removed.
>> Step 2.1: The entire contents of the table is wrapped in a table row.
>> Step 2.2: Nothing happens
>> Step 2.3: The middle<div> is wrapped in a table cell.
>> Step 3: Nothing happens.
>> Result: 1 table, 1 row, 3 cells
>>
>> http://lists.w3.org/Archives/Public/www-style/2010Mar/0489.html
>
> Er, yes. I clearly misread something.... Good catch!
>
> I just read through your proposal carefully again, and it seems to match
> the behavior my proposal produces as far as I can tell.
>
> One remaining issue: with the modification to your definition of
> consecutive boxes, at what point does the whitespace get dropped in the
>
> <div style="white-space: pre">
> <span style="display: table-cell">a</span>
> <span style="display: table-cell">b</span>
> </div>
>
> testcase?

Right. Need a Step 1.4. Here's the proposal with all changes, let me know if
it's correct:

Replace the list of rules in 17.2.1 with the following:

   | For the purposes of these rules, the following terms are defined:
   |
   |   row group box
   |     A 'table-row-group', 'table-header-group', or 'table-footer-group'
   |   proper table child
   |     A 'table-row' box, row group box, 'table-column' box, 'table-column-group'
   |     box, or 'table-caption-box'.
   |   proper table row parent
   |     A 'table' or 'inline-table' box or row group box
   |   internal table box
   |     A 'table-cell' box, 'table-row' box, row group box, 'table-column' box,
   |     or 'table-column-group' box.
   |   tabular container
   |     A 'table-row' box or proper table row parent
   |   consecutive
   |     Two sibling boxes are consecutive if they are both in flow and have no
   |     intervening in-flow siblings other than, optionally, an anonymous inline
   |     containing only white spaces. A sequence of sibling boxes is consecutive
   |     if each box in the sequence is consecutive to the one before it in the
   |     sequence.
   |
   | The following steps are performed in three stages.
   |
   |   1. Remove irrelevant boxes:
   |       1.1 All child boxes of a 'table-column' parent are treated as if
   |           they had 'display: none'.
   |           [new]
   |       1.2 If a child C of a 'table-column-group' parent is not a
   |           'table-column' box, then it is treated as if it had
   |           'display: none'.
   |           [new]
   |       1.3 If a child C of a tabular container P is an anonymous inline box
   |           that contains only white space, and its immediately preceding
   |           and following siblings, if any, are proper table descendants of P
   |           and are either 'table-caption' or internal table boxes,
   |           then it is treated as if it had 'display: none'.
   |           A box D is a proper table descendant of A if D can be a descendant
   |           of A without causing the generation of any intervening 'table' or
   |           'inline-table' boxes.
   |           [current rule 5, adjusted to match bz]
   |       1.4 If a box B is an anonymous inline containing only white space, and
   |           it has two immediate siblings both of which are internal table boxes,
   |           then it is treated as if it had 'display: none'.
               [new]
   |
   |   2. Generate missing child wrappers:
   |       2.1 If a child C of a 'table' or 'inline-table' box is not a proper
   |           table child, then generate an anonymous 'table-row' box around C
   |           and all consecutive siblings of C that are not proper table children.
   |           [current rule 6]
   |       2.2 If a child C of a row group box is not a 'table-row' box, then
   |           generate an anonymous 'table-row' box around C and all consecutive
   |           siblings of C that are not 'table-row' boxes.
   |           [current rule 7]
   |       2.3 If a child C of a 'table-row' box is not a 'table-cell',
   |           then generate an anonymous 'table-cell' box around C and all
   |           consecutive siblings of C that are not 'table-cell' boxes.
   |           [current rule 8]
   |
   |   3. Generate missing parents:
   |        3.1 For each 'table-cell' box C in a sequence of consecutive internal
   |            table and 'table-caption' siblings, if C's parent is not a
   |            'table-row' then generate an anonymous 'table-row' box around C
   |            and all consecutive siblings of C that are 'table-cell' boxes.
   |            [current rule 1]
   |        3.2 For each proper table child C in a sequence of consecutive proper
   |            table children, if C is misparented then generate an anonymous
   |            'table' or 'inline-table' box T around C and all consecutive
   |            siblings of C that are proper table children. (If C's parent is
   |            an 'inline' box, then T must be an 'inline-table' box; otherwise
   |            it must be a 'table' box.)
   |              * A 'table-row' is misparented if its parent is neither
   |                a row group box or a 'table' or 'inline-table' box.
   |              * A 'table-column' box is misparented if its parent is neither
   |                a 'table-column-group' box nor a 'table' or 'inline-table' box.
   |              * A row group box, 'table-column-group' box, or 'table-caption'
   |                box is misparented if its parent is neither a 'table' box nor
   |                an 'inline-table' box.
   |            [current rules 2, 3, 4]

~fantasai

Received on Wednesday, 31 March 2010 06:39:56 UTC