Chromium Code Reviews| 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/dom/shadow/ElementShadow.h" | |
| 8 #include "core/editing/htmlediting.h" | 9 #include "core/editing/htmlediting.h" |
| 9 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| 11 | 12 |
| 12 template <typename Traversal> | 13 template <typename Traversal> |
| 13 bool EditingAlgorithm<Traversal>::isEmptyNonEditableNodeInEditable(const Node* n ode) | 14 bool EditingAlgorithm<Traversal>::isEmptyNonEditableNodeInEditable(const Node* n ode) |
| 14 { | 15 { |
| 15 // Editability is defined the DOM tree rather than the composed tree. For ex ample: | 16 // Editability is defined the DOM tree rather than the composed tree. For ex ample: |
| 16 // DOM: | 17 // DOM: |
| 17 // <host><span>unedittable</span><shadowroot><div ce><content /></div></sh adowroot></host> | 18 // <host><span>unedittable</span><shadowroot><div ce><content /></div></sh adowroot></host> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 if (n == childB) | 139 if (n == childB) |
| 139 return 1; // A is after B | 140 return 1; // A is after B |
| 140 n = Traversal::nextSibling(*n); | 141 n = Traversal::nextSibling(*n); |
| 141 } | 142 } |
| 142 | 143 |
| 143 // Should never reach this point. | 144 // Should never reach this point. |
| 144 ASSERT_NOT_REACHED(); | 145 ASSERT_NOT_REACHED(); |
| 145 return 0; | 146 return 0; |
| 146 } | 147 } |
| 147 | 148 |
| 149 bool EditingInComposedTreeStrategy::isSelectionBoundaryShadowHost(const Node* no de) | |
| 150 { | |
| 151 if (!node->isElementNode()) | |
|
tkent
2015/06/19 06:07:49
You assume |node| is non-null. So, the argument t
hajimehoshi
2015/06/19 06:26:51
Done.
| |
| 152 return false; | |
| 153 ElementShadow* shadow = toElement(node)->shadow(); | |
| 154 if (!shadow) | |
| 155 return false; | |
| 156 return shadow->youngestShadowRoot()->type() == ShadowRoot::UserAgentShadowRo ot; | |
| 157 } | |
| 158 | |
| 148 ContainerNode* EditingInComposedTreeStrategy::parentOrShadowHostNode(const Node& node) | 159 ContainerNode* EditingInComposedTreeStrategy::parentOrShadowHostNode(const Node& node) |
| 149 { | 160 { |
| 150 return parent(node); | 161 return parent(node); |
| 151 } | 162 } |
| 152 | 163 |
| 153 template class EditingAlgorithm<NodeTraversal>; | 164 template class EditingAlgorithm<NodeTraversal>; |
| 154 template class EditingAlgorithm<ComposedTreeTraversal>; | 165 template class EditingAlgorithm<ComposedTreeTraversal>; |
| 155 | 166 |
| 156 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |