Changeset 87018 in webkit


Ignore:
Timestamp:
May 21, 2011 6:54:31 AM (13 years ago)
Author:
eae@chromium.org
Message:

2011-05-21 Emil A Eklund <eae@chromium.org>

Reviewed by Eric Seidel.

Change HitTestResult to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=61230

Covered by existing tests.

  • rendering/EllipsisBox.cpp: (WebCore::EllipsisBox::nodeAtPoint):
  • rendering/HitTestResult.cpp: (WebCore::HitTestResult::addNodeToRectBasedTestResult):
  • rendering/HitTestResult.h: (WebCore::HitTestResult::isRectBasedTest):
  • rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::nodeAtPoint):
  • rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::nodeAtPoint):
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::nodeAtPoint): (WebCore::RenderBlock::hitTestColumns):
  • rendering/RenderBox.cpp: (WebCore::RenderBox::nodeAtPoint):
  • rendering/RenderTable.cpp: (WebCore::RenderTable::nodeAtPoint):
  • rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::nodeAtPoint):
Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87015 r87018  
     12011-05-21  Emil A Eklund  <eae@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Change HitTestResult to use IntPoint
     6        https://bugs.webkit.org/show_bug.cgi?id=61230
     7
     8        Covered by existing tests.
     9
     10        * rendering/EllipsisBox.cpp:
     11        (WebCore::EllipsisBox::nodeAtPoint):
     12        * rendering/HitTestResult.cpp:
     13        (WebCore::HitTestResult::addNodeToRectBasedTestResult):
     14        * rendering/HitTestResult.h:
     15        (WebCore::HitTestResult::isRectBasedTest):
     16        * rendering/InlineFlowBox.cpp:
     17        (WebCore::InlineFlowBox::nodeAtPoint):
     18        * rendering/InlineTextBox.cpp:
     19        (WebCore::InlineTextBox::nodeAtPoint):
     20        * rendering/RenderBlock.cpp:
     21        (WebCore::RenderBlock::nodeAtPoint):
     22        (WebCore::RenderBlock::hitTestColumns):
     23        * rendering/RenderBox.cpp:
     24        (WebCore::RenderBox::nodeAtPoint):
     25        * rendering/RenderTable.cpp:
     26        (WebCore::RenderTable::nodeAtPoint):
     27        * rendering/svg/RenderSVGRoot.cpp:
     28        (WebCore::RenderSVGRoot::nodeAtPoint):
     29
    1302011-05-21  Jochen Eisinger  <jochen@chromium.org>
    231
  • trunk/Source/WebCore/rendering/EllipsisBox.cpp

    r86739 r87018  
    119119    if (visibleToHitTesting() && boundsRect.intersects(result.rectForPoint(pointInContainer))) {
    120120        renderer()->updateHitTestResult(result, pointInContainer - IntSize(tx, ty));
    121         if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer.x(), pointInContainer.y(), boundsRect))
     121        if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer, boundsRect))
    122122            return true;
    123123    }
  • trunk/Source/WebCore/rendering/HitTestResult.cpp

    r86813 r87018  
    509509}
    510510
    511 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, int x, int y, const IntRect& rect)
     511bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const IntPoint& pointInContainer, const IntRect& rect)
    512512{
    513513    // If it is not a rect-based hit test, this method has to be no-op.
     
    537537        }
    538538    }
    539     return !rect.contains(rectForPoint(x, y));
    540 }
    541 
    542 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, int x, int y, const FloatRect& rect)
     539    return !rect.contains(rectForPoint(pointInContainer));
     540}
     541
     542bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const IntPoint& pointInContainer, const FloatRect& rect)
    543543{
    544544    // If it is not a rect-based hit test, this method has to be no-op.
     
    568568        }
    569569    }
    570     return !rect.contains(rectForPoint(x, y));
     570    return !rect.contains(rectForPoint(pointInContainer));
    571571}
    572572
  • trunk/Source/WebCore/rendering/HitTestResult.h

    r82340 r87018  
    104104    // Rect-based hit test related methods.
    105105    bool isRectBasedTest() const { return m_isRectBased; }
    106     IntRect rectForPoint(int x, int y) const;
    107106    IntRect rectForPoint(const IntPoint&) const;
    108107    static IntRect rectForPoint(const IntPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
     
    114113    // Returns true if it is rect-based hit test and needs to continue until the rect is fully
    115114    // enclosed by the boundaries of a node.
    116     bool addNodeToRectBasedTestResult(Node*, int x, int y, const IntRect& = IntRect());
    117     bool addNodeToRectBasedTestResult(Node*, int x, int y, const FloatRect&);
     115    bool addNodeToRectBasedTestResult(Node*, const IntPoint& pointInContainer, const IntRect& = IntRect());
     116    bool addNodeToRectBasedTestResult(Node*, const IntPoint& pointInContainer, const FloatRect&);
    118117    void append(const HitTestResult&);
    119118
     
    146145};
    147146
    148 inline IntRect HitTestResult::rectForPoint(int x, int y) const
    149 {
    150     return rectForPoint(IntPoint(x, y), m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding);
    151 }
    152 
    153147// Formula:
    154148// x = p.x() - rightPadding
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r86705 r87018  
    940940    if (visibleToHitTesting() && rect.intersects(result.rectForPoint(pointInContainer))) {
    941941        renderer()->updateHitTestResult(result, flipForWritingMode(pointInContainer - IntSize(tx, ty))); // Don't add in m_x or m_y here, we want coords in the containing block's space.
    942         if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer.x(), pointInContainer.y(), rect))
     942        if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer, rect))
    943943            return true;
    944944    }
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r86813 r87018  
    351351    if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.intersects(result.rectForPoint(pointInContainer))) {
    352352        renderer()->updateHitTestResult(result, flipForWritingMode(pointInContainer - IntSize(tx, ty)));
    353         if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer.x(), pointInContainer.y(), rect))
     353        if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer, rect))
    354354            return true;
    355355    }
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r86739 r87018  
    39133913        updateHitTestResult(result, pointInContainer - localOffset);
    39143914        // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet.
    3915         if (!result.addNodeToRectBasedTestResult(node(), pointInContainer.x(), pointInContainer.y()))
     3915        if (!result.addNodeToRectBasedTestResult(node(), pointInContainer))
    39163916           return true;
    39173917    }
     
    39483948        if (visibleToHitTesting() && boundsRect.intersects(result.rectForPoint(pointInContainer))) {
    39493949            updateHitTestResult(result, flipForWritingMode(pointInContainer - localOffset));
    3950             if (!result.addNodeToRectBasedTestResult(node(), pointInContainer.x(), pointInContainer.y(), boundsRect))
     3950            if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect))
    39513951                return true;
    39523952        }
     
    40154015        colRect.move(tx, ty);
    40164016       
    4017         if (colRect.intersects(result.rectForPoint(x, y))) {
     4017        if (colRect.intersects(result.rectForPoint(IntPoint(x, y)))) {
    40184018            // The point is inside this column.
    40194019            // Adjust tx and ty to change where we hit test.
     
    40224022            int finalX = tx + offset.width();
    40234023            int finalY = ty + offset.height();
    4024             if (result.isRectBasedTest() && !colRect.contains(result.rectForPoint(x, y)))
     4024            if (result.isRectBasedTest() && !colRect.contains(result.rectForPoint(IntPoint(x, y))))
    40254025                hitTestContents(request, result, x, y, finalX, finalY, hitTestAction);
    40264026            else
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r86705 r87018  
    759759    if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectForPoint(pointInContainer))) {
    760760        updateHitTestResult(result, pointInContainer - IntSize(tx, ty));
    761         if (!result.addNodeToRectBasedTestResult(node(), pointInContainer.x(), pointInContainer.y(), boundsRect))
     761        if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect))
    762762            return true;
    763763    }
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r86781 r87018  
    12171217    if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointInContainer))) {
    12181218        updateHitTestResult(result, flipForWritingMode(pointInContainer - IntSize(tx, ty)));
    1219         if (!result.addNodeToRectBasedTestResult(node(), pointInContainer.x(), pointInContainer.y(), boundsRect))
     1219        if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect))
    12201220            return true;
    12211221    }
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r86705 r87018  
    335335            updateHitTestResult(result, pointInBorderBox);
    336336            // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
    337             result.addNodeToRectBasedTestResult(child->node(), pointInContainer.x(), pointInContainer.y());
     337            result.addNodeToRectBasedTestResult(child->node(), pointInContainer);
    338338            return true;
    339339        }
Note: See TracChangeset for help on using the changeset viewer.