Title: [88202] trunk/Source/WebCore
Revision
88202
Author
[email protected]
Date
2011-06-06 16:45:22 -0700 (Mon, 06 Jun 2011)

Log Message

2011-06-06  Emil A Eklund  <[email protected]>

        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/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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88201 => 88202)


--- trunk/Source/WebCore/ChangeLog	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/ChangeLog	2011-06-06 23:45:22 UTC (rev 88202)
@@ -1,3 +1,34 @@
+2011-06-06  Emil A Eklund  <[email protected]>
+
+        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/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:
+
 2011-06-06  Levi Weintraub  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/dom/Node.cpp (88201 => 88202)


--- trunk/Source/WebCore/dom/Node.cpp	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/dom/Node.cpp	2011-06-06 23:45:22 UTC (rev 88202)
@@ -839,7 +839,7 @@
 
     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())

Modified: trunk/Source/WebCore/rendering/InlineBox.h (88201 => 88202)


--- trunk/Source/WebCore/rendering/InlineBox.h	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/InlineBox.h	2011-06-06 23:45:22 UTC (rev 88202)
@@ -236,6 +236,7 @@
 
     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(); }
 

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-06-06 23:45:22 UTC (rev 88202)
@@ -5665,7 +5665,7 @@
     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
@@ -5673,13 +5673,12 @@
     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)

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2011-06-06 23:45:22 UTC (rev 88202)
@@ -625,7 +625,7 @@
     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;

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-06-06 23:45:22 UTC (rev 88202)
@@ -455,9 +455,9 @@
         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)

Modified: trunk/Source/WebCore/rendering/RenderBox.h (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderBox.h	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2011-06-06 23:45:22 UTC (rev 88202)
@@ -230,7 +230,7 @@
     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;

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2011-06-06 23:45:22 UTC (rev 88202)
@@ -465,24 +465,22 @@
     m_lineBoxes.paint(this, paintInfo, tx, ty);
 }
 
-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()));
     }
 }
 

Modified: trunk/Source/WebCore/rendering/RenderInline.h (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderInline.h	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderInline.h	2011-06-06 23:45:22 UTC (rev 88202)
@@ -48,7 +48,7 @@
     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;

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2011-06-06 23:45:22 UTC (rev 88202)
@@ -1099,7 +1099,7 @@
 
     FloatPoint absPos = localToAbsolute();
     Vector<IntRect> rects;
-    absoluteRects(rects, absPos.x(), absPos.y());
+    absoluteRects(rects, flooredIntPoint(absPos));
 
     size_t n = rects.size();
     if (!n)

Modified: trunk/Source/WebCore/rendering/RenderObject.h (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderObject.h	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2011-06-06 23:45:22 UTC (rev 88202)
@@ -590,7 +590,7 @@
     // 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);
 

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2011-06-06 23:45:22 UTC (rev 88202)
@@ -269,10 +269,10 @@
     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)

Modified: trunk/Source/WebCore/rendering/RenderText.h (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderText.h	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderText.h	2011-06-06 23:45:22 UTC (rev 88202)
@@ -56,7 +56,7 @@
     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>&);

Modified: trunk/Source/WebCore/rendering/RenderView.cpp (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderView.cpp	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderView.cpp	2011-06-06 23:45:22 UTC (rev 88202)
@@ -321,9 +321,9 @@
         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)

Modified: trunk/Source/WebCore/rendering/RenderView.h (88201 => 88202)


--- trunk/Source/WebCore/rendering/RenderView.h	2011-06-06 23:31:52 UTC (rev 88201)
+++ trunk/Source/WebCore/rendering/RenderView.h	2011-06-06 23:45:22 UTC (rev 88202)
@@ -82,7 +82,7 @@
 
     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)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to