Bug 135160

Summary: [test case] non standard CSS float: right rendering
Product: [Applications] konqueror Reporter: Olivier Trichet <nive>
Component: khtml rendererAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ana
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: HTML test case page
Patch

Description Olivier Trichet 2006-10-05 17:52:01 UTC
Version:            (using KDE KDE 3.5.4)
Installed from:    Debian testing/unstable Packages

On the test page (that will be submitted latter), the 2 boxes should share the same top and right
edges (cf. CSS 2.1, 9.5.1: The left outer edge of a left-floating box may not be to the left of the left edge of its containing block. An analogous rule holds for right-floating elements.), in konqueror they don't. Mozilla renders this correctly.

[imported from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=357017]
Comment 1 Olivier Trichet 2006-10-05 17:54:37 UTC
Created attachment 18022 [details]
HTML test case page
Comment 2 Allan Sandfeld 2006-10-05 19:21:49 UTC
Confirmed. Might be something to do with adding or subtracting the border width incorrectly..
Comment 3 Allan Sandfeld 2006-10-19 20:35:34 UTC
Created attachment 18194 [details]
Patch

This patch removes the constraints forcing floats not to make left overflow.
Comment 4 Allan Sandfeld 2006-10-26 21:21:20 UTC
SVN commit 599349 by carewolf:

Let floats overflow the left border when they should.
BUG:135160 


 M  +7 -4      render_block.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/render_block.cpp #599348:599349
@@ -1896,7 +1896,6 @@
                 _height = o->height() + o->marginTop() + o->marginBottom();
                 f->width = o->width() + o->marginLeft() + o->marginRight();
             }
-            if (fx<0) fx=0;
             f->left = fx;
             //kdDebug( 6040 ) << "positioning left aligned float at (" << fx + o->marginLeft()  << "/" << y + o->marginTop() << ") fx=" << fx << endl;
             o->setPos(fx + o->marginLeft(), y + o->marginTop());
@@ -1921,14 +1920,18 @@
                 _height = o->height() + o->marginTop() + o->marginBottom();
                 f->width = o->width() + o->marginLeft() + o->marginRight();
             }
-            if (fx<f->width) fx=f->width;
             f->left = fx - f->width;
             //kdDebug( 6040 ) << "positioning right aligned float at (" << fx - o->marginRight() - o->width() << "/" << y + o->marginTop() << ")" << endl;
             o->setPos(fx - o->marginRight() - o->width(), y + o->marginTop());
         }
 
-        if ( m_layer && style()->hidesOverflow() && (o->xPos()+o->width() > m_overflowWidth) )
-            m_overflowWidth = o->xPos()+o->width();
+        if ( m_layer && style()->hidesOverflow()) {
+            if (o->xPos()+o->width() > m_overflowWidth)
+                m_overflowWidth = o->xPos()+o->width();
+            else
+            if (o->xPos() < m_overflowLeft)
+                m_overflowLeft = o->xPos();
+        }
 
         f->startY = y;
         f->endY = f->startY + _height;