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

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

Issue 1304353003: Use EditingStrategy as template parameter to lastEditablePositionBeforePositionInRootAlgorithm templ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-26T16:07:59 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/EditingUtilities.cpp
diff --git a/Source/core/editing/EditingUtilities.cpp b/Source/core/editing/EditingUtilities.cpp
index bd66ce3e735e63ea449b5cd882471fcbd91410e0..3c952651112ce32bce24c6f01e586fccf6bf0cd5 100644
--- a/Source/core/editing/EditingUtilities.cpp
+++ b/Source/core/editing/EditingUtilities.cpp
@@ -482,39 +482,39 @@ VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position&
return VisiblePosition(lastEditablePositionBeforePositionInRoot(position, highestRoot));
}
-template <typename PositionType>
-PositionType lastEditablePositionBeforePositionInRootAlgorithm(const PositionType& position, Node* highestRoot)
+template <typename Strategy>
+PositionAlgorithm<Strategy> lastEditablePositionBeforePositionInRootAlgorithm(const PositionAlgorithm<Strategy>& position, Node* highestRoot)
{
// When position falls after highestRoot, the result is easy to compute.
- if (position.compareTo(PositionType::lastPositionInNode(highestRoot)) == 1)
- return PositionType::lastPositionInNode(highestRoot);
+ if (position.compareTo(PositionAlgorithm<Strategy>::lastPositionInNode(highestRoot)) == 1)
+ return PositionAlgorithm<Strategy>::lastPositionInNode(highestRoot);
- PositionType editablePosition = position;
+ PositionAlgorithm<Strategy> editablePosition = position;
if (position.anchorNode()->treeScope() != highestRoot->treeScope()) {
Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(editablePosition.anchorNode());
if (!shadowAncestor)
- return PositionType();
+ return PositionAlgorithm<Strategy>();
- editablePosition = PositionType::firstPositionInOrBeforeNode(shadowAncestor);
+ editablePosition = PositionAlgorithm<Strategy>::firstPositionInOrBeforeNode(shadowAncestor);
}
while (editablePosition.anchorNode() && !isEditablePosition(editablePosition) && editablePosition.anchorNode()->isDescendantOf(highestRoot))
- editablePosition = isAtomicNode(editablePosition.anchorNode()) ? PositionType::inParentBeforeNode(*editablePosition.anchorNode()) : previousVisuallyDistinctCandidate(editablePosition);
+ editablePosition = isAtomicNode(editablePosition.anchorNode()) ? PositionAlgorithm<Strategy>::inParentBeforeNode(*editablePosition.anchorNode()) : previousVisuallyDistinctCandidate(editablePosition);
if (editablePosition.anchorNode() && editablePosition.anchorNode() != highestRoot && !editablePosition.anchorNode()->isDescendantOf(highestRoot))
- return PositionType();
+ return PositionAlgorithm<Strategy>();
return editablePosition;
}
Position lastEditablePositionBeforePositionInRoot(const Position& position, Node* highestRoot)
{
- return lastEditablePositionBeforePositionInRootAlgorithm<Position>(position, highestRoot);
+ return lastEditablePositionBeforePositionInRootAlgorithm<EditingStrategy>(position, highestRoot);
}
PositionInComposedTree lastEditablePositionBeforePositionInRoot(const PositionInComposedTree& position, Node* highestRoot)
{
- return lastEditablePositionBeforePositionInRootAlgorithm<PositionInComposedTree>(position, highestRoot);
+ return lastEditablePositionBeforePositionInRootAlgorithm<EditingInComposedTreeStrategy>(position, highestRoot);
}
int uncheckedPreviousOffset(const Node* n, int current)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698