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

Unified Diff: Source/core/editing/EditingStrategy.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/EditingStrategy.h ('k') | Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/EditingStrategy.cpp
diff --git a/Source/core/editing/EditingStrategy.cpp b/Source/core/editing/EditingStrategy.cpp
index 51b4afcc71e0ba7f5f78e53495b07f491fd7e018..a2398b7f5915fd99c2e5de80326119e9bcd93470 100644
--- a/Source/core/editing/EditingStrategy.cpp
+++ b/Source/core/editing/EditingStrategy.cpp
@@ -67,6 +67,29 @@ int EditingAlgorithm<Traversal>::lastOffsetForEditing(const Node* node)
return 1;
}
+template <typename Strategy>
+Node* EditingAlgorithm<Strategy>::rootUserSelectAllForNode(Node* node)
+{
+ if (!node || !nodeIsUserSelectAll(node))
+ return nullptr;
+ Node* parent = Strategy::parent(*node);
+ if (!parent)
+ return node;
+
+ Node* candidateRoot = node;
+ while (parent) {
+ if (!parent->layoutObject()) {
+ parent = Strategy::parent(*parent);
+ continue;
+ }
+ if (!nodeIsUserSelectAll(parent))
+ break;
+ candidateRoot = parent;
+ parent = Strategy::parent(*candidateRoot);
+ }
+ return candidateRoot;
+}
+
template class CORE_TEMPLATE_EXPORT EditingAlgorithm<NodeTraversal>;
template class CORE_TEMPLATE_EXPORT EditingAlgorithm<ComposedTreeTraversal>;
« no previous file with comments | « Source/core/editing/EditingStrategy.h ('k') | Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698