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

Unified Diff: third_party/WebKit/Source/core/editing/SelectionController.cpp

Issue 2432383002: Get rid of flat tree version of createVisibleSelection() taking two PositionInFlatTree (Closed)
Patch Set: 2016-10-20T15:59:37 Created 4 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: third_party/WebKit/Source/core/editing/SelectionController.cpp
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp
index 7cadac5b0f79ad42fb52330e9cd4746ed0996b3a..f5dd0964b330e89978cd16084e9135bd700f1cbc 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -182,10 +182,11 @@ bool SelectionController::handleMousePressEventSingleClick(
const PositionInFlatTree end = newSelection.end();
int distanceToStart = textDistance(start, pos);
int distanceToEnd = textDistance(pos, end);
- if (distanceToStart <= distanceToEnd)
- newSelection = createVisibleSelection(end, pos);
- else
- newSelection = createVisibleSelection(start, pos);
+ newSelection = createVisibleSelection(
+ SelectionInFlatTree::Builder()
+ .collapse(distanceToStart <= distanceToEnd ? end : start)
+ .extend(pos)
+ .build());
}
} else {
newSelection.setExtent(pos);
@@ -443,7 +444,8 @@ void SelectionController::selectClosestMisspellingFromHitTestResult(
Node* containerNode = markerPosition.computeContainerNode();
const PositionInFlatTree start(containerNode, markers[0]->startOffset());
const PositionInFlatTree end(containerNode, markers[0]->endOffset());
- newSelection = createVisibleSelection(start, end);
+ newSelection = createVisibleSelection(
+ SelectionInFlatTree::Builder().collapse(start).extend(end).build());
}
}

Powered by Google App Engine
This is Rietveld 408576698