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

Re: [CSSWG] Minutes and Resolutions 2010-04-21

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 24 May 2010 11:12:03 -0700
Message-ID: <AANLkTinu-CWfetX5mIqceufAPvp0ldW3grg4bRStI9cO@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "www-style@w3.org" <www-style@w3.org>
On Fri, May 21, 2010 at 8:23 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 5/21/10 7:25 PM, Tab Atkins Jr. wrote:
>>
>> <div display:table>
>>   <anon display:table-row>
>>     <div display:table-cell/>
>>   </anon>
>>   <div position:absolute/>
>>   <div display:table-row/>
>> </div>
>
> One other comment.  This is not quite right not matter what, as far as I can
> tell.  The actual box tree parent of the abs pos box, at least in Gecko, is
> its containing block.  Which is only the table if that's set to be
> position:relative, of course.

Ah, then that's a difference between my conception of the box-tree and
yours.  Which is why we need a spec detailing the construction of the
box-tree.  ^_^

Okay, so, what if I didn't pay attention to anonymous boxes, and
worked only on the element-tree?  In that case, given this markup
again:

<div style="display: table">
  <div style="display: table-cell"/>
  <div style="position: absolute"/>
  <div style="display: table-row"/>
</div>

The second clause of the auto-positioning rules would trigger, making
the position the top-right corner of the first div.


Looking over the rules again, they need to be slightly rewritten if
I'm basing it purely on the element-tree, so as to do the right thing
in situations like this:

<div display:table>
  <div display:block/>
  <div position:absolute/>
  <div display:block/>
</div>

After drawing some more diagrams, looks like these are the rules we need:


If an abspos element meets one of the following criteria:
  1. It has two immediate siblings, and both are display:table-* (not
display:table).
  2. It has one immediate sibling, that sibling is display:table-*
(not display:table), and its parent is display:table or
display:table-*.
  3. It has no siblings, and its parent is display:table or display:table-*.

...then use the first of the following rules that matches to determine
the auto position of the element:
  1. If its following sibling is display:table-cell, the auto position
is the upper right of the border box of the sibling.
  2. If its preceding sibling is display:table-cell, the auto position
is the upper left of the border box of the sibling.
  3. If its following sibling is display:table-row, the auto position
is the upper right of the border box of the sibling.
  4. If its preceding sibling is display:table-row, the auto position
is the upper left of the border box of the sibling.
  5. If its following sibling is
display:table-[row|header|footer]-group, the auto position is the
upper right of the border box of the sibling.
  6. If its preceding sibling is
display:table-[row|header|footer]-group, the auto position is the
upper left of the border box of the sibling.
  7. The auto position is the upper right of the content area of its parent.

These rules cover all cases (I made an exhaustive list), don't depend
on the behavior of the table-repair algorithm (as it operates only on
the element-tree), and should always give the most reasonable
behavior.

~TJ
Received on Monday, 24 May 2010 18:12:59 GMT

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