Fix fieldsets so that they properly expand to enclose overhanging floats
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Sep 2006 07:26:24 +0000 (07:26 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Sep 2006 07:26:24 +0000 (07:26 +0000)
        when the fieldset has auto height.  This is a nifty undocumented behavior
        of the fieldset element.  The bug is 3898.

        Reviewed by mjs

        Added fast/forms/fieldset-with-float.html

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::layoutBlock):
        * rendering/RenderFieldset.h:
        (WebCore::RenderFieldset::renderName):
        (WebCore::RenderFieldset::expandsToEncloseOverhangingFloats):
        * rendering/RenderObject.h:
        (WebCore::RenderObject::expandsToEncloseOverhangingFloats):
        * rendering/RenderTableCell.h:
        (WebCore::RenderTableCell::expandsToEncloseOverhangingFloats):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16319 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderFieldset.h
WebCore/rendering/RenderObject.h
WebCore/rendering/RenderTableCell.h

index e6a7b2df78fe9271103d238d12f9ca02efd4c17e..19f468f1b11633b41f9c0b89bbb8286df9b60805 100644 (file)
@@ -1,3 +1,23 @@
+2006-09-12  David Hyatt  <hyatt@apple.com>
+
+        Fix fieldsets so that they properly expand to enclose overhanging floats
+        when the fieldset has auto height.  This is a nifty undocumented behavior
+        of the fieldset element.  The bug is 3898.
+
+        Reviewed by mjs
+
+        Added fast/forms/fieldset-with-float.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::layoutBlock):
+        * rendering/RenderFieldset.h:
+        (WebCore::RenderFieldset::renderName):
+        (WebCore::RenderFieldset::expandsToEncloseOverhangingFloats):
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::expandsToEncloseOverhangingFloats):
+        * rendering/RenderTableCell.h:
+        (WebCore::RenderTableCell::expandsToEncloseOverhangingFloats):
+
 2006-09-11  Eric Seidel  <eric@eseidel.com>
 
         Reviewed by hyatt.
index be533e5f5efc576a5dfb64d32b9ea599f3569785..23e7b7d410e97994e5e9b56a46e6c383034bb7ad 100644 (file)
@@ -527,7 +527,9 @@ void RenderBlock::layoutBlock(bool relayoutChildren)
             m_height = m_overflowHeight + borderBottom() + paddingBottom();
     }
 
-    if (hasOverhangingFloats() && ((isFloating() && style()->height().isAuto()) || isTableCell())) {
+    // Some classes of objects (floats and fieldsets with no specified heights and table cells) expand to encompass
+    // overhanging floats.
+    if (hasOverhangingFloats() && expandsToEncloseOverhangingFloats()) {
         m_height = floatBottom();
         m_height += borderBottom() + paddingBottom();
     }
index cfabe93acaee0e3b5f899982a3f15558c1e867f5..e31ccc4a9304957d4f0b18a724e6c0c69c3fa7ca 100644 (file)
 
 namespace WebCore {
 
-    class HTMLGenericFormElement;
+class HTMLGenericFormElement;
 
-    class RenderFieldset : public RenderBlock {
-    public:
-        RenderFieldset(HTMLGenericFormElement*);
+class RenderFieldset : public RenderBlock {
+public:
+    RenderFieldset(HTMLGenericFormElement*);
 
-        virtual const char* renderName() const { return "RenderFieldSet"; }
+    virtual const char* renderName() const { return "RenderFieldSet"; }
 
-        virtual RenderObject* layoutLegend(bool relayoutChildren);
+    virtual RenderObject* layoutLegend(bool relayoutChildren);
 
-        virtual void setStyle(RenderStyle*);
-        
-    private:
-        virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
-        void paintBorderMinusLegend(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, int lx, int lw);
-        RenderObject* findLegend();
-    };
+    virtual void setStyle(RenderStyle*);
+    
+    virtual bool expandsToEncloseOverhangingFloats() const { return style()->height().isAuto(); }
+
+private:
+    virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
+    void paintBorderMinusLegend(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, int lx, int lw);
+    RenderObject* findLegend();
+};
 
 } // namespace WebCore
 
index 0c5a0bebcfc0ee250041cd56a05464cbd9e22e7c..c6513d089af7a1f5bd046652710edd1f938d0094 100644 (file)
@@ -751,6 +751,7 @@ public:
     virtual bool containsFloats() { return false; }
     virtual bool containsFloat(RenderObject* o) { return false; }
     virtual bool hasOverhangingFloats() { return false; }
+    virtual bool expandsToEncloseOverhangingFloats() const { return isFloating() && style()->height().isAuto(); }
     virtual IntRect floatRect() const { return borderBox(); }
 
     virtual void removePositionedObjects(RenderBlock*) { }
index f63a0ecae7bf6ba7b9799fc143168f5c1b5a879b..4be8420d44ede8feadf3425b90ce1951a6480f11 100644 (file)
@@ -64,6 +64,8 @@ public:
     virtual void setWidth(int);
     virtual void setStyle(RenderStyle*);
 
+    virtual bool expandsToEncloseOverhangingFloats() const { return true; }
+
     int borderLeft() const;
     int borderRight() const;
     int borderTop() const;