Small test case for bug in renderer floats

Koos Vriezen koos.vriezen at xs4all.nl
Thu Aug 8 17:45:37 BST 2002


On Wed, 7 Aug 2002, Koos Vriezen wrote:

> Anyway, there is a third option :) Call RenderFlow::addOverHangingFloats
> not with '-child->xPos()' but with '-child->xPos() + child->marginLeft()'
> as xoffset param at line 455.
>
> Dirk, I also thought this second option make sense but it breaks google. I
> attached the diff for option number three.

To bring some sense to it, I propose the attached patch.
addOverHangingFloats is called from:

line 455 with xoff is '-child->xPos()'
line 939 with xoff is 'parent()->borderLeft() + parent()->paddingLeft()'
line 960 with xoff is 0 (flow being the prev here).

In addOverHangingFloats xoffset is used as
                special->left = r->left - xoff;
                if (flow != parent())
                    special->left += flow->marginLeft();

The test 'flow != parent()' succeeds in case 1 and 3 where it shouldn't in
case 1 (two times indented).
So get rid of this if part and call case 3 with -flow->marginLeft()

Koos
-------------- next part --------------
Index: rendering/render_flow.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_flow.cpp,v
retrieving revision 1.279
diff -u -3 -p -r1.279 render_flow.cpp
--- rendering/render_flow.cpp	2002/08/04 14:23:23	1.279
+++ rendering/render_flow.cpp	2002/08/08 16:33:06
@@ -957,7 +957,7 @@ RenderFlow::clearFloats()
         return; //html tables and lists flow as blocks
 
     if(flow->floatBottom() > offset)
-	addOverHangingFloats( flow, 0, offset );
+	addOverHangingFloats( flow, -flow->marginLeft(), offset );
 }
 
 void RenderFlow::addOverHangingFloats( RenderFlow *flow, int xoff, int offset, bool child )
@@ -997,8 +997,6 @@ void RenderFlow::addOverHangingFloats( R
 		special->startY = r->startY - offset;
 		special->endY = r->endY - offset;
 		special->left = r->left - xoff;
-		if (flow == parent())
-		    special->left += flow->marginLeft();
 		if ( !child ) {
 		    special->left -= marginLeft();
 		    special->noPaint = true;


More information about the kfm-devel mailing list