Index: Source/core/dom/TreeScope.cpp |
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp |
index 3e0494c950cca921f54a5a229db8d9b093f2b840..a85d9e52a08fa6d5fc782ac09d9e1a0d6ac5cec9 100644 |
--- a/Source/core/dom/TreeScope.cpp |
+++ b/Source/core/dom/TreeScope.cpp |
@@ -213,38 +213,32 @@ HTMLMapElement* TreeScope::getImageMap(const String& url) const |
return toHTMLMapElement(m_imageMapsByName->getElementByMapName(AtomicString(name).impl(), this)); |
} |
-RenderObject* rendererFromPoint(Document* document, int x, int y, LayoutPoint* localPoint) |
+HitTestResult hitTestInDocument(const Document& document, int x, int y) |
{ |
- Frame* frame = document->frame(); |
+ Frame* frame = document.frame(); |
if (!frame) |
- return 0; |
+ return HitTestResult(); |
FrameView* frameView = frame->view(); |
if (!frameView) |
- return 0; |
+ return HitTestResult(); |
float scaleFactor = frame->pageZoomFactor(); |
IntPoint point = roundedIntPoint(FloatPoint(x * scaleFactor + frameView->scrollX(), y * scaleFactor + frameView->scrollY())); |
if (!frameView->visibleContentRect().contains(point)) |
- return 0; |
+ return HitTestResult(); |
HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent); |
HitTestResult result(point); |
- document->renderView()->hitTest(request, result); |
- |
- if (localPoint) |
- *localPoint = result.localPoint(); |
- |
- return result.renderer(); |
+ document.renderView()->hitTest(request, result); |
+ return result; |
} |
Element* TreeScope::elementFromPoint(int x, int y) const |
{ |
- RenderObject* renderer = rendererFromPoint(&rootNode()->document(), x, y); |
- if (!renderer) |
- return 0; |
- Node* node = renderer->node(); |
+ HitTestResult result = hitTestInDocument(rootNode()->document(), x, y); |
+ Node* node = result.innerNode(); |
if (!node) |
return 0; |
if (node->isPseudoElement() || node->isTextNode()) |