Rendering bug w/ float, div (block)
Kester Maddock
Christopher.Maddock.1 at uni.massey.ac.nz
Wed Feb 12 23:35:11 GMT 2003
Hi,
I have found what I think is a bug in khtml's rendering. When elements with
display: block are asked to flow past an element with float: left, one of the
margin parameters is repeatedly applied, so the block elements get
increasingly mispositioned.
Maybe some code will clear this up: :)
<html>
<head>
<style type="text/css">
<!--
.block {
border: 1px solid blue;
margin: 10px;
width: 100mm;
display: block;
}
.floater {
border: 1px solid black;
display: block;
width: 30mm;
height: 100mm;
float: left;
}
-->
</style>
</head>
<body>
<div>
<div class="floater">This text is floating left. float float float, left left
left.</div>
<div class="block">the text in these blocks with blue borders should line up
along the left edge.</div>
<div class="block">block</div>
<div class="block">block</div>
<div class="block">block</div>
<p>blah blah</p>
</div>
</body>
</html>
The fix I found for this is as follows:
Index: rendering/render_flow.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_flow.cpp,v
retrieving revision 1.327
diff -u -r1.327 render_flow.cpp
--- rendering/render_flow.cpp 10 Feb 2003 14:09:45 -0000 1.327
+++ rendering/render_flow.cpp 12 Feb 2003 11:44:57 -0000
@@ -1067,7 +1067,6 @@
nf->endY = r->endY - offset;
nf->left = r->left - xoff;
if ( !child ) {
- nf->left -= marginLeft();
nf->noPaint = true;
}
nf->width = r->width;
This should remove a line from RenderFlow::addOverHangingFloats.
Cheers,
Kester
More information about the kfm-devel
mailing list