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

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-07T15:30:03 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 d811dd7afc11f71848e014fc9bd62dca98eb9436..b151a7ff21aff2ccb14dbc055137b32e66426afa 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1204,10 +1204,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();
@@ -1215,9 +1216,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