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 e6a7b2d..19f468f 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 be533e5..23e7b7d 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 cfabe93..e31ccc4 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 0c5a0be..c6513d0 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 f63a0ec..4be8420 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;