Changeset 87019 in webkit
- Timestamp:
- May 21, 2011 8:30:02 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87018 r87019 1 2011-05-21 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Change RenderLineBoxList::hitTest to use IntPoint 6 https://bugs.webkit.org/show_bug.cgi?id=61156 7 8 Change the RenderLineBoxList hit testing to use IntPoint and clean up the rect calculation. 9 10 Covered by existing tests. 11 12 * rendering/RenderBlock.cpp: 13 (WebCore::RenderBlock::hitTestContents): 14 * rendering/RenderInline.cpp: 15 (WebCore::RenderInline::nodeAtPoint): 16 * rendering/RenderLineBoxList.cpp: 17 (WebCore::RenderLineBoxList::hitTest): 18 * rendering/RenderLineBoxList.h: 19 1 20 2011-05-21 Emil A Eklund <eae@chromium.org> 2 21 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r87018 r87019 4036 4036 if (childrenInline() && !isTable()) { 4037 4037 // We have to hit-test our line boxes. 4038 if (m_lineBoxes.hitTest(this, request, result, x, y, tx, ty, hitTestAction))4038 if (m_lineBoxes.hitTest(this, request, result, IntPoint(x, y), tx, ty, hitTestAction)) 4039 4039 return true; 4040 4040 } else { -
trunk/Source/WebCore/rendering/RenderInline.cpp
r86705 r87019 715 715 const IntPoint& pointInContainer, int tx, int ty, HitTestAction hitTestAction) 716 716 { 717 return m_lineBoxes.hitTest(this, request, result, pointInContainer .x(), pointInContainer.y(), tx, ty, hitTestAction);717 return m_lineBoxes.hitTest(this, request, result, pointInContainer, tx, ty, hitTestAction); 718 718 } 719 719 -
trunk/Source/WebCore/rendering/RenderLineBoxList.cpp
r86705 r87019 275 275 276 276 277 bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) const277 bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestRequest& request, HitTestResult& result, const IntPoint& pointInContainer, int tx, int ty, HitTestAction hitTestAction) const 278 278 { 279 279 if (hitTestAction != HitTestForeground) … … 286 286 return false; 287 287 288 bool isHorizontal = firstLineBox()->isHorizontal(); 289 290 int logicalPointStart = isHorizontal ? y - result.topPadding() : x - result.leftPadding(); 291 int logicalPointEnd = (isHorizontal ? y + result.bottomPadding() : x + result.rightPadding()) + 1; 292 IntRect rect(isHorizontal ? x : logicalPointStart, isHorizontal ? logicalPointStart : y, 293 isHorizontal ? 1 : logicalPointEnd - logicalPointStart, 294 isHorizontal ? logicalPointEnd - logicalPointStart : 1); 288 IntRect rect = firstLineBox()->isHorizontal() ? 289 IntRect(pointInContainer.x(), pointInContainer.y() - result.topPadding(), 1, result.topPadding() + result.bottomPadding() + 1) : 290 IntRect(pointInContainer.x() - result.leftPadding(), pointInContainer.y(), result.rightPadding() + result.leftPadding() + 1, 1); 291 295 292 if (!anyLineIntersectsRect(renderer, rect, tx, ty)) 296 293 return false; … … 302 299 RootInlineBox* root = curr->root(); 303 300 if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root->lineTop()), curr->logicalBottomVisualOverflow(root->lineBottom()), rect, tx, ty)) { 304 bool inside = curr->nodeAtPoint(request, result, IntPoint(x, y), tx, ty, root->lineTop(), root->lineBottom());301 bool inside = curr->nodeAtPoint(request, result, pointInContainer, tx, ty, root->lineTop(), root->lineBottom()); 305 302 if (inside) { 306 renderer->updateHitTestResult(result, IntPoint(x - tx, y -ty));303 renderer->updateHitTestResult(result, pointInContainer - IntSize(tx, ty)); 307 304 return true; 308 305 } -
trunk/Source/WebCore/rendering/RenderLineBoxList.h
r71177 r87019 65 65 66 66 void paint(RenderBoxModelObject*, PaintInfo&, int x, int y) const; 67 bool hitTest(RenderBoxModelObject*, const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction) const;67 bool hitTest(RenderBoxModelObject*, const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, int tx, int ty, HitTestAction) const; 68 68 69 69 private:
Note: See TracChangeset
for help on using the changeset viewer.