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

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

Issue 1287053007: Move rootUserSelectAllForNode() to EditingStrategy template class from PositionAlgorithm template cl (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-20T17:38:38 Created 5 years, 4 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 | « Source/core/editing/Position.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/SelectionController.cpp
diff --git a/Source/core/editing/SelectionController.cpp b/Source/core/editing/SelectionController.cpp
index 16ce94bb85d83f7a59232ead3d7fe2856ef1d614..e23b7b4f956b0753d233f271c9fc05a715ab78e7 100644
--- a/Source/core/editing/SelectionController.cpp
+++ b/Source/core/editing/SelectionController.cpp
@@ -81,12 +81,12 @@ bool dispatchSelectStart(Node* node)
return node->dispatchEvent(Event::createCancelableBubble(EventTypeNames::selectstart));
}
-template <typename Strategy>
+template <typename SelectionType>
VisibleSelection expandSelectionToRespectUserSelectAllAlgorithm(Node* targetNode, const VisibleSelection& selection)
{
- using PositionType = typename Strategy::PositionType;
+ using PositionType = typename SelectionType::PositionType;
- Node* rootUserSelectAll = PositionType::rootUserSelectAllForNode(targetNode);
+ Node* rootUserSelectAll = SelectionType::Strategy::rootUserSelectAllForNode(targetNode);
if (!rootUserSelectAll)
return selection;
@@ -249,8 +249,9 @@ void SelectionController::updateSelectionForMouseDragAlgorithm(const HitTestResu
}
if (RuntimeEnabledFeatures::userSelectAllEnabled()) {
- Node* rootUserSelectAllForMousePressNode = Position::rootUserSelectAllForNode(mousePressNode);
- if (rootUserSelectAllForMousePressNode && rootUserSelectAllForMousePressNode == Position::rootUserSelectAllForNode(target)) {
+ // TODO(yosin) Should we use |Strategy::rootUserSelectAllForNode()|?
+ Node* rootUserSelectAllForMousePressNode = EditingStrategy::rootUserSelectAllForNode(mousePressNode);
+ if (rootUserSelectAllForMousePressNode && rootUserSelectAllForMousePressNode == EditingStrategy::rootUserSelectAllForNode(target)) {
newSelection.setBase(PositionType::beforeNode(rootUserSelectAllForMousePressNode).upstream(CanCrossEditingBoundary));
newSelection.setExtent(PositionType::afterNode(rootUserSelectAllForMousePressNode).downstream(CanCrossEditingBoundary));
} else {
@@ -262,7 +263,7 @@ void SelectionController::updateSelectionForMouseDragAlgorithm(const HitTestResu
newSelection.setBase(PositionType::afterNode(rootUserSelectAllForMousePressNode).downstream(CanCrossEditingBoundary));
}
- Node* rootUserSelectAllForTarget = Position::rootUserSelectAllForNode(target);
+ Node* rootUserSelectAllForTarget = EditingStrategy::rootUserSelectAllForNode(target);
if (rootUserSelectAllForTarget && mousePressNode->layoutObject() && Strategy::toPositionType(target->layoutObject()->positionForPoint(hitTestResult.localPoint()).position()).compareTo(Strategy::toPositionType(mousePressNode->layoutObject()->positionForPoint(dragStartPos).position())) < 0)
newSelection.setExtent(PositionType::beforeNode(rootUserSelectAllForTarget).upstream(CanCrossEditingBoundary));
else if (rootUserSelectAllForTarget && mousePressNode->layoutObject())
« no previous file with comments | « Source/core/editing/Position.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698