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

Unified Diff: Source/core/editing/VisibleSelection.cpp

Issue 1123563003: Improving direction-based selection strategy. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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/editing/VisibleSelection.cpp
diff --git a/Source/core/editing/VisibleSelection.cpp b/Source/core/editing/VisibleSelection.cpp
index 432cfc52e0e0a3b2e67fc6ffb3faa5f68e2ef42a..25619dfcc13ee853d29050ea5fb1bc107d310788 100644
--- a/Source/core/editing/VisibleSelection.cpp
+++ b/Source/core/editing/VisibleSelection.cpp
@@ -593,6 +593,23 @@ void VisibleSelection::setWithoutValidation(const Position& base, const Position
didChange();
}
+void VisibleSelection::setWithoutValidation(const Position& base, const Position& extent, const Position& start, const Position& end)
+{
+ ASSERT(!base.isNull());
+ ASSERT(!extent.isNull());
+ ASSERT(!start.isNull());
+ ASSERT(!end.isNull());
+ ASSERT(m_affinity == DOWNSTREAM);
+ ASSERT(comparePositions(start, end) <= 0);
+ m_base = base;
+ m_extent = extent;
+ m_baseIsFirst = comparePositions(base, extent) <= 0;
+ m_start = start;
+ m_end = end;
+ m_selectionType = base == extent ? CaretSelection : RangeSelection;
+ didChange();
+}
+
static Position adjustPositionForEnd(const Position& currentPosition, Node* startContainerNode)
{
TreeScope& treeScope = startContainerNode->treeScope();

Powered by Google App Engine
This is Rietveld 408576698