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

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-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/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;

Powered by Google App Engine
This is Rietveld 408576698