| 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 10 matching lines...) Expand all Loading... |
| 21 // For containers return the number of children. For others do the same as | 21 // For containers return the number of children. For others do the same as |
| 22 // above. | 22 // above. |
| 23 return lastOffsetForEditing(&node); | 23 return lastOffsetForEditing(&node); |
| 24 } | 24 } |
| 25 | 25 |
| 26 template <typename Traversal> | 26 template <typename Traversal> |
| 27 bool EditingAlgorithm<Traversal>::isEmptyNonEditableNodeInEditable( | 27 bool EditingAlgorithm<Traversal>::isEmptyNonEditableNodeInEditable( |
| 28 const Node* node) { | 28 const Node* node) { |
| 29 // Editability is defined the DOM tree rather than the flat tree. For example: | 29 // Editability is defined the DOM tree rather than the flat tree. For example: |
| 30 // DOM: | 30 // DOM: |
| 31 // <host><span>unedittable</span><shadowroot><div ce><content /></div></shad
owroot></host> | 31 // <host> |
| 32 // <span>unedittable</span> |
| 33 // <shadowroot><div ce><content /></div></shadowroot> |
| 34 // </host> |
| 35 // |
| 32 // Flat Tree: | 36 // Flat Tree: |
| 33 // <host><div ce><span1>unedittable</span></div></host> | 37 // <host><div ce><span1>unedittable</span></div></host> |
| 34 // e.g. editing/shadow/breaking-editing-boundaries.html | 38 // e.g. editing/shadow/breaking-editing-boundaries.html |
| 35 return !Traversal::hasChildren(*node) && !hasEditableStyle(*node) && | 39 return !Traversal::hasChildren(*node) && !hasEditableStyle(*node) && |
| 36 node->parentNode() && hasEditableStyle(*node->parentNode()); | 40 node->parentNode() && hasEditableStyle(*node->parentNode()); |
| 37 } | 41 } |
| 38 | 42 |
| 39 template <typename Traversal> | 43 template <typename Traversal> |
| 40 bool EditingAlgorithm<Traversal>::editingIgnoresContent(const Node* node) { | 44 bool EditingAlgorithm<Traversal>::editingIgnoresContent(const Node* node) { |
| 41 return !node->canContainRangeEndPoint() || | 45 return !node->canContainRangeEndPoint() || |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 candidateRoot = parent; | 88 candidateRoot = parent; |
| 85 parent = Strategy::parent(*candidateRoot); | 89 parent = Strategy::parent(*candidateRoot); |
| 86 } | 90 } |
| 87 return candidateRoot; | 91 return candidateRoot; |
| 88 } | 92 } |
| 89 | 93 |
| 90 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<NodeTraversal>; | 94 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<NodeTraversal>; |
| 91 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<FlatTreeTraversal>; | 95 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<FlatTreeTraversal>; |
| 92 | 96 |
| 93 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |