| 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 "core/editing/EditingStrategy.h" | 5 #include "core/editing/EditingStrategy.h" |
| 6 | 6 |
| 7 #include "core/editing/EditingUtilities.h" | 7 #include "core/editing/EditingUtilities.h" |
| 8 #include "core/layout/LayoutObject.h" | 8 #include "core/layout/LayoutObject.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // editingIgnoresContent uses the same logic in | 62 // editingIgnoresContent uses the same logic in |
| 63 // isEmptyNonEditableNodeInEditable (EditingUtilities.cpp). We don't | 63 // isEmptyNonEditableNodeInEditable (EditingUtilities.cpp). We don't |
| 64 // understand why this function returns 1 even when the node doesn't have | 64 // understand why this function returns 1 even when the node doesn't have |
| 65 // children. | 65 // children. |
| 66 return 1; | 66 return 1; |
| 67 } | 67 } |
| 68 | 68 |
| 69 template <typename Strategy> | 69 template <typename Strategy> |
| 70 Node* EditingAlgorithm<Strategy>::rootUserSelectAllForNode(Node* node) | 70 Node* EditingAlgorithm<Strategy>::rootUserSelectAllForNode(Node* node) |
| 71 { | 71 { |
| 72 if (!node || !nodeIsUserSelectAll(node)) | 72 if (!node || usedValueOfUserSelect(*node) != SELECT_ALL) |
| 73 return nullptr; | 73 return nullptr; |
| 74 Node* parent = Strategy::parent(*node); | 74 Node* parent = Strategy::parent(*node); |
| 75 if (!parent) | 75 if (!parent) |
| 76 return node; | 76 return node; |
| 77 | 77 |
| 78 Node* candidateRoot = node; | 78 Node* candidateRoot = node; |
| 79 while (parent) { | 79 while (parent) { |
| 80 if (!parent->layoutObject()) { | 80 if (!parent->layoutObject()) { |
| 81 parent = Strategy::parent(*parent); | 81 parent = Strategy::parent(*parent); |
| 82 continue; | 82 continue; |
| 83 } | 83 } |
| 84 if (!nodeIsUserSelectAll(parent)) | 84 if (usedValueOfUserSelect(*parent) != SELECT_ALL) |
| 85 break; | 85 break; |
| 86 candidateRoot = parent; | 86 candidateRoot = parent; |
| 87 parent = Strategy::parent(*candidateRoot); | 87 parent = Strategy::parent(*candidateRoot); |
| 88 } | 88 } |
| 89 return candidateRoot; | 89 return candidateRoot; |
| 90 } | 90 } |
| 91 | 91 |
| 92 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<NodeTraversal>; | 92 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<NodeTraversal>; |
| 93 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<FlatTreeTraversal>; | 93 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<FlatTreeTraversal>; |
| 94 | 94 |
| 95 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |