Commit 2bca5337 authored by hyatt's avatar hyatt

Make the absolutePosition method multi-column aware. Note that there...

        Make the absolutePosition method multi-column aware.  Note that there is now a real problem with the
        absoluteRects method, since an object can split across multiple columns and break into multiple rects.
        absolutePosition just returns the top-left corner of the element's box in the first column in which it
        appears.

        Reviewed by bdash

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::adjustRectForColumns):
        * rendering/RenderBlock.h:
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::absolutePosition):
        (WebCore::RenderBox::computeAbsoluteRepaintRect):
        * rendering/RenderFlow.cpp:
        (WebCore::RenderFlow::getAbsoluteRepaintRect):



git-svn-id: svn://svn.chromium.org/blink/trunk@18734 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c3400247
2007-01-10 David Hyatt <hyatt@apple.com>
Make the absolutePosition method multi-column aware. Note that there is now a real problem with the
absoluteRects method, since an object can split across multiple columns and break into multiple rects.
absolutePosition just returns the top-left corner of the element's box in the first column in which it
appears.
Reviewed by bdash
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::adjustRectForColumns):
* rendering/RenderBlock.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::absolutePosition):
(WebCore::RenderBox::computeAbsoluteRepaintRect):
* rendering/RenderFlow.cpp:
(WebCore::RenderFlow::getAbsoluteRepaintRect):
2007-01-09 David Hyatt <hyatt@apple.com> 2007-01-09 David Hyatt <hyatt@apple.com>
Avoid crashing when repainting multiple columns... make sure to use the current vector's size and Avoid crashing when repainting multiple columns... make sure to use the current vector's size and
......
...@@ -3017,7 +3017,7 @@ void RenderBlock::layoutColumns() ...@@ -3017,7 +3017,7 @@ void RenderBlock::layoutColumns()
ASSERT(m_columnRects && m_columnCount == m_columnRects->size()); ASSERT(m_columnRects && m_columnCount == m_columnRects->size());
} }
void RenderBlock::adjustRepaintRectForColumns(IntRect& r) const void RenderBlock::adjustRectForColumns(IntRect& r) const
{ {
// Just bail if we have no columns. // Just bail if we have no columns.
if (!hasColumns() || !m_columnRects) if (!hasColumns() || !m_columnRects)
......
...@@ -281,7 +281,7 @@ public: ...@@ -281,7 +281,7 @@ public:
void clearTruncation(); void clearTruncation();
virtual bool hasColumns() const { return m_columnCount > 1; } virtual bool hasColumns() const { return m_columnCount > 1; }
void adjustRepaintRectForColumns(IntRect&) const; void adjustRectForColumns(IntRect&) const;
protected: protected:
void newLine(); void newLine();
......
...@@ -766,6 +766,7 @@ bool RenderBox::absolutePosition(int &xPos, int &yPos, bool f) ...@@ -766,6 +766,7 @@ bool RenderBox::absolutePosition(int &xPos, int &yPos, bool f)
RenderObject *o = container(); RenderObject *o = container();
if (o && o->absolutePosition(xPos, yPos, f)) { if (o && o->absolutePosition(xPos, yPos, f)) {
yPos += o->borderTopExtra(); yPos += o->borderTopExtra();
if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->isInlineFlow()) { if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->isInlineFlow()) {
// When we have an enclosing relpositioned inline, we need to add in the offset of the first line // When we have an enclosing relpositioned inline, we need to add in the offset of the first line
// box from the rest of the content, but only in the cases where we know we're positioned // box from the rest of the content, but only in the cases where we know we're positioned
...@@ -800,8 +801,17 @@ bool RenderBox::absolutePosition(int &xPos, int &yPos, bool f) ...@@ -800,8 +801,17 @@ bool RenderBox::absolutePosition(int &xPos, int &yPos, bool f)
o->layer()->subtractScrollOffset(xPos, yPos); o->layer()->subtractScrollOffset(xPos, yPos);
if (!isInline() || isReplaced()) { if (!isInline() || isReplaced()) {
xPos += m_x; RenderBlock* cb;
yPos += m_y; if (o->isBlockFlow() && style()->position() != AbsolutePosition && style()->position() != FixedPosition &&
(cb = static_cast<RenderBlock*>(o))->hasColumns()) {
IntRect rect(m_x, m_y, 1, 1);
cb->adjustRectForColumns(rect);
xPos += rect.x();
yPos += rect.y();
} else {
xPos += m_x;
yPos += m_y;
}
} }
if (isRelPositioned()) { if (isRelPositioned()) {
...@@ -918,7 +928,7 @@ void RenderBox::computeAbsoluteRepaintRect(IntRect& r, bool f) ...@@ -918,7 +928,7 @@ void RenderBox::computeAbsoluteRepaintRect(IntRect& r, bool f)
RenderBlock* cb = static_cast<RenderBlock*>(o); RenderBlock* cb = static_cast<RenderBlock*>(o);
if (cb->hasColumns()) { if (cb->hasColumns()) {
IntRect repaintRect(x, y, r.width(), r.height()); IntRect repaintRect(x, y, r.width(), r.height());
cb->adjustRepaintRectForColumns(repaintRect); cb->adjustRectForColumns(repaintRect);
x = repaintRect.x(); x = repaintRect.x();
y = repaintRect.y(); y = repaintRect.y();
r = repaintRect; r = repaintRect;
......
...@@ -469,7 +469,7 @@ IntRect RenderFlow::getAbsoluteRepaintRect() ...@@ -469,7 +469,7 @@ IntRect RenderFlow::getAbsoluteRepaintRect()
IntRect r(-ow + left, -ow + top, width() + ow * 2, height() + ow * 2); IntRect r(-ow + left, -ow + top, width() + ow * 2, height() + ow * 2);
if (cb->hasColumns()) if (cb->hasColumns())
cb->adjustRepaintRectForColumns(r); cb->adjustRectForColumns(r);
if (cb->hasOverflowClip()) { if (cb->hasOverflowClip()) {
// cb->height() is inaccurate if we're in the middle of a layout of |cb|, so use the // cb->height() is inaccurate if we're in the middle of a layout of |cb|, so use the
......
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