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

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

Issue 2710613002: Make PendingSelection::calcVisibleSelection() to return SelectionInFlatTree (Closed)
Patch Set: 2017-02-21T13:20:23 Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/PendingSelection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/PendingSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/PendingSelection.cpp b/third_party/WebKit/Source/core/editing/PendingSelection.cpp
index 1aca83e86a2bf47a6d9defaaeb46650a62ed537c..1b106656d49673990d8f12016ed2f04fad889264 100644
--- a/third_party/WebKit/Source/core/editing/PendingSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/PendingSelection.cpp
@@ -55,7 +55,7 @@ static bool isSelectionInDocument(
return true;
}
-VisibleSelectionInFlatTree PendingSelection::calcVisibleSelection(
+SelectionInFlatTree PendingSelection::calcVisibleSelection(
const VisibleSelectionInFlatTree& originalSelection) const {
const PositionInFlatTree& start = originalSelection.start();
const PositionInFlatTree& end = originalSelection.end();
@@ -66,7 +66,6 @@ VisibleSelectionInFlatTree PendingSelection::calcVisibleSelection(
m_frameSelection->shouldShowBlockCursor() &&
selectionType == SelectionType::CaretSelection &&
!isLogicalEndOfLine(createVisiblePosition(end, affinity));
- VisibleSelectionInFlatTree selection;
if (enclosingTextControl(start.computeContainerNode())) {
// TODO(yosin) We should use |PositionMoveType::CodePoint| to avoid
// ending paint at middle of character.
@@ -74,8 +73,9 @@ VisibleSelectionInFlatTree PendingSelection::calcVisibleSelection(
paintBlockCursor ? nextPositionOf(originalSelection.extent(),
PositionMoveType::CodeUnit)
: end;
- selection.setWithoutValidation(start, endPosition);
- return selection;
+ return SelectionInFlatTree::Builder()
+ .setBaseAndExtent(start, endPosition)
+ .build();
}
const VisiblePositionInFlatTree& visibleStart = createVisiblePosition(
@@ -83,27 +83,27 @@ VisibleSelectionInFlatTree PendingSelection::calcVisibleSelection(
? TextAffinity::Downstream
: affinity);
if (visibleStart.isNull())
- return VisibleSelectionInFlatTree();
+ return SelectionInFlatTree();
if (paintBlockCursor) {
const VisiblePositionInFlatTree visibleExtent = nextPositionOf(
createVisiblePosition(end, affinity), CanSkipOverEditingBoundary);
if (visibleExtent.isNull())
- return VisibleSelectionInFlatTree();
+ return SelectionInFlatTree();
SelectionInFlatTree::Builder builder;
builder.collapse(visibleStart.toPositionWithAffinity());
builder.extend(visibleExtent.deepEquivalent());
- return createVisibleSelection(builder.build());
+ return builder.build();
}
const VisiblePositionInFlatTree visibleEnd =
createVisiblePosition(end, selectionType == SelectionType::RangeSelection
? TextAffinity::Upstream
: affinity);
if (visibleEnd.isNull())
- return VisibleSelectionInFlatTree();
+ return SelectionInFlatTree();
SelectionInFlatTree::Builder builder;
builder.collapse(visibleStart.toPositionWithAffinity());
builder.extend(visibleEnd.deepEquivalent());
- return createVisibleSelection(builder.build());
+ return builder.build();
}
void PendingSelection::commit(LayoutView& layoutView) {
@@ -124,7 +124,7 @@ void PendingSelection::commit(LayoutView& layoutView) {
// <https://bugs.webkit.org/show_bug.cgi?id=69563> and
// <rdar://problem/10232866>.
const VisibleSelectionInFlatTree& selection =
- calcVisibleSelection(originalSelection);
+ createVisibleSelection(calcVisibleSelection(originalSelection));
if (!selection.isRange()) {
layoutView.clearSelection();
« no previous file with comments | « third_party/WebKit/Source/core/editing/PendingSelection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698