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

Unified Diff: Source/web/WebLocalFrameImpl.cpp

Issue 653383002: Add new API for only moving the selection extent point. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated comment Created 6 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
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebLocalFrameImpl.cpp
diff --git a/Source/web/WebLocalFrameImpl.cpp b/Source/web/WebLocalFrameImpl.cpp
index c508c7f825670dc38d164d6192373edcbba25fd8..6c7b6050fc5d04724991d02081c9abe49a8080aa 100644
--- a/Source/web/WebLocalFrameImpl.cpp
+++ b/Source/web/WebLocalFrameImpl.cpp
@@ -1162,6 +1162,22 @@ void WebLocalFrameImpl::selectRange(const WebRange& webRange)
frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered);
}
+void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point)
+{
+ VisibleSelection currentSelection = frame()->selection().selection();
+
+ VisiblePosition basePosition = currentSelection.isBaseFirst() ?
+ currentSelection.visibleStart() : currentSelection.visibleEnd();
+ VisiblePosition extentPosition = visiblePositionForWindowPoint(point);
+
+ // Prevent the selection from collapsing.
+ if (comparePositions(basePosition, extentPosition) == 0)
+ return;
+
+ VisibleSelection newSelection = VisibleSelection(basePosition, extentPosition);
+ frame()->selection().setSelection(newSelection, CharacterGranularity);
+}
+
void WebLocalFrameImpl::moveRangeSelection(const WebPoint& base, const WebPoint& extent)
{
VisiblePosition basePosition = visiblePositionForWindowPoint(base);
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698