OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/editing/EditingStrategy.h" | 6 #include "core/editing/EditingStrategy.h" |
7 | 7 |
8 #include "core/editing/EditingUtilities.h" | 8 #include "core/editing/EditingUtilities.h" |
9 #include "core/layout/LayoutObject.h" | 9 #include "core/layout/LayoutObject.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 if (!editingIgnoresContent(node)) | 60 if (!editingIgnoresContent(node)) |
61 return 0; | 61 return 0; |
62 | 62 |
63 // editingIgnoresContent uses the same logic in | 63 // editingIgnoresContent uses the same logic in |
64 // isEmptyNonEditableNodeInEditable (EditingUtilities.cpp). We don't | 64 // isEmptyNonEditableNodeInEditable (EditingUtilities.cpp). We don't |
65 // understand why this function returns 1 even when the node doesn't have | 65 // understand why this function returns 1 even when the node doesn't have |
66 // children. | 66 // children. |
67 return 1; | 67 return 1; |
68 } | 68 } |
69 | 69 |
| 70 template <typename Strategy> |
| 71 Node* EditingAlgorithm<Strategy>::rootUserSelectAllForNode(Node* node) |
| 72 { |
| 73 if (!node || !nodeIsUserSelectAll(node)) |
| 74 return nullptr; |
| 75 Node* parent = Strategy::parent(*node); |
| 76 if (!parent) |
| 77 return node; |
| 78 |
| 79 Node* candidateRoot = node; |
| 80 while (parent) { |
| 81 if (!parent->layoutObject()) { |
| 82 parent = Strategy::parent(*parent); |
| 83 continue; |
| 84 } |
| 85 if (!nodeIsUserSelectAll(parent)) |
| 86 break; |
| 87 candidateRoot = parent; |
| 88 parent = Strategy::parent(*candidateRoot); |
| 89 } |
| 90 return candidateRoot; |
| 91 } |
| 92 |
70 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<NodeTraversal>; | 93 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<NodeTraversal>; |
71 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<ComposedTreeTraversal>; | 94 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<ComposedTreeTraversal>; |
72 | 95 |
73 } // namespace blink | 96 } // namespace blink |
OLD | NEW |