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

Unified Diff: Source/core/frame/LocalFrame.cpp

Issue 1310323004: Introduce positionForPoint() in LocalFrame class as replacement of visiblePositionForPoint() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-25T15:15:43 Created 5 years, 4 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
« no previous file with comments | « Source/core/frame/LocalFrame.h ('k') | Source/core/page/DragController.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalFrame.cpp
diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp
index 35975f313b488a5891afda26cba9c194895d7d12..decf938ae111770ca07bd2c53beeaed53e664cc9 100644
--- a/Source/core/frame/LocalFrame.cpp
+++ b/Source/core/frame/LocalFrame.cpp
@@ -672,19 +672,19 @@ String LocalFrame::selectedTextForClipboard() const
return selection().selectedTextForClipboard();
}
-VisiblePosition LocalFrame::visiblePositionForPoint(const IntPoint& framePoint)
+PositionWithAffinity LocalFrame::positionForPoint(const IntPoint& framePoint)
{
HitTestResult result = eventHandler().hitTestResultAtPoint(framePoint);
Node* node = result.innerNodeOrImageMapImage();
if (!node)
- return VisiblePosition();
+ return PositionWithAffinity();
LayoutObject* layoutObject = node->layoutObject();
if (!layoutObject)
- return VisiblePosition();
- VisiblePosition visiblePos = VisiblePosition(layoutObject->positionForPoint(result.localPoint()));
- if (visiblePos.isNull())
- visiblePos = VisiblePosition(firstPositionInOrBeforeNode(node));
- return visiblePos;
+ return PositionWithAffinity();
+ const PositionWithAffinity position = layoutObject->positionForPoint(result.localPoint());
+ if (position.isNull())
+ return PositionWithAffinity(firstPositionInOrBeforeNode(node));
+ return position;
}
Document* LocalFrame::documentAtPoint(const IntPoint& pointInRootFrame)
@@ -702,10 +702,11 @@ Document* LocalFrame::documentAtPoint(const IntPoint& pointInRootFrame)
EphemeralRange LocalFrame::rangeForPoint(const IntPoint& framePoint)
{
- VisiblePosition position = visiblePositionForPoint(framePoint);
- if (position.isNull())
+ const PositionWithAffinity positionWithAffinity = positionForPoint(framePoint);
+ if (positionWithAffinity.isNull())
return EphemeralRange();
+ VisiblePosition position(positionWithAffinity);
VisiblePosition previous = position.previous();
if (previous.isNotNull()) {
const EphemeralRange previousCharacterRange = makeRange(previous, position);
« no previous file with comments | « Source/core/frame/LocalFrame.h ('k') | Source/core/page/DragController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698