Bug 68068 - [test case] clear:both not handled correctly (regression)
Summary: [test case] clear:both not handled correctly (regression)
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml renderer (show other bugs)
Version: 4.0
Platform: unspecified Linux
: NOR grave
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 70930 73462 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-11-12 21:46 UTC by Shift
Modified: 2004-01-25 22:12 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
First testcase (744 bytes, text/html)
2004-01-11 16:35 UTC, Shift
Details
Second testcase (2.25 KB, text/html)
2004-01-11 16:36 UTC, Shift
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shift 2003-11-12 21:46:58 UTC
Version:           4.0 (using KDE 3.1.93 (CVS >= 20031028), Mandrake Linux Cooker i586 - Cooker)
Compiler:          gcc version 3.3.1 (Mandrake Linux 9.2 3.3.1-4mdk)
OS:          Linux (i686) release 2.4.22-16mdk

There is a regression in the CVS khtml engine.

The clear:both is broken.

Try http://perso.wanadoo.fr/shift/kde-bug/clear-both.html

The BOTTOM box will be under the level of the TOP-RIGHT.

It is a very important regression :(
Comment 1 Shift 2003-11-12 23:36:13 UTC
Another example :
http://perso.wanadoo.fr/shift/kde-bug/clear-both2.html

Here you can see that the box 3 "believe" that the floating box 2 is on the left of it.

This bug completely broke the layout of my website : http://shift.free.fr/
Please help !!!! :)

Thanks,

Franck 
Comment 2 Marcus Williams 2004-01-06 15:55:25 UTC
This breaks quite a few layouts that use floated images - but only those that try the clear _outside_ the containing element:

<p>
 <img style="float:left" src="/some/image">
 some small paragraph such that the image hangs out of the paragraph bounding box by a few ems...
</p>
<div style="clear:both"></div>
<p>
 <img style="float:left" src="/some/image">
 some small paragraph such that the image hangs out of the paragraph bounding box by a few ems...
</p>
<div style="clear:both"></div>

The second paragraph should be below the image, not to the right of it.
Comment 3 patrick 2004-01-11 05:12:40 UTC
I hope I have correctly identified this as "the same bug"...

This bug also breaks the node entry form in Drupal (http://www.drupal.org) as the textarea for the body is shifted to the right off the screen. No scrollbar is displayed...

I have reduced the page into a (IMO) minimal testcase:

<div style="float:left; border:blue thin solid;">float: left</div>
<div style="clear:both; border:red thin solid;">clear: both</div>

The "clear: both" text should be exactly below the "float:left", not indented to the right...
Comment 4 Stephan Kulow 2004-01-11 16:20:26 UTC
Shift: please attach your test cases here - test cases get lost just too easy otherwise
Comment 5 Shift 2004-01-11 16:35:59 UTC
Created attachment 4099 [details]
First testcase

Here is the first testcase in attachement
Comment 6 Shift 2004-01-11 16:36:43 UTC
Created attachment 4100 [details]
Second testcase

Here is the second testcase in attachement
Comment 7 Shift 2004-01-24 08:19:24 UTC
The second test case seems to be OK now.
Comment 8 Stephan Kulow 2004-01-25 17:27:32 UTC
*** Bug 73462 has been marked as a duplicate of this bug. ***
Comment 9 Stephan Kulow 2004-01-25 17:27:59 UTC
*** Bug 70930 has been marked as a duplicate of this bug. ***
Comment 10 Dirk Mueller 2004-01-25 22:12:13 UTC
Subject: kdelibs/khtml

CVS commit by mueller: 

* rendering/render_block.cpp (positionNewFloats): when somebody says
clear: both;, he usually means it (#68068).
CCMAIL: 68068-done@bugs.kde.org


  M +3 -0      ChangeLog   1.185
  M +7 -5      rendering/render_block.cpp   1.23


--- kdelibs/khtml/ChangeLog  #1.184:1.185
@@ -1,4 +1,7 @@
 2004-01-25  Dirk Mueller  <mueller@kde.org>
 
+        * rendering/render_block.cpp (positionNewFloats): when somebody says
+        clear: both;, he usually means it (#68068).
+
         * html/html_objectimpl.cpp (renderAlternative): give the alternative rendering
         some time to avoid ugly deletion races.

--- kdelibs/khtml/rendering/render_block.cpp  #1.22:1.23
@@ -1361,8 +1361,12 @@ void RenderBlock::positionNewFloats()
         if (ro - lo < fwidth)
             fwidth = ro - lo; // Never look for more than what will be available.
-        if (o->style()->floating() == FLEFT)
-        {
+
             if ( o->style()->clear() & CLEFT )
                 y = kMax( leftBottom(), y );
+        if ( o->style()->clear() & CRIGHT )
+            y = kMax( rightBottom(), y );
+
+        if (o->style()->floating() == FLEFT)
+        {
             int heightRemainingLeft = 1;
             int heightRemainingRight = 1;
@@ -1380,6 +1384,4 @@ void RenderBlock::positionNewFloats()
         else
         {
-            if ( o->style()->clear() & CRIGHT )
-                y = kMax( rightBottom(), y );
             int heightRemainingLeft = 1;
             int heightRemainingRight = 1;
@@ -1786,5 +1788,5 @@ void RenderBlock::markAllDescendantsWith
 bool RenderBlock::checkClear(RenderObject *child)
 {
-    //kdDebug( 6040 ) << "checkClear oldheight=" << m_height << endl;
+    //kdDebug( 6040 ) << "checkClear on child " << child << " oldheight=" << m_height << endl;
     int bottom = 0;
     switch(child->style()->clear())