Title: [87825] trunk/Source/WebCore
Revision
87825
Author
[email protected]
Date
2011-06-01 10:59:02 -0700 (Wed, 01 Jun 2011)

Log Message

2011-06-01  Levi Weintraub  <[email protected]>

        Reviewed by Eric Seidel.

        Switch RenderLineBoxList intersection functions to use IntPoint
        https://bugs.webkit.org/show_bug.cgi?id=61794

        Switching rangeIntersectsRect, anyLineIntersectsRect, and lineIntersectsDirtyRect
        to take IntPoint instead of a tx/ty to represent the offset to be applied match
        the rect and lines' coordinates.

        No new tests since this is merely refactoring.

        * rendering/RenderLineBoxList.cpp:
        (WebCore::RenderLineBoxList::rangeIntersectsRect):
        (WebCore::RenderLineBoxList::anyLineIntersectsRect):
        (WebCore::RenderLineBoxList::lineIntersectsDirtyRect):
        (WebCore::RenderLineBoxList::paint):
        (WebCore::RenderLineBoxList::hitTest):
        * rendering/RenderLineBoxList.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87824 => 87825)


--- trunk/Source/WebCore/ChangeLog	2011-06-01 17:55:07 UTC (rev 87824)
+++ trunk/Source/WebCore/ChangeLog	2011-06-01 17:59:02 UTC (rev 87825)
@@ -1,3 +1,24 @@
+2011-06-01  Levi Weintraub  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        Switch RenderLineBoxList intersection functions to use IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=61794
+
+        Switching rangeIntersectsRect, anyLineIntersectsRect, and lineIntersectsDirtyRect
+        to take IntPoint instead of a tx/ty to represent the offset to be applied match
+        the rect and lines' coordinates.
+
+        No new tests since this is merely refactoring.
+
+        * rendering/RenderLineBoxList.cpp:
+        (WebCore::RenderLineBoxList::rangeIntersectsRect):
+        (WebCore::RenderLineBoxList::anyLineIntersectsRect):
+        (WebCore::RenderLineBoxList::lineIntersectsDirtyRect):
+        (WebCore::RenderLineBoxList::paint):
+        (WebCore::RenderLineBoxList::hitTest):
+        * rendering/RenderLineBoxList.h:
+
 2011-05-19  Adrienne Walker  <[email protected]>
 
         Reviewed by James Robinson.

Modified: trunk/Source/WebCore/rendering/RenderLineBoxList.cpp (87824 => 87825)


--- trunk/Source/WebCore/rendering/RenderLineBoxList.cpp	2011-06-01 17:55:07 UTC (rev 87824)
+++ trunk/Source/WebCore/rendering/RenderLineBoxList.cpp	2011-06-01 17:59:02 UTC (rev 87825)
@@ -146,7 +146,7 @@
         curr->dirtyLineBoxes();
 }
 
-bool RenderLineBoxList::rangeIntersectsRect(RenderBoxModelObject* renderer, int logicalTop, int logicalBottom, const IntRect& rect, int tx, int ty) const
+bool RenderLineBoxList::rangeIntersectsRect(RenderBoxModelObject* renderer, int logicalTop, int logicalBottom, const IntRect& rect, const IntPoint& offset) const
 {
     RenderBox* block;
     if (renderer->isBox())
@@ -159,11 +159,11 @@
     physicalStart = min(physicalStart, physicalEnd);
     
     if (renderer->style()->isHorizontalWritingMode()) {
-        physicalStart += ty;
+        physicalStart += offset.y();
         if (physicalStart >= rect.maxY() || physicalStart + physicalExtent <= rect.y())
             return false;
     } else {
-        physicalStart += tx;
+        physicalStart += offset.x();
         if (physicalStart >= rect.maxX() || physicalStart + physicalExtent <= rect.x())
             return false;
     }
@@ -171,7 +171,7 @@
     return true;
 }
 
-bool RenderLineBoxList::anyLineIntersectsRect(RenderBoxModelObject* renderer, const IntRect& rect, int tx, int ty, bool usePrintRect, int outlineSize) const
+bool RenderLineBoxList::anyLineIntersectsRect(RenderBoxModelObject* renderer, const IntRect& rect, const IntPoint& offset, bool usePrintRect, int outlineSize) const
 {
     // We can check the first box and last box and avoid painting/hit testing if we don't
     // intersect.  This is a quick short-circuit that we can take to avoid walking any lines.
@@ -188,16 +188,16 @@
     int logicalTop = firstLineTop - outlineSize;
     int logicalBottom = outlineSize + lastLineBottom;
     
-    return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, tx, ty);
+    return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, offset);
 }
 
-bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, int tx, int ty) const
+bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, const IntPoint& offset) const
 {
     RootInlineBox* root = box->root();
     int logicalTop = min(box->logicalTopVisualOverflow(root->lineTop()), root->selectionTop()) - renderer->maximalOutlineSize(paintInfo.phase);
     int logicalBottom = box->logicalBottomVisualOverflow(root->lineBottom()) + renderer->maximalOutlineSize(paintInfo.phase);
     
-    return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.rect, tx, ty);
+    return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.rect, offset);
 }
 
 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintInfo, int tx, int ty) const
@@ -219,7 +219,7 @@
     RenderView* v = renderer->view();
     bool usePrintRect = !v->printRect().isEmpty();
     int outlineSize = renderer->maximalOutlineSize(paintInfo.phase);
-    if (!anyLineIntersectsRect(renderer, paintInfo.rect, tx, ty, usePrintRect, outlineSize))
+    if (!anyLineIntersectsRect(renderer, paintInfo.rect, IntPoint(tx, ty), usePrintRect, outlineSize))
         return;
 
     PaintInfo info(paintInfo);
@@ -257,7 +257,7 @@
             }
         }
 
-        if (lineIntersectsDirtyRect(renderer, curr, info, tx, ty)) {
+        if (lineIntersectsDirtyRect(renderer, curr, info, IntPoint(tx, ty))) {
             RootInlineBox* root = curr->root();
             curr->paint(info, IntPoint(tx, ty), root->lineTop(), root->lineBottom());
         }
@@ -289,7 +289,7 @@
         IntRect(pointInContainer.x(), pointInContainer.y() - result.topPadding(), 1, result.topPadding() + result.bottomPadding() + 1) :
         IntRect(pointInContainer.x() - result.leftPadding(), pointInContainer.y(), result.rightPadding() + result.leftPadding() + 1, 1);
 
-    if (!anyLineIntersectsRect(renderer, rect, tx, ty))
+    if (!anyLineIntersectsRect(renderer, rect, IntPoint(tx, ty)))
         return false;
 
     // See if our root lines contain the point.  If so, then we hit test
@@ -297,7 +297,7 @@
     // based off positions of our first line box or our last line box.
     for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) {
         RootInlineBox* root = curr->root();
-        if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root->lineTop()), curr->logicalBottomVisualOverflow(root->lineBottom()), rect, tx, ty)) {
+        if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root->lineTop()), curr->logicalBottomVisualOverflow(root->lineBottom()), rect, IntPoint(tx, ty))) {
             bool inside = curr->nodeAtPoint(request, result, pointInContainer, tx, ty, root->lineTop(), root->lineBottom());
             if (inside) {
                 renderer->updateHitTestResult(result, pointInContainer - IntSize(tx, ty));

Modified: trunk/Source/WebCore/rendering/RenderLineBoxList.h (87824 => 87825)


--- trunk/Source/WebCore/rendering/RenderLineBoxList.h	2011-06-01 17:55:07 UTC (rev 87824)
+++ trunk/Source/WebCore/rendering/RenderLineBoxList.h	2011-06-01 17:59:02 UTC (rev 87825)
@@ -67,9 +67,9 @@
     bool hitTest(RenderBoxModelObject*, const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, int tx, int ty, HitTestAction) const;
     
 private:
-    bool anyLineIntersectsRect(RenderBoxModelObject*, const IntRect&, int tx, int ty, bool usePrintRect = false, int outlineSize = 0) const;
-    bool lineIntersectsDirtyRect(RenderBoxModelObject*, InlineFlowBox*, const PaintInfo&, int tx, int ty) const;
-    bool rangeIntersectsRect(RenderBoxModelObject*, int logicalTop, int logicalBottom, const IntRect&, int tx, int ty) const;
+    bool anyLineIntersectsRect(RenderBoxModelObject*, const IntRect&, const IntPoint&, bool usePrintRect = false, int outlineSize = 0) const;
+    bool lineIntersectsDirtyRect(RenderBoxModelObject*, InlineFlowBox*, const PaintInfo&, const IntPoint&) const;
+    bool rangeIntersectsRect(RenderBoxModelObject*, int logicalTop, int logicalBottom, const IntRect&, const IntPoint&) const;
 
     // For block flows, each box represents the root inline box for a line in the
     // paragraph.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to