Commit dda1d1b4 authored by hyatt's avatar hyatt
Browse files

Fix for 3121865, content missing at disney.com. Make

	sure blocks track width overflow as well as height
	overflow and ensure that a layer's dimensions expand
	to encompass both width and height overflow.

	Also fixes a bug with line breaking that allowed unbreakable
	words to actually be broken up when they were the only word
	on a line.  This is wrong and differs from all other
	browsers, so the patch in bidi.cpp fixes us to match
	other browsers.  (This was required to fix the above bug.)

        Reviewed by mjs.

        * khtml/rendering/bidi.cpp:
        (RenderFlow::findNextLineBreak):
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::RenderFlow):
        (RenderFlow::layout):
        (RenderFlow::layoutBlockChildren):
        * khtml/rendering/render_flow.h:
        * khtml/rendering/render_layer.cpp:
        (RenderLayer::updateLayerPosition):
        * khtml/rendering/render_object.cpp:
        (RenderObject::nodeAtPoint):
        * khtml/rendering/render_object.h:
        * khtml/rendering/render_table.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3032 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3192ec99
2002-12-13 David Hyatt <hyatt@apple.com>
Fix for 3121865, content missing at disney.com. Make
sure blocks track width overflow as well as height
overflow and ensure that a layer's dimensions expand
to encompass both width and height overflow.
Also fixes a bug with line breaking that allowed unbreakable
words to actually be broken up when they were the only word
on a line. This is wrong and differs from all other
browsers, so the patch in bidi.cpp fixes us to match
other browsers. (This was required to fix the above bug.)
Reviewed by mjs.
* khtml/rendering/bidi.cpp:
(RenderFlow::findNextLineBreak):
* khtml/rendering/render_flow.cpp:
(RenderFlow::RenderFlow):
(RenderFlow::layout):
(RenderFlow::layoutBlockChildren):
* khtml/rendering/render_flow.h:
* khtml/rendering/render_layer.cpp:
(RenderLayer::updateLayerPosition):
* khtml/rendering/render_object.cpp:
(RenderObject::nodeAtPoint):
* khtml/rendering/render_object.h:
* khtml/rendering/render_table.h:
2002-12-12 Richard Williamson <rjw@apple.com>
Fixed 3116584. Made letter-spacing, word-spacing, and text-decoration play
......
2002-12-13 David Hyatt <hyatt@apple.com>
Fix for 3121865, content missing at disney.com. Make
sure blocks track width overflow as well as height
overflow and ensure that a layer's dimensions expand
to encompass both width and height overflow.
Also fixes a bug with line breaking that allowed unbreakable
words to actually be broken up when they were the only word
on a line. This is wrong and differs from all other
browsers, so the patch in bidi.cpp fixes us to match
other browsers. (This was required to fix the above bug.)
Reviewed by mjs.
* khtml/rendering/bidi.cpp:
(RenderFlow::findNextLineBreak):
* khtml/rendering/render_flow.cpp:
(RenderFlow::RenderFlow):
(RenderFlow::layout):
(RenderFlow::layoutBlockChildren):
* khtml/rendering/render_flow.h:
* khtml/rendering/render_layer.cpp:
(RenderLayer::updateLayerPosition):
* khtml/rendering/render_object.cpp:
(RenderObject::nodeAtPoint):
* khtml/rendering/render_object.h:
* khtml/rendering/render_table.h:
2002-12-12 Richard Williamson <rjw@apple.com>
Fixed 3116584. Made letter-spacing, word-spacing, and text-decoration play
......
......@@ -1430,7 +1430,7 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
}
end:
int determinedWidth = w + tmpW;
if( lBreak == start && !lBreak.obj->isBR() ) {
// we just add as much as possible
if ( m_pre ) {
......@@ -1443,27 +1443,24 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
}
} else if( lBreak.obj ) {
if( last != o ) {
// better break between object boundaries than in the middle of a word
// better to break between object boundaries than in the middle of a word
lBreak.obj = o;
lBreak.pos = 0;
determinedWidth -= tmpW;
} else {
int w = 0;
if( lBreak.obj->isText() )
w += static_cast<RenderText *>(lBreak.obj)->width(lBreak.pos, 1);
else
w += lBreak.obj->width();
while( lBreak.obj && w < width ) {
++lBreak;
if( !lBreak.obj ) break;
if( lBreak.obj->isText() )
w += static_cast<RenderText *>(lBreak.obj)->width(lBreak.pos, 1);
else
w += lBreak.obj->width();
}
// Don't ever break in the middle of a word if we can help it.
// There's no room at all. We just have to be on this line,
// even though we'll spill out.
lBreak.obj = o;
lBreak.pos = pos;
}
}
}
// FIXME: XXXdwh Support rtl.
if (style()->direction() == LTR && m_overflowWidth < borderLeft() + paddingLeft() + determinedWidth)
m_overflowWidth = borderLeft() + paddingLeft() + determinedWidth;
// make sure we consume at least one char/object.
if( lBreak == start )
++lBreak;
......
......@@ -58,6 +58,7 @@ RenderFlow::RenderFlow(DOM::NodeImpl* node)
m_maxTopPosMargin = m_maxTopNegMargin = m_maxBottomPosMargin = m_maxBottomNegMargin = 0;
m_topMarginQuirk = m_bottomMarginQuirk = false;
m_overflowHeight = 0;
m_overflowWidth = 0;
m_continuation = 0;
}
......@@ -232,7 +233,8 @@ void RenderFlow::layout()
int oldWidth = m_width;
calcWidth();
m_overflowWidth = m_width;
bool relayoutChildren = false;
if ( oldWidth != m_width )
relayoutChildren = true;
......@@ -331,8 +333,10 @@ void RenderFlow::layout()
}
// overflow:hidden will just clip, so we don't have overflow.
if (style()->overflow()==OHIDDEN)
if (style()->overflow()==OHIDDEN) {
m_overflowHeight = m_height;
m_overflowWidth = m_width;
}
if (isTableCell()) {
// Table cells need to grow to accommodate both overhanging floats and
......@@ -371,6 +375,10 @@ void RenderFlow::layout()
m_maxBottomNegMargin = m_maxBottomPosMargin = 0;
}
// Always ensure our overflow width is at least as large as our width.
if (m_overflowWidth < m_width)
m_overflowWidth = m_width;
setLayouted();
}
......@@ -717,6 +725,12 @@ void RenderFlow::layoutBlockChildren( bool relayoutChildren )
addOverHangingFloats( static_cast<RenderFlow *>(child), -child->xPos(), -child->yPos(), true );
}
// See if this child has made our overflow need to grow.
// XXXdwh Work with left overflow as well as right overflow.
int rightChildPos = child->overflowWidth() + child->xPos();
if (rightChildPos > m_overflowWidth)
m_overflowWidth = rightChildPos;
child = child->nextSibling();
}
......@@ -744,7 +758,7 @@ void RenderFlow::layoutBlockChildren( bool relayoutChildren )
// 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.
......
......@@ -165,10 +165,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
// The height (and width) 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 int overflowWidth() const { return m_overflowWidth; }
virtual bool isSelfCollapsingBlock() const { return m_height == 0; }
virtual bool isTopMarginQuirk() const { return m_topMarginQuirk; }
......@@ -244,9 +245,11 @@ private:
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).
// How much content overflows out of our block vertically or horizontally (all we support
// for now is spillage out of the bottom and the right, which are the common cases).
// XXX Generalize to work with top and left as well.
int m_overflowHeight;
int m_overflowWidth;
// An inline can be split with blocks occurring in between the inline content.
// When this occurs we need a pointer to our next object. We can basically be
......
......@@ -72,6 +72,11 @@ void RenderLayer::updateLayerPosition()
static_cast<RenderBox*>(m_object)->relativePositionOffset(x, y);
setPos(x,y);
if (m_object->overflowWidth() > m_object->width())
setWidth(m_object->overflowWidth());
if (m_object->overflowHeight() > m_object->height())
setHeight(m_object->overflowHeight());
}
RenderLayer*
......
......@@ -1035,8 +1035,8 @@ bool RenderObject::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty,
int tx = _tx + xPos();
int ty = _ty + yPos();
inside |= (style()->visibility() != HIDDEN && ((_y >= ty) && (_y < ty + height()) &&
(_x >= tx) && (_x < tx + width()))) || isBody() || isHtml();
inside |= (style()->visibility() != HIDDEN && ((_y >= ty) && (_y < ty + overflowHeight()) &&
(_x >= tx) && (_x < tx + overflowWidth()))) || isBody() || isHtml();
// ### table should have its own, more performant method
if (overhangingContents() || isInline() || isRoot() || isTableRow() || isTableSection() || inside || mouseInside() ) {
......
......@@ -384,6 +384,7 @@ public:
// 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(); }
virtual int overflowWidth() const { return width(); }
// 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
......
......@@ -105,6 +105,8 @@ public:
void recalcColInfos();
// overrides
virtual int overflowHeight() const { return height(); }
virtual int overflowWidth() const { return width(); }
virtual void addChild(RenderObject *child, RenderObject *beforeChild = 0);
virtual void paint(QPainter *, int x, int y, int w, int h,
int tx, int ty, int paintPhase);
......
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