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

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

Issue 2374183004: Make non-null VisibleSelections creatable only by createVisibleSelection[Deprecated] (Closed)
Patch Set: Fix mac compile error Created 4 years, 3 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 7eeea394417a0db25b8da7aae9d5ca7b5a0147a5..efc589afedf9480cd968b3952e2176261f073003 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -151,7 +151,7 @@ bool SelectionController::handleMousePressEventSingleClick(const MouseEventWithH
TextGranularity granularity = CharacterGranularity;
if (extendSelection && !newSelection.isNone()) {
- const VisibleSelectionInFlatTree selectionInUserSelectAll(expandSelectionToRespectUserSelectAll(innerNode, VisibleSelectionInFlatTree(createVisiblePosition(pos))));
+ const VisibleSelectionInFlatTree selectionInUserSelectAll(expandSelectionToRespectUserSelectAll(innerNode, createVisibleSelectionDeprecated(createVisiblePosition(pos))));
if (selectionInUserSelectAll.isRange()) {
if (selectionInUserSelectAll.start().compareTo(newSelection.start()) < 0)
pos = selectionInUserSelectAll.start();
@@ -168,9 +168,9 @@ bool SelectionController::handleMousePressEventSingleClick(const MouseEventWithH
int distanceToStart = textDistance(start, pos);
int distanceToEnd = textDistance(pos, end);
if (distanceToStart <= distanceToEnd)
- newSelection = VisibleSelectionInFlatTree(end, pos);
+ newSelection = createVisibleSelectionDeprecated(end, pos);
else
- newSelection = VisibleSelectionInFlatTree(start, pos);
+ newSelection = createVisibleSelectionDeprecated(start, pos);
}
} else {
newSelection.setExtent(pos);
@@ -181,7 +181,7 @@ bool SelectionController::handleMousePressEventSingleClick(const MouseEventWithH
newSelection.expandUsingGranularity(selection().granularity());
}
} else if (m_selectionState != SelectionState::ExtendedSelection) {
- newSelection = expandSelectionToRespectUserSelectAll(innerNode, VisibleSelectionInFlatTree(visiblePos));
+ newSelection = expandSelectionToRespectUserSelectAll(innerNode, createVisibleSelectionDeprecated(visiblePos));
}
// Updating the selection is considered side-effect of the event and so it doesn't impact the handled state.
@@ -233,7 +233,7 @@ void SelectionController::updateSelectionForMouseDrag(const HitTestResult& hitTe
if (m_selectionState != SelectionState::ExtendedSelection) {
// Always extend selection here because it's caused by a mouse drag
m_selectionState = SelectionState::ExtendedSelection;
- newSelection = VisibleSelectionInFlatTree(targetPosition);
+ newSelection = createVisibleSelectionDeprecated(targetPosition);
}
if (RuntimeEnabledFeatures::userSelectAllEnabled()) {
@@ -315,7 +315,7 @@ void SelectionController::selectClosestWordFromHitTestResult(const HitTestResult
const VisiblePositionInFlatTree& pos = visiblePositionOfHitTestResult(adjustedHitTestResult);
if (pos.isNotNull()) {
- newSelection = VisibleSelectionInFlatTree(pos);
+ newSelection = createVisibleSelectionDeprecated(pos);
newSelection.expandUsingGranularity(WordGranularity);
}
@@ -353,7 +353,7 @@ void SelectionController::selectClosestMisspellingFromHitTestResult(const HitTes
Node* containerNode = markerPosition.computeContainerNode();
const PositionInFlatTree start(containerNode, markers[0]->startOffset());
const PositionInFlatTree end(containerNode, markers[0]->endOffset());
- newSelection = VisibleSelectionInFlatTree(start, end);
+ newSelection = createVisibleSelectionDeprecated(start, end);
}
}
@@ -452,7 +452,7 @@ bool SelectionController::handleMousePressEventTripleClick(const MouseEventWithH
VisibleSelectionInFlatTree newSelection;
const VisiblePositionInFlatTree& pos = visiblePositionOfHitTestResult(event.hitTestResult());
if (pos.isNotNull()) {
- newSelection = VisibleSelectionInFlatTree(pos);
+ newSelection = createVisibleSelectionDeprecated(pos);
newSelection.expandUsingGranularity(ParagraphGranularity);
}
@@ -530,7 +530,7 @@ bool SelectionController::handleMouseReleaseEvent(const MouseEventWithHitTestRes
bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
if (node && node->layoutObject() && (caretBrowsing || hasEditableStyle(*node))) {
const VisiblePositionInFlatTree pos = visiblePositionOfHitTestResult(event.hitTestResult());
- newSelection = VisibleSelectionInFlatTree(pos);
+ newSelection = createVisibleSelectionDeprecated(pos);
}
setSelectionIfNeeded(selection(), newSelection);
@@ -654,7 +654,7 @@ void SelectionController::passMousePressEventToSubframe(const MouseEventWithHitT
m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
const VisiblePositionInFlatTree& visiblePos = visiblePositionOfHitTestResult(mev.hitTestResult());
- VisibleSelectionInFlatTree newSelection(visiblePos);
+ VisibleSelectionInFlatTree newSelection = createVisibleSelectionDeprecated(visiblePos);
selection().setSelection(newSelection);
}

Powered by Google App Engine
This is Rietveld 408576698