Commit a70560aa authored by hyatt's avatar hyatt

Fix for 3049663. Table cells don't grow to accommodate block

	overflow.

        * khtml/rendering/bidi.cpp:
        (RenderFlow::layoutInlineChildren):
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::RenderFlow):
        (RenderFlow::layout):
        (RenderFlow::layoutBlockChildren):
        * khtml/rendering/render_flow.h:
        * khtml/rendering/render_object.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5721aa9d
2002-11-19 David Hyatt <hyatt@apple.com>
Fix for 3049663. Table cells don't grow to accommodate block
overflow.
* khtml/rendering/bidi.cpp:
(RenderFlow::layoutInlineChildren):
* khtml/rendering/render_flow.cpp:
(RenderFlow::RenderFlow):
(RenderFlow::layout):
(RenderFlow::layoutBlockChildren):
* khtml/rendering/render_flow.h:
* khtml/rendering/render_object.h:
2002-11-19 Darin Adler <darin@apple.com>
- next step towards atomic identifiers; Identifier is no longer derived from UString
......
2002-11-19 David Hyatt <hyatt@apple.com>
Fix for 3049663. Table cells don't grow to accommodate block
overflow.
* khtml/rendering/bidi.cpp:
(RenderFlow::layoutInlineChildren):
* khtml/rendering/render_flow.cpp:
(RenderFlow::RenderFlow):
(RenderFlow::layout):
(RenderFlow::layoutBlockChildren):
* khtml/rendering/render_flow.h:
* khtml/rendering/render_object.h:
2002-11-19 Darin Adler <darin@apple.com>
- next step towards atomic identifiers; Identifier is no longer derived from UString
......
2002-11-19 David Hyatt <hyatt@apple.com>
Fix for 3049663. Table cells don't grow to accommodate block
overflow.
* khtml/rendering/bidi.cpp:
(RenderFlow::layoutInlineChildren):
* khtml/rendering/render_flow.cpp:
(RenderFlow::RenderFlow):
(RenderFlow::layout):
(RenderFlow::layoutBlockChildren):
* khtml/rendering/render_flow.h:
* khtml/rendering/render_object.h:
2002-11-19 Darin Adler <darin@apple.com>
- next step towards atomic identifiers; Identifier is no longer derived from UString
......
......@@ -990,6 +990,8 @@ static void deleteMidpoints(RenderArena* arena, QPtrList<BidiIterator>* midpoint
void RenderFlow::layoutInlineChildren()
{
m_overflowHeight = 0;
invalidateVerticalPositions();
#ifdef DEBUG_LAYOUT
QTime qt;
......@@ -1079,12 +1081,16 @@ void RenderFlow::layoutInlineChildren()
}
deleteMidpoints(renderArena(), smidpoints);
// Now add in the bottom border/padding.
m_height += toAdd;
// in case we have a float on the last line, it might not be positioned up to now.
positionNewFloats();
// Always make sure this is at least our height.
m_overflowHeight = m_height;
#if BIDI_DEBUG > 1
kdDebug(6041) << " ------- bidi end " << this << " -------" << endl;
#endif
......
......@@ -57,6 +57,7 @@ RenderFlow::RenderFlow(DOM::NodeImpl* node)
m_maxTopPosMargin = m_maxTopNegMargin = m_maxBottomPosMargin = m_maxBottomNegMargin = 0;
m_topMarginQuirk = m_bottomMarginQuirk = false;
m_overflowHeight = 0;
}
void RenderFlow::setStyle(RenderStyle *_style)
......@@ -256,6 +257,7 @@ void RenderFlow::layout()
clearFloats();
m_height = 0;
m_overflowHeight = 0;
m_clearStatus = CNONE;
// We use four values, maxTopPos, maxPosNeg, maxBottomPos, and maxBottomNeg, to track
......@@ -303,14 +305,34 @@ void RenderFlow::layout()
int oldHeight = m_height;
calcHeight();
if (oldHeight != m_height)
if (oldHeight != m_height) {
relayoutChildren = true;
if ( isTableCell() && lastChild() && lastChild()->hasOverhangingFloats() ) {
m_height = lastChild()->yPos() + static_cast<RenderFlow*>(lastChild())->floatBottom();
m_height += borderBottom() + paddingBottom();
// If the block got expanded in size, then increase our overflowheight to match.
if (m_overflowHeight > m_height)
m_overflowHeight -= (borderBottom()+paddingBottom());
if (m_overflowHeight < m_height)
m_overflowHeight = m_height;
}
// overflow:hidden will just clip, so we don't have overflow.
if (style()->overflow()==OHIDDEN)
m_overflowHeight = m_height;
if (isTableCell()) {
// Table cells need to grow to accommodate both overhanging floats and
// blocks that have overflowed content.
// Check for an overhanging float first.
if (lastChild() && lastChild()->hasOverhangingFloats() ) {
m_height = lastChild()->yPos() + static_cast<RenderFlow*>(lastChild())->floatBottom();
m_height += borderBottom() + paddingBottom();
}
if (m_overflowHeight > m_height)
m_height = m_overflowHeight + borderBottom() + paddingBottom();
}
if( hasOverhangingFloats() && (isFloating() || isTableCell()) ) {
if( hasOverhangingFloats() && (isFloating() || isTableCell())) {
m_height = floatBottom();
m_height += borderBottom() + paddingBottom();
}
......@@ -381,6 +403,7 @@ void RenderFlow::layoutBlockChildren( bool relayoutChildren )
}
int minHeight = m_height + toAdd;
m_overflowHeight = m_height;
if( style()->direction() == RTL ) {
xPos = marginLeft() + m_width - paddingRight() - borderRight();
......@@ -652,7 +675,12 @@ void RenderFlow::layoutBlockChildren( bool relayoutChildren )
child->setPos(chPos, child->yPos());
m_height += child->height();
if (m_overflowHeight < m_height) {
int overflowDelta = child->overflowHeight() - child->height();
if (m_height + overflowDelta > m_overflowHeight)
m_overflowHeight = m_height + overflowDelta;
}
if (child->isFlow())
prevFlow = static_cast<RenderFlow*>(child);
......@@ -680,14 +708,18 @@ void RenderFlow::layoutBlockChildren( bool relayoutChildren )
&& (strictMode || !quirkContainer || !bottomChildQuirk)
))
m_height += prevPosMargin - prevNegMargin;
m_height += toAdd;
m_height += toAdd;
// Negative margins can cause our height to shrink below our minimal height (border/padding).
// If this happens, ensure that the computed height is increased to the minimal height.
if (m_height < minHeight)
m_height = minHeight;
// Always make sure our overflowheight is at least our height.
if (m_overflowHeight < m_height)
m_overflowHeight = m_height;
if (canCollapseWithChildren && !topMarginContributor) {
// Update our max pos/neg bottom margins, since we collapsed our bottom margins
// with our children.
......
......@@ -136,6 +136,11 @@ public:
void bidiReorderLine(const BidiIterator &start, const BidiIterator &end);
BidiIterator findNextLineBreak(BidiIterator &start, QPtrList<BidiIterator>& midpoints);
// The height of a block when you include overflow spillage out of the bottom
// of the block (e.g., a <div style="height:25px"> that has a 100px tall image inside
// it would have an overflow height of borderTop() + paddingTop() + 100px.
virtual int overflowHeight() const { return m_overflowHeight; }
virtual bool isSelfCollapsingBlock() const { return m_height == 0; }
virtual bool isTopMarginQuirk() const { return m_topMarginQuirk; }
virtual bool isBottomMarginQuirk() const { return m_bottomMarginQuirk; }
......@@ -209,6 +214,10 @@ private:
short m_maxBottomNegMargin;
bool m_topMarginQuirk;
bool m_bottomMarginQuirk;
// How much content overflows out of our block vertically (all we support
// for now is spillage out of the bottom, which is the common case).
int m_overflowHeight;
};
......
......@@ -372,6 +372,11 @@ public:
virtual short width() const { return 0; }
virtual int height() const { return 0; }
// The height of a block when you include overflow spillage out of the bottom
// of the block (e.g., a <div style="height:25px"> that has a 100px tall image inside
// it would have an overflow height of borderTop() + paddingTop() + 100px.
virtual int overflowHeight() const { return height(); }
// IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (render_flow)
// to return the remaining width on a given line (and the height of a single line). -dwh
virtual short offsetWidth() const { return width(); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment