Re: [CSS21] Ambiguity in section 9.2.1.1 (anonymous block boxes)

Boris Zbarsky wrote:
> Section 9.2.1.1 has this to say:
> 
>  > 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. When such an inline box is affected by
>  > relative positioning, the relative positioning also affects the
>  > block box.
> 
> In that last sentence, it's not clear which box "the block box" refers 
> to.  In Gecko, it was interpreted to be the box contained by the inline 
> (which is the only "block box" discussed as such in this section).

Right. That's the interpretation I'd take as well.

> In Opera and Webkit it seems to have been interpreted to mean the two 
> anonymous boxes wrapped around the inline.  Or something.  It's not 
> clear that the behavior in Opera and Webkit can be told apart from not 
> applying the relative positioning to anything to any block boxes at all.
> 
> IE's behavior seems to match Gecko's (including what looks like a bug in 
> both to me).
> 
> What is this section _trying_ to say?

What it's trying to say, afaict, is that the entire contents of the span
is affected, as one unit, by the relative positioning despite the somewhat
quirky parenting.

> Testcase:
> 
> <!DOCTYPE html>
> <html>
>   <body>
>     <span style="position: relative; left: 100px">
>       xxx
>       <span style="display: block">
>         aaa
>       </span>
>       <span style="float: left">bbb</span>
>       <span style="display: block">
>         ccc
>       </span>
>       yyy
>     </span>
>   </body>
> </html>
> 
> I would expect this to render somewhat like so in Gecko once the bug I 
> mention is fixed:
> 
>         xxx
>         aaa
> bbb        ccc
>         yyy
> 
> The IE rendering (and current Gecko rendering) is:
> 
> 
>         xxx
>         aaa
>         bbbccc
>         yyy

This looks right to me.

(I assume
   aaa<br><span style="position: relative; left: 100px"><span style="float: right">bbb</span>aaa</span>
would render as
   |aaa
   |<--100px-->bbbccc
If it does, then I think the IE/Gecko rendering is the only one that makes sense.)

> The Opera/Webkit rendering is:
> 
>         xxx
> aaa
> bbbccc
>         yyy

This is definitely wrong per that section of the spec.

~fantasai

Received on Monday, 28 September 2009 20:05:15 UTC