Changeset 87018 in webkit
- Timestamp:
- May 21, 2011 6:54:31 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87015 r87018 1 2011-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 1 30 2011-05-21 Jochen Eisinger <jochen@chromium.org> 2 31 -
trunk/Source/WebCore/rendering/EllipsisBox.cpp
r86739 r87018 119 119 if (visibleToHitTesting() && boundsRect.intersects(result.rectForPoint(pointInContainer))) { 120 120 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)) 122 122 return true; 123 123 } -
trunk/Source/WebCore/rendering/HitTestResult.cpp
r86813 r87018 509 509 } 510 510 511 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, int x, int y, const IntRect& rect)511 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const IntPoint& pointInContainer, const IntRect& rect) 512 512 { 513 513 // If it is not a rect-based hit test, this method has to be no-op. … … 537 537 } 538 538 } 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 542 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const IntPoint& pointInContainer, const FloatRect& rect) 543 543 { 544 544 // If it is not a rect-based hit test, this method has to be no-op. … … 568 568 } 569 569 } 570 return !rect.contains(rectForPoint( x, y));570 return !rect.contains(rectForPoint(pointInContainer)); 571 571 } 572 572 -
trunk/Source/WebCore/rendering/HitTestResult.h
r82340 r87018 104 104 // Rect-based hit test related methods. 105 105 bool isRectBasedTest() const { return m_isRectBased; } 106 IntRect rectForPoint(int x, int y) const;107 106 IntRect rectForPoint(const IntPoint&) const; 108 107 static IntRect rectForPoint(const IntPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding); … … 114 113 // Returns true if it is rect-based hit test and needs to continue until the rect is fully 115 114 // 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&); 118 117 void append(const HitTestResult&); 119 118 … … 146 145 }; 147 146 148 inline IntRect HitTestResult::rectForPoint(int x, int y) const149 {150 return rectForPoint(IntPoint(x, y), m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding);151 }152 153 147 // Formula: 154 148 // x = p.x() - rightPadding -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r86705 r87018 940 940 if (visibleToHitTesting() && rect.intersects(result.rectForPoint(pointInContainer))) { 941 941 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)) 943 943 return true; 944 944 } -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r86813 r87018 351 351 if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.intersects(result.rectForPoint(pointInContainer))) { 352 352 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)) 354 354 return true; 355 355 } -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r86739 r87018 3913 3913 updateHitTestResult(result, pointInContainer - localOffset); 3914 3914 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet. 3915 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer .x(), pointInContainer.y()))3915 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer)) 3916 3916 return true; 3917 3917 } … … 3948 3948 if (visibleToHitTesting() && boundsRect.intersects(result.rectForPoint(pointInContainer))) { 3949 3949 updateHitTestResult(result, flipForWritingMode(pointInContainer - localOffset)); 3950 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer .x(), pointInContainer.y(), boundsRect))3950 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect)) 3951 3951 return true; 3952 3952 } … … 4015 4015 colRect.move(tx, ty); 4016 4016 4017 if (colRect.intersects(result.rectForPoint( x, y))) {4017 if (colRect.intersects(result.rectForPoint(IntPoint(x, y)))) { 4018 4018 // The point is inside this column. 4019 4019 // Adjust tx and ty to change where we hit test. … … 4022 4022 int finalX = tx + offset.width(); 4023 4023 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)))) 4025 4025 hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); 4026 4026 else -
trunk/Source/WebCore/rendering/RenderBox.cpp
r86705 r87018 759 759 if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectForPoint(pointInContainer))) { 760 760 updateHitTestResult(result, pointInContainer - IntSize(tx, ty)); 761 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer .x(), pointInContainer.y(), boundsRect))761 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect)) 762 762 return true; 763 763 } -
trunk/Source/WebCore/rendering/RenderTable.cpp
r86781 r87018 1217 1217 if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointInContainer))) { 1218 1218 updateHitTestResult(result, flipForWritingMode(pointInContainer - IntSize(tx, ty))); 1219 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer .x(), pointInContainer.y(), boundsRect))1219 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect)) 1220 1220 return true; 1221 1221 } -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r86705 r87018 335 335 updateHitTestResult(result, pointInBorderBox); 336 336 // 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); 338 338 return true; 339 339 }
Note: See TracChangeset
for help on using the changeset viewer.