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>; |