Re: [CSS21] Another ambiguity in the definition of "containing block"

On 09/27/2009 01:24 PM, Boris Zbarsky wrote:
> Consider the following testcase:
>
> <!DOCTYPE html>
> <body>
> <div style="height: 200px;">
> Text
> <div style="float: left; height: 50%; width: 100px;
> background: green"></div>
> More text
> <div>x</div>
> Text
> <div style="float: left; height: 50%; width: 100px;
> background: orange"></div>
> More text
> </div>
> </body>
>
> In current browsers I see the following behavior:
>
> Gecko: Two floating 100px by 100px squares (one green, one orange).
> Opera 10: As Gecko.
> IE8: As Gecko.
>
> Webkit: No visible squares; the offsetHeight of the floating divs is
> reported as 0.
>
> If the "<div>x</div>" is removed, then Webkit's rendering changes to
> match the other browsers.
>
> I believe the issue is a disagreement over section 10.1 item 2. Webkit
> is using the anonymous block box created per section 9.2.1.1 to contain
> the text as the containing block for the float. If one assumes that the
> float and the text around it have the same ancestor boxes (which seems
> like an eminently reasonable assumption), then this interpretation makes
> sense. If this item is not actually talking about boxes but rather means
> "the box generated by the nearest block-level ancestor element", then
> it's just ambiguous as to which box is meant here.

Proposed wording:

Add to section 9.2.1.1 <http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level>:

   | Anonymous block boxes are ignored when resolving percentage values
   | that would refer to it: the closest non-anonymous ancestor box is
   | used instead. For example, if the child of the anonymous block box
   | inside the DIV above needs to know the height of its containing block
   | to resolve a percentage height, then it will use the height of the
   | containing block formed by the DIV, not of the anonymous block box.

Because that's the best I can come up with here.

~fantasai

Received on Tuesday, 13 July 2010 21:01:14 UTC