Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 89d04e2a62c50f6a09b002d7ffecccd864d450d9..bd42f7cee64a0d62cd9228cc9f41514656f83fb5 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -1188,12 +1188,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(); |
@@ -1201,7 +1203,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; |