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

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

Issue 25668008: Make Document::caretRangeFromPoint() to work with :first-letter style (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-10-04T19:04:13 Created 7 years, 2 months 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 34fc9120c11f49ef13ae9e164b9b14c1a2accf62..236af2283e9f987e8136d9b61c1507322bede4ab 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1207,10 +1207,11 @@ PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y)
if (!renderer())
return 0;
LayoutPoint localPoint;
- Node* node = nodeFromPoint(this, x, y, &localPoint);
- if (!node)
+ RenderObject* renderer = rendererFromPoint(this, x, y, &localPoint);
+ if (!renderer)
return 0;
+ Node* node = renderer->node();
Node* shadowAncestorNode = ancestorInThisScope(node);
if (shadowAncestorNode != node) {
unsigned offset = shadowAncestorNode->nodeIndex();
@@ -1218,9 +1219,6 @@ PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y)
return Range::create(*this, container, offset, container, offset);
}
- RenderObject* renderer = node->renderer();
- if (!renderer)
- return 0;
PositionWithAffinity positionWithAffinity = renderer->positionForPoint(localPoint);
if (positionWithAffinity.position().isNull())
return 0;

Powered by Google App Engine
This is Rietveld 408576698