Re: Issue with margin-collapse-clear-012.htm and margin-collapse-clear-013.htm

On Thu, Oct 24, 2013 at 7:51 PM, Robert Hogan <robhogan@gmail.com> wrote:

> I'm questioning the expected rendering of this part of
> margin-collapse-clear-012.htm:
>
> <div id="parent">
>   <div id="float" style="float:left; height: 100px; width: 100px;
> background-color:blue;"></div>
>   <div id="self-collapsing-with-clearance" style="clear: both;
> margin-top: 40px; margin-bottom:80px"></div>
>   <div id="following-sibling" style="margin-bottom:140px;"></div>
> </div>
>
> The test results expect "self-collapsing-with-clearance" to receive a
> clearance of 60px - this is a result of subtracting the margin-top
> from the height of the float it has to clear (100px - 40px).
>
> However I believe the correct clearance is 20px. I say this because
> the margins in "self-collapsing-with-clearance" collapse together
> giving a collapsed margin-top value of 80px (max(margin-top,
> margin-bottom)) and it is this value that has to be used to determine
> the clearance: 100px - 80px = 20px
>


Hi Robert,

I believe the test is correct.

It's true that the margins of "self-collapsing-with-clearance" collapse
together to a value of 80px, but the clearance is added:
"to place the (top) border edge of the block even with the bottom outer
edge of the lowest float that is to be cleared"  (from
http://www.w3.org/TR/CSS2/visuren.html#flow-control  after the part you
mentioned).

Now where is the "top border edge" of a self collapsing block?
For our case the relevant part is at
http://www.w3.org/TR/CSS2/box.html#collapsing-margins towards the end:
"The position of the element's top border edge is the same as it would have
been if the element had a non-zero bottom border"

So the margins of our "self-collapsing-with-clearance" collapse together to
80px and the top border edge of the box is at 40px in the middle of that.
Clearance has to be added to this position, not to the whole 80px.  So
clearance is 60px as stated in the test, not only 20px.

Same thing for the other test margin-collapse-clear-012.htm.

I hope this is clear and correct (each time I reread these parts of the
spec and try to apply them a non trivial case, I found this operation
difficult).


On Thu, Oct 24, 2013 at 3:11 AM, Gérard Talbot
<css21testsuite@gtalbot.org>wrote:
> I can see 1 comment (lines 96 to 98) in margin-collapse-clear-013.htm
which is not right though.

Sure! We probably copied this comment from the previous test, forgetting to
adapt it.
It should say:

(140px - 40px) :  part of #clear-left's margin-bottom exceeding
#clear-left's margin-top

or something like that.


Bruno

Received on Saturday, 26 October 2013 16:31:52 UTC