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 26c3c8207862f8aec0af352b78defcea46dcf129..0b09b8b90b8991c3117626bdc69333e065f23c26 100644 |
--- a/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp |
+++ b/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp |
@@ -62,7 +62,7 @@ SelectionStrategy CharacterGranularityStrategy::GetType() const { |
void CharacterGranularityStrategy::Clear() {} |
-VisibleSelection CharacterGranularityStrategy::updateExtent( |
+SelectionInDOMTree CharacterGranularityStrategy::updateExtent( |
const IntPoint& extentPoint, |
LocalFrame* frame) { |
const VisiblePosition& extentPosition = |
@@ -71,12 +71,12 @@ VisibleSelection CharacterGranularityStrategy::updateExtent( |
frame->selection().computeVisibleSelectionInDOMTreeDeprecated(); |
if (selection.visibleBase().deepEquivalent() == |
extentPosition.deepEquivalent()) |
- return selection; |
- return createVisibleSelection(SelectionInDOMTree::Builder() |
- .collapse(selection.base()) |
- .extend(extentPosition.deepEquivalent()) |
- .setAffinity(selection.affinity()) |
- .build()); |
+ return selection.asSelection(); |
+ return SelectionInDOMTree::Builder() |
+ .collapse(selection.base()) |
+ .extend(extentPosition.deepEquivalent()) |
+ .setAffinity(selection.affinity()) |
+ .build(); |
} |
DirectionGranularityStrategy::DirectionGranularityStrategy() |
@@ -97,7 +97,7 @@ void DirectionGranularityStrategy::Clear() { |
m_diffExtentPointFromExtentPosition = IntSize(); |
} |
-VisibleSelection DirectionGranularityStrategy::updateExtent( |
+SelectionInDOMTree DirectionGranularityStrategy::updateExtent( |
const IntPoint& extentPoint, |
LocalFrame* frame) { |
const VisibleSelection& selection = |
@@ -144,7 +144,7 @@ VisibleSelection DirectionGranularityStrategy::updateExtent( |
// Do not allow empty selection. |
if (newOffsetExtentPosition.deepEquivalent() == base.deepEquivalent()) |
- return selection; |
+ return selection.asSelection(); |
// The direction granularity strategy, particularly the "offset" feature |
// doesn't work with non-horizontal text (e.g. when the text is rotated). |
@@ -153,12 +153,11 @@ VisibleSelection DirectionGranularityStrategy::updateExtent( |
// without a line change. |
if (verticalChange && |
inSameLine(newOffsetExtentPosition, oldOffsetExtentPosition)) { |
- return createVisibleSelection( |
- SelectionInDOMTree::Builder() |
- .collapse(selection.base()) |
- .extend(newOffsetExtentPosition.deepEquivalent()) |
- .setAffinity(selection.affinity()) |
- .build()); |
+ return SelectionInDOMTree::Builder() |
+ .collapse(selection.base()) |
+ .extend(newOffsetExtentPosition.deepEquivalent()) |
+ .setAffinity(selection.affinity()) |
+ .build(); |
} |
int oldExtentBaseOrder = selection.isBaseFirst() ? 1 : -1; |
@@ -168,7 +167,7 @@ VisibleSelection DirectionGranularityStrategy::updateExtent( |
if (newOffsetExtentPosition.deepEquivalent() == |
oldOffsetExtentPosition.deepEquivalent()) { |
if (m_granularity == CharacterGranularity) |
- return selection; |
+ return selection.asSelection(); |
// If we are in Word granularity, we cannot exit here, since we may pass |
// the middle of the word without changing the position (in which case |
@@ -270,11 +269,10 @@ VisibleSelection DirectionGranularityStrategy::updateExtent( |
m_diffExtentPointFromExtentPosition = |
extentPoint + IntSize(m_offset, 0) - positionLocation(newSelectionExtent); |
- return createVisibleSelection( |
- SelectionInDOMTree::Builder(selection.asSelection()) |
- .collapse(selection.base()) |
- .extend(newSelectionExtent.deepEquivalent()) |
- .build()); |
+ return SelectionInDOMTree::Builder(selection.asSelection()) |
+ .collapse(selection.base()) |
+ .extend(newSelectionExtent.deepEquivalent()) |
+ .build(); |
} |
} // namespace blink |