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

Unified Diff: Source/core/page/EventHandler.cpp

Issue 15017002: WebFrame::selectRange and moveCaret should behave like mouse selection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move to method of VisibleSelection, fix style nits Created 7 years, 7 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/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index f158f9700059c75ffdd95941b30daf35a0f83709..9bb5a3376f037512fe89eece2325e0ed91cba011 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -698,26 +698,6 @@ void EventHandler::updateSelectionForMouseDrag()
updateSelectionForMouseDrag(result);
}
-static VisiblePosition selectionExtentRespectingEditingBoundary(const VisibleSelection& selection, const LayoutPoint& localPoint, Node* targetNode)
-{
- LayoutPoint selectionEndPoint = localPoint;
- Element* editableElement = selection.rootEditableElement();
-
- if (!targetNode->renderer())
- return VisiblePosition();
-
- if (editableElement && !editableElement->contains(targetNode)) {
- if (!editableElement->renderer())
- return VisiblePosition();
-
- FloatPoint absolutePoint = targetNode->renderer()->localToAbsolute(FloatPoint(selectionEndPoint));
- selectionEndPoint = roundedLayoutPoint(editableElement->renderer()->absoluteToLocal(absolutePoint));
- targetNode = editableElement;
- }
-
- return targetNode->renderer()->positionForPoint(selectionEndPoint);
-}
-
void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResult)
{
if (!m_mouseDownMayStartSelect)
@@ -727,8 +707,7 @@ void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResul
if (!target)
return;
- VisiblePosition targetPosition = selectionExtentRespectingEditingBoundary(m_frame->selection()->selection(), hitTestResult.localPoint(), target);
-
+ VisiblePosition targetPosition = m_frame->selection()->selection().visiblePositionRespectingEditingBoundary(hitTestResult.localPoint(), target);
// Don't modify the selection if we're not on a node.
if (targetPosition.isNull())
return;
« Source/WebKit/chromium/public/WebFrame.h ('K') | « Source/core/editing/VisibleSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698