2011-07-06 Emil A Eklund <eae@chromium.org>
authoreae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2011 03:48:15 +0000 (03:48 +0000)
committereae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2011 03:48:15 +0000 (03:48 +0000)
        Switch absoluteRects to to new layout types
        https://bugs.webkit.org/show_bug.cgi?id=64035

        Reviewed by Eric Seidel.

        Move absoluteRects over to new layout unit abstraction.
        Add flooredLayoutPoint, mapped to flooredIntPoint.

        No new tests, no functionality changes.

        * rendering/LayoutTypes.h:
        (WebCore::flooredLayoutPoint):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::absoluteRects):
        * rendering/RenderBlock.h:
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::absoluteRects):
        * 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@90530 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/rendering/LayoutTypes.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBox.cpp
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 555e68a..aa76666 100644 (file)
@@ -1,5 +1,44 @@
 2011-07-06  Emil A Eklund  <eae@chromium.org>
 
+        Switch absoluteRects to to new layout types
+        https://bugs.webkit.org/show_bug.cgi?id=64035
+
+        Reviewed by Eric Seidel.
+
+        Move absoluteRects over to new layout unit abstraction.
+        Add flooredLayoutPoint, mapped to flooredIntPoint.
+
+        No new tests, no functionality changes.
+
+        * rendering/LayoutTypes.h:
+        (WebCore::flooredLayoutPoint):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::absoluteRects):
+        * rendering/RenderBlock.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::absoluteRects):
+        * 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-07-06  Emil A Eklund  <eae@chromium.org>
+
         Reviewed by Eric Seidel.
 
         Switch offsetFromContainer and related to to new layout types
index 680140c..e31009c 100644 (file)
@@ -57,6 +57,11 @@ inline LayoutPoint roundedLayoutPoint(const FloatPoint& p)
     return roundedIntPoint(p);
 }
 
+inline LayoutPoint flooredLayoutPoint(const FloatPoint& p)
+{
+    return flooredIntPoint(p);
+}
+
 inline LayoutUnit roundedLayoutUnit(float value)
 {
     return lroundf(value);
index 8b6620f..a8a31ef 100644 (file)
@@ -5713,7 +5713,7 @@ void RenderBlock::setPageLogicalOffset(int logicalOffset)
     m_rareData->m_pageLogicalOffset = logicalOffset;
 }
 
-void RenderBlock::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
+void RenderBlock::absoluteRects(Vector<LayoutRect>& rects, const LayoutPoint& 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
@@ -5721,12 +5721,12 @@ void RenderBlock::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumula
     if (isAnonymousBlockContinuation()) {
         // FIXME: This is wrong for block-flows that are horizontal.
         // https://bugs.webkit.org/show_bug.cgi?id=46781
-        rects.append(IntRect(accumulatedOffset.x(), accumulatedOffset.y() - collapsedMarginBefore(),
-                             width(), height() + collapsedMarginBefore() + collapsedMarginAfter()));
-        continuation()->absoluteRects(rects, accumulatedOffset - toSize(location() +
+        rects.append(LayoutRect(accumulatedOffset.x(), accumulatedOffset.y() - collapsedMarginBefore(),
+                                width(), height() + collapsedMarginBefore() + collapsedMarginAfter()));
+        continuation()->absoluteRects(rects, accumulatedOffset - toLayoutSize(location() +
                 inlineElementContinuation()->containingBlock()->location()));
     } else
-        rects.append(IntRect(accumulatedOffset, size()));
+        rects.append(LayoutRect(accumulatedOffset, size()));
 }
 
 void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads)
index c24cbfe..1d4655d 100644 (file)
@@ -629,7 +629,7 @@ private:
     int logicalLeftSelectionOffset(RenderBlock* rootBlock, int position);
     int logicalRightSelectionOffset(RenderBlock* rootBlock, int position);
     
-    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
+    virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint& accumulatedOffset);
     virtual void absoluteQuads(Vector<FloatQuad>&);
 
     int desiredColumnWidth() const;
index 3313220..f29956c 100644 (file)
@@ -459,9 +459,9 @@ void RenderBox::setScrollTop(int newTop)
         layer()->scrollToYOffset(newTop, RenderLayer::ScrollOffsetClamped);
 }
 
-void RenderBox::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
+void RenderBox::absoluteRects(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
 {
-    rects.append(IntRect(accumulatedOffset, size()));
+    rects.append(LayoutRect(accumulatedOffset, size()));
 }
 
 void RenderBox::absoluteQuads(Vector<FloatQuad>& quads)
index 957e11a..7d609b0 100644 (file)
@@ -465,22 +465,22 @@ void RenderInline::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
     m_lineBoxes.paint(this, paintInfo, paintOffset);
 }
 
-void RenderInline::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
+void RenderInline::absoluteRects(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
 {
     if (!alwaysCreateLineBoxes())
-        culledInlineAbsoluteRects(this, rects, toSize(accumulatedOffset));
+        culledInlineAbsoluteRects(this, rects, toLayoutSize(accumulatedOffset));
     else if (InlineFlowBox* curr = firstLineBox()) {
         for (; curr; curr = curr->nextLineBox())
-            rects.append(enclosingIntRect(FloatRect(accumulatedOffset + curr->topLeft(), curr->size())));
+            rects.append(enclosingLayoutRect(FloatRect(accumulatedOffset + curr->topLeft(), curr->size())));
     } else
-        rects.append(IntRect(accumulatedOffset, IntSize()));
+        rects.append(LayoutRect(accumulatedOffset, LayoutSize()));
 
     if (continuation()) {
         if (continuation()->isBox()) {
             RenderBox* box = toRenderBox(continuation());
-            continuation()->absoluteRects(rects, toPoint(accumulatedOffset - containingBlock()->location() + box->size()));
+            continuation()->absoluteRects(rects, toLayoutPoint(accumulatedOffset - containingBlock()->location() + box->size()));
         } else
-            continuation()->absoluteRects(rects, toPoint(accumulatedOffset - containingBlock()->location()));
+            continuation()->absoluteRects(rects, toLayoutPoint(accumulatedOffset - containingBlock()->location()));
     }
 }
 
index fe67ce2..0c8494f 100644 (file)
@@ -48,7 +48,7 @@ public:
     virtual LayoutUnit marginStart() const;
     virtual LayoutUnit marginEnd() const;
 
-    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
+    virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint& accumulatedOffset);
     virtual void absoluteQuads(Vector<FloatQuad>&);
 
     virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
index 7e0898a..6763556 100644 (file)
@@ -1107,7 +1107,7 @@ IntRect RenderObject::absoluteBoundingBoxRect(bool useTransforms)
 
     FloatPoint absPos = localToAbsolute();
     Vector<IntRect> rects;
-    absoluteRects(rects, flooredIntPoint(absPos));
+    absoluteRects(rects, flooredLayoutPoint(absPos));
 
     size_t n = rects.size();
     if (!n)
index f06500c..23edd3b 100644 (file)
@@ -592,7 +592,7 @@ public:
     // Return the offset from an object up the container() chain. Asserts that none of the intermediate objects have transforms.
     LayoutSize offsetFromAncestorContainer(RenderObject*) const;
     
-    virtual void absoluteRects(Vector<IntRect>&, const IntPoint&) { }
+    virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint&) { }
     // FIXME: useTransforms should go away eventually
     IntRect absoluteBoundingBoxRect(bool useTransforms = false);
 
index 0d5e89b..28607f9 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, const IntPoint& accumulatedOffset)
+void RenderText::absoluteRects(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
 {
     for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
-        rects.append(enclosingIntRect(FloatRect(accumulatedOffset + box->topLeft(), box->size())));
+        rects.append(enclosingLayoutRect(FloatRect(accumulatedOffset + box->topLeft(), box->size())));
 }
 
 void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, unsigned end, bool useSelectionHeight)
index 741de40..27d7fc9 100644 (file)
@@ -56,7 +56,7 @@ public:
     InlineTextBox* createInlineTextBox();
     void dirtyLineBoxes(bool fullLayout);
 
-    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
+    virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint& accumulatedOffset);
     void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);
 
     virtual void absoluteQuads(Vector<FloatQuad>&);
index fa2899b..423fe28 100644 (file)
@@ -322,9 +322,9 @@ void RenderView::computeRectForRepaint(RenderBoxModelObject* repaintContainer, I
         rect = m_layer->transform()->mapRect(rect);
 }
 
-void RenderView::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
+void RenderView::absoluteRects(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
 {
-    rects.append(IntRect(accumulatedOffset, m_layer->size()));
+    rects.append(LayoutRect(accumulatedOffset, m_layer->size()));
 }
 
 void RenderView::absoluteQuads(Vector<FloatQuad>& quads)
index 6658a50..d5797e2 100644 (file)
@@ -82,7 +82,7 @@ public:
 
     bool printing() const;
 
-    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
+    virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint& accumulatedOffset);
     virtual void absoluteQuads(Vector<FloatQuad>&);
 
 #if USE(ACCELERATED_COMPOSITING)
index fb55fd1..a1011f3 100644 (file)
@@ -68,7 +68,7 @@ void RenderSVGBlock::updateBoxModelInfoFromStyle()
     setHasOverflowClip(false);
 }
 
-void RenderSVGBlock::absoluteRects(Vector<IntRect>&, const IntPoint&)
+void RenderSVGBlock::absoluteRects(Vector<LayoutRect>&, const LayoutPoint&)
 {
     // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used.
     ASSERT_NOT_REACHED();
index 5069bbf..a50c90c 100644 (file)
@@ -36,7 +36,7 @@ private:
     virtual void setStyle(PassRefPtr<RenderStyle>);
     virtual void updateBoxModelInfoFromStyle();
 
-    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
+    virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint& accumulatedOffset);
 
     virtual void destroy();
     virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
index 201a2ca..989696a 100644 (file)
@@ -70,7 +70,7 @@ IntRect RenderSVGModelObject::outlineBoundsForRepaint(RenderBoxModelObject* repa
     return containerRelativeQuad.enclosingBoundingBox();
 }
 
-void RenderSVGModelObject::absoluteRects(Vector<IntRect>&, const IntPoint&)
+void RenderSVGModelObject::absoluteRects(Vector<LayoutRect>&, const LayoutPoint&)
 {
     // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used.
     ASSERT_NOT_REACHED();
index fcae713..ca6cf65 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>&, const IntPoint& accumulatedOffset);
+    virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint& accumulatedOffset);
     virtual void absoluteQuads(Vector<FloatQuad>&);
 
     virtual void destroy();