Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Unified Diff: Source/core/dom/TreeScope.cpp

Issue 96483003: CANCEL: Make Document::caretRangeFromPoint() to work with :before style Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-12-03T12:38:54 Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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())

Powered by Google App Engine
This is Rietveld 408576698