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

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

Issue 96483003: CANCEL: Make Document::caretRangeFromPoint() to work with :before style Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-11-29T17:59:37 Created 7 years, 1 month 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/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;

Powered by Google App Engine
This is Rietveld 408576698