Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index a38c6e40745dbc4d743a981594dc5b5e3409ec02..6f4aefc133ed7ae3ae92a761b4f49eff8a25d05e 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -1193,12 +1193,14 @@ PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) |
{ |
if (!renderView()) |
return 0; |
- LayoutPoint localPoint; |
- RenderObject* renderer = rendererFromPoint(this, x, y, &localPoint); |
+ HitTestResult result = hitTestInDocument(*this, x, y); |
+ RenderObject* renderer = result.renderer(); |
if (!renderer) |
return 0; |
Node* node = renderer->node(); |
+ if (node->isPseudoElement()) |
+ return 0; |
Node* shadowAncestorNode = ancestorInThisScope(node); |
if (shadowAncestorNode != node) { |
unsigned offset = shadowAncestorNode->nodeIndex(); |
@@ -1206,7 +1208,7 @@ PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) |
return Range::create(*this, container, offset, container, offset); |
} |
- PositionWithAffinity positionWithAffinity = renderer->positionForPoint(localPoint); |
+ PositionWithAffinity positionWithAffinity = result.position(); |
if (positionWithAffinity.position().isNull()) |
return 0; |