Re: Issue 138 proposed text

On Tue, Jul 13, 2010 at 9:37 PM, L. David Baron <dbaron@dbaron.org> wrote:
> On Thursday 2010-06-03 15:19 -0700, Tab Atkins Jr. wrote:
>> I suggest changing the last sentence to instead read:
>>
>> "When such an inline box is affected by relative positioning, the
>> relative positioning affects all the boxes that were originally
>> contained within the inline box, including the block box causing the
>> break."
>
> This seems like it might be too strong.  It seems like it might
> imply that floats inside the inline box are affected by the relative
> positioning, even though the inline box is not in their containing
> block chain.  (See the test at
> http://dbaron.org/css/test/2010/css21-issue-138-simple-float-test ,
> which at least in Gecko and Chromium shows that floats are affected
> by the relative positioning of their containing block but not by an
> inline that is in their ancestor chain but inside their containing
> block.)

That's actually exactly what I was aiming for (that's what fantasai
and I were saying was preferred), but looking over this more closely,
I agree that that's crazy.  Boris' preferred rendering is the
appropriate way to handle this.

For reference, his testcase was:

<!DOCTYPE html>
<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>

And his expected rendering was:

       xxx
       aaa
bbb        ccc
       yyy

This rendering can be explained as everything originally (pre-relpos)
being laid out as:

xxx
aaa
bbbccc
yyy

Then the relpos on the outermost span takes effect, shifting
everything over *except the float*.  The float stays where it is
because it is positioned solely in relation to its containing block,
not its parent, and in this case its containing block is the ICB.

You can make the float move with the rest; you just have to force the
outermost span to generate a containing block, such as by making it
block or inline-block, or by using abspos instead of relpos.

This appears to be the most consistent approach to me.  Dunno whether
it's best, but I don't want to try and resolve the issues that may
arise from treating floats inconsistently here.

> However, floats inside a block inside the inline probably should be,
> since their containing block is affected by the relative positioning
> (which is more the point of this issue).

Yes.

> Would it be better to say simply that the relative positioning "also
> affects the block box contained by the inline" instead of "also
> affects the block box"?

That might be sufficient.  Boris, does that sound like it resolves
anything?  Or would you prefer a bit more of a rewrite that makes it
more explicit?

~TJ

Received on Friday, 16 July 2010 18:50:29 UTC