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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 template <typename Traversal> | 27 template <typename Traversal> |
28 bool EditingAlgorithm<Traversal>::isEmptyNonEditableNodeInEditable(const Node* n
ode) | 28 bool EditingAlgorithm<Traversal>::isEmptyNonEditableNodeInEditable(const Node* n
ode) |
29 { | 29 { |
30 // Editability is defined the DOM tree rather than the flat tree. For exampl
e: | 30 // Editability is defined the DOM tree rather than the flat tree. For exampl
e: |
31 // DOM: | 31 // DOM: |
32 // <host><span>unedittable</span><shadowroot><div ce><content /></div></sh
adowroot></host> | 32 // <host><span>unedittable</span><shadowroot><div ce><content /></div></sh
adowroot></host> |
33 // Flat Tree: | 33 // Flat Tree: |
34 // <host><div ce><span1>unedittable</span></div></host> | 34 // <host><div ce><span1>unedittable</span></div></host> |
35 // e.g. editing/shadow/breaking-editing-boundaries.html | 35 // e.g. editing/shadow/breaking-editing-boundaries.html |
36 return !Traversal::hasChildren(*node) && !node->hasEditableStyle() && node->
parentNode() && node->parentNode()->hasEditableStyle(); | 36 return !Traversal::hasChildren(*node) && !hasEditableStyle(*node) && node->p
arentNode() && hasEditableStyle(*node->parentNode()); |
37 } | 37 } |
38 | 38 |
39 template <typename Traversal> | 39 template <typename Traversal> |
40 bool EditingAlgorithm<Traversal>::editingIgnoresContent(const Node* node) | 40 bool EditingAlgorithm<Traversal>::editingIgnoresContent(const Node* node) |
41 { | 41 { |
42 return !node->canContainRangeEndPoint() || isEmptyNonEditableNodeInEditable(
node); | 42 return !node->canContainRangeEndPoint() || isEmptyNonEditableNodeInEditable(
node); |
43 } | 43 } |
44 | 44 |
45 template <typename Traversal> | 45 template <typename Traversal> |
46 int EditingAlgorithm<Traversal>::lastOffsetForEditing(const Node* node) | 46 int EditingAlgorithm<Traversal>::lastOffsetForEditing(const Node* node) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |