Skip to content
Permalink
Browse files
Fix fieldsets so that they properly expand to enclose overhanging fl…
…oats

        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):



Canonical link: https://commits.webkit.org/13687@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16319 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
David Hyatt committed Sep 12, 2006
1 parent 2391440 commit 6503925953e20fe20d22329ee065e1378053e659
Showing 5 changed files with 41 additions and 14 deletions.
@@ -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.
@@ -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();
}
@@ -30,23 +30,25 @@

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

@@ -751,6 +751,7 @@ class RenderObject : public CachedResourceClient
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*) { }
@@ -64,6 +64,8 @@ class RenderTableCell : public RenderBlock {
virtual void setWidth(int);
virtual void setStyle(RenderStyle*);

virtual bool expandsToEncloseOverhangingFloats() const { return true; }

int borderLeft() const;
int borderRight() const;
int borderTop() const;

0 comments on commit 6503925

Please sign in to comment.