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

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

Issue 2437873008: Get rid of flat tree version of createVisibleSelection() taking two VisiblePosition (Closed)
Patch Set: 2016-10-24T13:35:49 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/GranularityStrategy.cpp
diff --git a/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp b/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp
index b5b5fcd9747eb41bddd86a776cd36e8a18f6524f..2b51dcb4ae864b06f008e1d38d382f6621c7c6ef 100644
--- a/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp
+++ b/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp
@@ -71,7 +71,11 @@ VisibleSelection CharacterGranularityStrategy::updateExtent(
if (selection.visibleBase().deepEquivalent() ==
extentPosition.deepEquivalent())
return selection;
- return createVisibleSelection(selection.visibleBase(), extentPosition);
+ return createVisibleSelection(SelectionInDOMTree::Builder()
+ .collapse(selection.base())
+ .extend(extentPosition.deepEquivalent())
+ .setAffinity(selection.affinity())
+ .build());
}
DirectionGranularityStrategy::DirectionGranularityStrategy()
@@ -147,8 +151,12 @@ VisibleSelection DirectionGranularityStrategy::updateExtent(
// without a line change.
if (verticalChange &&
inSameLine(newOffsetExtentPosition, oldOffsetExtentPosition)) {
- return createVisibleSelection(selection.visibleBase(),
- newOffsetExtentPosition);
+ return createVisibleSelection(
+ SelectionInDOMTree::Builder()
+ .collapse(selection.base())
+ .extend(newOffsetExtentPosition.deepEquivalent())
+ .setAffinity(selection.affinity())
+ .build());
}
int oldExtentBaseOrder = selection.isBaseFirst() ? 1 : -1;

Powered by Google App Engine
This is Rietveld 408576698