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

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

Issue 1958093002: CONTINUED Make FrameSelection to hold non-canonicalized positions Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2017-01-16T20:04:35 Created 3 years, 11 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 418007b62b09be88fcbc18917ced0f6e9f632862..ae98af92313f173d8d45b60796d65a96147a8649 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -185,7 +185,7 @@ bool SelectionController::handleMousePressEventSingleClick(
PositionInFlatTree::firstPositionInOrBeforeNode(innerNode))
: visibleHitPos;
const VisibleSelectionInFlatTree& selection =
- this->selection().visibleSelection<EditingInFlatTreeStrategy>();
+ this->selection().computeVisibleSelectionInFlatTree();
if (extendSelection && !selection.isNone()) {
// Note: "fast/events/shift-click-user-select-none.html" makes
@@ -267,7 +267,7 @@ void SelectionController::updateSelectionForMouseDrag(
// done in handleMousePressEvent, but not if the mouse press was on an
// existing selection.
VisibleSelectionInFlatTree newSelection =
- selection().visibleSelection<EditingInFlatTreeStrategy>();
+ selection().computeVisibleSelectionInFlatTree();
// Special case to limit selection to the containing block for SVG text.
// FIXME: Isn't there a better non-SVG-specific way to do this?
@@ -632,7 +632,7 @@ void SelectionController::setNonDirectionalSelectionIfNeeded(
newSelection.setBase(newBase);
newSelection.setExtent(newExtent);
} else if (originalBase.isNotNull()) {
- if (selection().visibleSelection<EditingInFlatTreeStrategy>().base() ==
+ if (selection().computeVisibleSelectionInFlatTree().base() ==
newSelection.base())
newSelection.setBase(originalBase);
m_originalBaseInFlatTree = VisiblePositionInFlatTree();
@@ -640,7 +640,7 @@ void SelectionController::setNonDirectionalSelectionIfNeeded(
// Adjusting base and extent will make newSelection always directional
newSelection.setIsDirectional(isDirectional);
- if (selection().visibleSelection<EditingInFlatTreeStrategy>() == newSelection)
+ if (selection().computeVisibleSelectionInFlatTree() == newSelection)
return;
const FrameSelection::SetSelectionOptions options =
@@ -821,11 +821,12 @@ bool SelectionController::handleMouseReleaseEvent(
if (node && node->layoutObject() && hasEditableStyle(*node)) {
const VisiblePositionInFlatTree pos =
visiblePositionOfHitTestResult(event.hitTestResult());
- if (pos.isNotNull())
+ if (pos.isNotNull()) {
builder.collapse(pos.toPositionWithAffinity());
+ }
}
- if (selection().visibleSelection<EditingInFlatTreeStrategy>() !=
+ if (selection().computeVisibleSelectionInFlatTree() !=
createVisibleSelection(builder.build())) {
selection().setSelection(builder.build());
}
@@ -980,9 +981,9 @@ void SelectionController::passMousePressEventToSubframe(
selection().setSelection(SelectionInFlatTree());
return;
}
- selection().setSelection(SelectionInFlatTree::Builder()
- .collapse(visiblePos.toPositionWithAffinity())
- .build());
+ SelectionInFlatTree::Builder builder;
+ builder.collapse(visiblePos.toPositionWithAffinity());
+ selection().setSelection(builder.build());
}
void SelectionController::initializeSelectionState() {

Powered by Google App Engine
This is Rietveld 408576698