Reviewed by Eric Seidel.
Convert RenderBox::absoluteRects to IntPoint
https://bugs.webkit.org/show_bug.cgi?id=62130
Covered by existing tests.
* dom/Node.cpp:
(WebCore::Node::hasNonEmptyBoundingBox):
* rendering/InlineBox.h:
(WebCore::InlineBox::size):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::absoluteRects):
* rendering/RenderBlock.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::absoluteRects):
* rendering/RenderBox.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::absoluteRects):
* rendering/RenderInline.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::absoluteBoundingBoxRect):
* rendering/RenderObject.h:
(WebCore::RenderObject::absoluteRects):
* rendering/RenderText.cpp:
(WebCore::RenderText::absoluteRects):
* rendering/RenderText.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::absoluteRects):
* rendering/RenderView.h:
* rendering/svg/RenderSVGBlock.cpp:
(WebCore::RenderSVGBlock::absoluteRects):
* rendering/svg/RenderSVGBlock.h:
* rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::absoluteRects):
* rendering/svg/RenderSVGModelObject.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@88297
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-06-07 Emil A Eklund <eae@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Convert RenderBox::absoluteRects to IntPoint
+ https://bugs.webkit.org/show_bug.cgi?id=62130
+
+ Covered by existing tests.
+
+ * dom/Node.cpp:
+ (WebCore::Node::hasNonEmptyBoundingBox):
+ * rendering/InlineBox.h:
+ (WebCore::InlineBox::size):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::absoluteRects):
+ * rendering/RenderBlock.h:
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::absoluteRects):
+ * rendering/RenderBox.h:
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::absoluteRects):
+ * rendering/RenderInline.h:
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::absoluteBoundingBoxRect):
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::absoluteRects):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::absoluteRects):
+ * rendering/RenderText.h:
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::absoluteRects):
+ * rendering/RenderView.h:
+ * rendering/svg/RenderSVGBlock.cpp:
+ (WebCore::RenderSVGBlock::absoluteRects):
+ * rendering/svg/RenderSVGBlock.h:
+ * rendering/svg/RenderSVGModelObject.cpp:
+ (WebCore::RenderSVGModelObject::absoluteRects):
+ * rendering/svg/RenderSVGModelObject.h:
+
2011-06-07 Kent Tamura <tkent@chromium.org>
Reviewed by Andreas Kling.
Vector<IntRect> rects;
FloatPoint absPos = renderer()->localToAbsolute();
- renderer()->absoluteRects(rects, absPos.x(), absPos.y());
+ renderer()->absoluteRects(rects, flooredIntPoint(absPos));
size_t n = rects.size();
for (size_t i = 0; i < n; ++i)
if (!rects[i].isEmpty())
float width() const { return isHorizontal() ? logicalWidth() : logicalHeight(); }
float height() const { return isHorizontal() ? logicalHeight() : logicalWidth(); }
+ FloatSize size() const { return IntSize(width(), height()); }
float right() const { return left() + width(); }
float bottom() const { return top() + height(); }
m_rareData->m_pageLogicalOffset = logicalOffset;
}
-void RenderBlock::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
+void RenderBlock::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
{
// For blocks inside inlines, we go ahead and include margins so that we run right up to the
// inline boxes above and below us (thus getting merged with them to form a single irregular
if (isAnonymousBlockContinuation()) {
// FIXME: This is wrong for block-flows that are horizontal.
// https://bugs.webkit.org/show_bug.cgi?id=46781
- rects.append(IntRect(tx, ty - collapsedMarginBefore(),
+ rects.append(IntRect(accumulatedOffset.x(), accumulatedOffset.y() - collapsedMarginBefore(),
width(), height() + collapsedMarginBefore() + collapsedMarginAfter()));
- continuation()->absoluteRects(rects,
- tx - x() + inlineElementContinuation()->containingBlock()->x(),
- ty - y() + inlineElementContinuation()->containingBlock()->y());
+ continuation()->absoluteRects(rects, accumulatedOffset - toSize(location() +
+ inlineElementContinuation()->containingBlock()->location()));
} else
- rects.append(IntRect(tx, ty, width(), height()));
+ rects.append(IntRect(accumulatedOffset, size()));
}
void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads)
int logicalLeftSelectionOffset(RenderBlock* rootBlock, int position);
int logicalRightSelectionOffset(RenderBlock* rootBlock, int position);
- virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
+ virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
virtual void absoluteQuads(Vector<FloatQuad>&);
int desiredColumnWidth() const;
layer()->scrollToYOffset(newTop);
}
-void RenderBox::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
+void RenderBox::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
{
- rects.append(IntRect(tx, ty, width(), height()));
+ rects.append(IntRect(accumulatedOffset, size()));
}
void RenderBox::absoluteQuads(Vector<FloatQuad>& quads)
virtual int collapsedMarginBefore() const { return marginBefore(); }
virtual int collapsedMarginAfter() const { return marginAfter(); }
- virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
+ virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
virtual void absoluteQuads(Vector<FloatQuad>&);
IntRect reflectionBox() const;
m_lineBoxes.paint(this, paintInfo, paintOffset);
}
-void RenderInline::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
+void RenderInline::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
{
if (!alwaysCreateLineBoxes())
- culledInlineAbsoluteRects(this, rects, IntSize(tx, ty));
+ culledInlineAbsoluteRects(this, rects, toSize(accumulatedOffset));
else if (InlineFlowBox* curr = firstLineBox()) {
for (; curr; curr = curr->nextLineBox())
- rects.append(enclosingIntRect(FloatRect(tx + curr->x(), ty + curr->y(), curr->width(), curr->height())));
+ rects.append(enclosingIntRect(FloatRect(accumulatedOffset + curr->topLeft(), curr->size())));
} else
- rects.append(IntRect(tx, ty, 0, 0));
+ rects.append(IntRect(accumulatedOffset, IntSize()));
if (continuation()) {
if (continuation()->isBox()) {
RenderBox* box = toRenderBox(continuation());
- continuation()->absoluteRects(rects,
- tx - containingBlock()->x() + box->x(),
- ty - containingBlock()->y() + box->y());
+ continuation()->absoluteRects(rects, toPoint(accumulatedOffset - containingBlock()->location() + box->size()));
} else
- continuation()->absoluteRects(rects, tx - containingBlock()->x(), ty - containingBlock()->y());
+ continuation()->absoluteRects(rects, toPoint(accumulatedOffset - containingBlock()->location()));
}
}
virtual int marginStart() const;
virtual int marginEnd() const;
- virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
+ virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
virtual void absoluteQuads(Vector<FloatQuad>&);
virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
FloatPoint absPos = localToAbsolute();
Vector<IntRect> rects;
- absoluteRects(rects, absPos.x(), absPos.y());
+ absoluteRects(rects, flooredIntPoint(absPos));
size_t n = rects.size();
if (!n)
// Return the offset from an object up the container() chain. Asserts that none of the intermediate objects have transforms.
IntSize offsetFromAncestorContainer(RenderObject*) const;
- virtual void absoluteRects(Vector<IntRect>&, int, int) { }
+ virtual void absoluteRects(Vector<IntRect>&, const IntPoint&) { }
// FIXME: useTransforms should go away eventually
IntRect absoluteBoundingBoxRect(bool useTransforms = false);
return (e && e->isTextNode()) ? static_cast<Text*>(e)->dataImpl() : 0;
}
-void RenderText::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
+void RenderText::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
{
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
- rects.append(enclosingIntRect(FloatRect(tx + box->x(), ty + box->y(), box->width(), box->height())));
+ rects.append(enclosingIntRect(FloatRect(accumulatedOffset + box->topLeft(), box->size())));
}
void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, unsigned end, bool useSelectionHeight)
InlineTextBox* createInlineTextBox();
void dirtyLineBoxes(bool fullLayout);
- virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
+ virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);
virtual void absoluteQuads(Vector<FloatQuad>&);
rect = m_layer->transform()->mapRect(rect);
}
-void RenderView::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
+void RenderView::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
{
- rects.append(IntRect(IntPoint(tx, ty), m_layer->size()));
+ rects.append(IntRect(accumulatedOffset, m_layer->size()));
}
void RenderView::absoluteQuads(Vector<FloatQuad>& quads)
bool printing() const;
- virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
+ virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
virtual void absoluteQuads(Vector<FloatQuad>&);
#if USE(ACCELERATED_COMPOSITING)
setHasOverflowClip(false);
}
-void RenderSVGBlock::absoluteRects(Vector<IntRect>&, int, int)
+void RenderSVGBlock::absoluteRects(Vector<IntRect>&, const IntPoint&)
{
// This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used.
ASSERT_NOT_REACHED();
virtual void setStyle(PassRefPtr<RenderStyle>);
virtual void updateBoxModelInfoFromStyle();
- virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
+ virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
virtual void destroy();
virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
return containerRelativeQuad.enclosingBoundingBox();
}
-void RenderSVGModelObject::absoluteRects(Vector<IntRect>&, int, int)
+void RenderSVGModelObject::absoluteRects(Vector<IntRect>&, const IntPoint&)
{
// This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used.
ASSERT_NOT_REACHED();
virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* repaintContainer, IntPoint*) const;
- virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
+ virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
virtual void absoluteQuads(Vector<FloatQuad>&);
virtual void destroy();