2011-06-07 Emil A Eklund <eae@chromium.org>
authoreae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Jun 2011 00:30:08 +0000 (00:30 +0000)
committereae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Jun 2011 00:30:08 +0000 (00:30 +0000)
        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

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Node.cpp
Source/WebCore/rendering/InlineBox.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/RenderText.h
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RenderView.h
Source/WebCore/rendering/svg/RenderSVGBlock.cpp
Source/WebCore/rendering/svg/RenderSVGBlock.h
Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
Source/WebCore/rendering/svg/RenderSVGModelObject.h

index ec5e3cc3afbac05d3cf59724312689853ed93f95..294001e1a8e8cce010407aa8d37a2fe5484c2948 100644 (file)
@@ -1,3 +1,42 @@
+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.
index 4049d83ce1f22c0c5669d5df277db8decb935c8b..bd41e528a025dcfa917c90083bd652b1c214b8d4 100644 (file)
@@ -839,7 +839,7 @@ bool Node::hasNonEmptyBoundingBox() const
 
     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())
index c734d2909444e38bf368dbfeb68bd50ebd82a6fc..f1a85b6eb98cbc6de20885b965a78eb12264c52a 100644 (file)
@@ -236,6 +236,7 @@ public:
 
     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(); }
 
index bf4e2654bbc4b1bfe7f7f05310fce2deefa664ae..ea7ca4a4ebf58d2bc733c201f844aa519cfb2359 100644 (file)
@@ -5664,7 +5664,7 @@ void RenderBlock::setPageLogicalOffset(int logicalOffset)
     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
@@ -5672,13 +5672,12 @@ void RenderBlock::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
     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)
index 911cb98bac6bde2f6c3370b39c3fb5d015236b9e..c2e8442817ffe5ed36bba86a486f35ef68b11a4f 100644 (file)
@@ -625,7 +625,7 @@ private:
     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;
index ca2d91c228d24b9bbca831442f17aeabb51f3500..e948bbc49ab4d9ad85900dcbb05b49661e614de0 100644 (file)
@@ -455,9 +455,9 @@ void RenderBox::setScrollTop(int newTop)
         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)
index c9c92b8cde8aba1a7fd05634234d2c0fa4e98fba..64d1eadbf8ef6c8ce46bf1d126ff9d4aef1a87cf 100644 (file)
@@ -230,7 +230,7 @@ public:
     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;
index 3e108e73cfec6c4241eddb298a237df3901ea5aa..4bdb1cad9e845672827a9481b0bcaca9765e4995 100644 (file)
@@ -465,24 +465,22 @@ void RenderInline::paint(PaintInfo& paintInfo, const IntPoint& paintOffset)
     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()));
     }
 }
 
index fb9374d2096a59d5c9a5a280a50a593b5e36a17e..b117eff6de3c9a8b9d58e5b7e630143c40faf7e0 100644 (file)
@@ -48,7 +48,7 @@ public:
     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;
index d2d56d6a13a1dbf0706eead2a1167a2f7cb1c901..5caf65e5f964a7df24410759e71b660a4f200dc4 100644 (file)
@@ -1099,7 +1099,7 @@ IntRect RenderObject::absoluteBoundingBoxRect(bool useTransforms)
 
     FloatPoint absPos = localToAbsolute();
     Vector<IntRect> rects;
-    absoluteRects(rects, absPos.x(), absPos.y());
+    absoluteRects(rects, flooredIntPoint(absPos));
 
     size_t n = rects.size();
     if (!n)
index 62964a9c7f7afb572d4994f1c4d1fa7ea8e11504..d8baaf47b8c4792e1c9168ce5babe26cc7ffdc24 100644 (file)
@@ -590,7 +590,7 @@ public:
     // 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);
 
index 3cc9853312f323663f108175a4e38714670d956e..71ac345c8ae643bcc0d5f6448a45c6a50abc6739 100644 (file)
@@ -269,10 +269,10 @@ PassRefPtr<StringImpl> RenderText::originalText() const
     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)
index f76e249175fd65eaf886f619b930096d401e951a..540b13c71842839360a31cdd3fa7f0beba51c9c1 100644 (file)
@@ -56,7 +56,7 @@ public:
     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>&);
index db2b47874ae71dfec916c114e978d1fb12d2db0c..7f816249521f99e38bc0abc49e6ee4ac7d9975ee 100644 (file)
@@ -321,9 +321,9 @@ void RenderView::computeRectForRepaint(RenderBoxModelObject* repaintContainer, I
         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)
index fd7bf5e1d0d87b39f00cfca65a69479e3bb41c63..4c537313613956c90e7a1c359974014caabb37d0 100644 (file)
@@ -82,7 +82,7 @@ public:
 
     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)
index ed8e24edef70de6d79b358f343c3a9f9f4eb3259..fb55fd1993431feba981e9b389e9701348f2d6ab 100644 (file)
@@ -68,7 +68,7 @@ void RenderSVGBlock::updateBoxModelInfoFromStyle()
     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();
index 350fdde968a0edbef8e33321b7e699ad1cf75672..5069bbf7b485d502a451349c3bfa75333b68d0ce 100644 (file)
@@ -36,7 +36,7 @@ private:
     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);
index 373ebe4bff1761df3f943ba18d6740b00383b903..0150979b241ae35fb74080094988e0060bdfebe2 100644 (file)
@@ -70,7 +70,7 @@ IntRect RenderSVGModelObject::outlineBoundsForRepaint(RenderBoxModelObject* repa
     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();
index 00a99f4547cddc24d2e552a8744b8aafc351ffcb..eb3549e2d604e469c9725cea87ca914a695d811e 100644 (file)
@@ -55,7 +55,7 @@ public:
     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();