Small test case for bug in renderer floats

Koos Vriezen koos.vriezen at xs4all.nl
Mon Jul 29 21:44:03 BST 2002


On Mon, 29 Jul 2002, Vadim Plessky wrote:

> On Monday 29 July 2002 2:43 pm, Koos Vriezen wrote:
> |  On Mon, 29 Jul 2002, Vadim Plessky wrote:
> |  > On Sunday 28 July 2002 5:15 pm, Koos Vriezen wrote:
> |  > |  This is rendered wrong
> |  > |    <html><body>
> |  > |     <div style="float:left;" border=1>div text<br>div text</div>
> |  > |     some text
> |  > |    </body></html>
> |  > |
> |  > |  Seems the float gets an extra left offset if the height is greater
> |  > | than height of surrounding text.
>
> and, BTW, problem is related not to the amount of text outside floating DIV,
> but to the heigh tof body.

Exactly and I think I found the cause. The test in
RenderFlow::layoutBlockChildren of RenderHtml
'if ( child->hasOverhangingFloats() )', where
hasOverhangingFloats() is defined as 'floatBottom() > m_height', succeeds
in this case. The child being the body.
Next it calls RenderFlow::addOverHangingFloats with
child, -child->xPos(), -child->yPos() and true for flow, xoff, offset and
child resp.
A new special is created with 'special->left' is set to 'r->left - xoff'
(becomes +10). The test 'if (flow != parent())' succeeds and
'special->left += flow->marginLeft()' is executed (becomes +20).
The next test 'if ( !child )' fails, but has no effect, since the if
clause 'special->left -= marginLeft()' does nothing for a RenderHtml.

Not sure what goes wrong here, but this makes the float be indented by the
body margin twice. First guess would be call
RenderFlow::addOverHangingFloats with child, 0, -child->yPos() and true.
Also helps for http://www.linuxplanet.com/linuxplanet/reviews/4315/1
reported by Hetz Ben Hamo on 18 July to this list.

> |
> |  > BTW: you forgot to close </td></tr> in your example
> |
> |  IMO those close tags are optional, see
> |  http://www.w3.org/TR/1999/REC-html401-19991224/struct/tables.html#h-11.2.5
> |
>
> They may be optional, but if you write testcase, it's better to use
> well-written HTML. I would prefer XHTML 1.0/1.1 over HTML x.y, validated by
> W3C Validator (in case you compare output with, say, Mozilla; rendering by MS
> IE is different story)

Will try to remember it the next time.

Koos







More information about the kfm-devel mailing list