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

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-21T16:03:11 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..5efb29172ee8b20d6309e310da49782bad306727 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.visibleBase().toPositionWithAffinity())
Xiaocheng 2016/10/21 11:18:36 We should use collapse(selection.base()).setAffini
yosin_UTC9 2016/10/24 06:19:44 Good catch! Done
+ .extend(extentPosition.deepEquivalent())
+ .build());
}
DirectionGranularityStrategy::DirectionGranularityStrategy()
@@ -147,8 +151,11 @@ VisibleSelection DirectionGranularityStrategy::updateExtent(
// without a line change.
if (verticalChange &&
inSameLine(newOffsetExtentPosition, oldOffsetExtentPosition)) {
- return createVisibleSelection(selection.visibleBase(),
- newOffsetExtentPosition);
+ return createVisibleSelection(
+ SelectionInDOMTree::Builder()
+ .collapse(selection.visibleBase().toPositionWithAffinity())
Xiaocheng 2016/10/21 11:18:36 We should use collapse(selection.base()).setAffini
yosin_UTC9 2016/10/24 06:19:44 Good catch! Done.
+ .extend(newOffsetExtentPosition.deepEquivalent())
+ .build());
}
int oldExtentBaseOrder = selection.isBaseFirst() ? 1 : -1;

Powered by Google App Engine
This is Rietveld 408576698