| 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/EphemeralRange.h" | 5 #include "core/editing/EphemeralRange.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 9 #include "core/dom/Range.h" | 9 #include "core/dom/Range.h" |
| 10 #include "core/dom/Text.h" | 10 #include "core/dom/Text.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 template <typename Strategy> | 15 template <typename Strategy> |
| 16 Node* CommonAncestorContainerNode(const Node* container_a, | 16 Node* CommonAncestorContainerNode(const Node* container_a, |
| 17 const Node* container_b) { | 17 const Node* container_b) { |
| 18 if (!container_a || !container_b) | 18 if (!container_a || !container_b) |
| 19 return nullptr; | 19 return nullptr; |
| 20 return Strategy::CommonAncestor(*container_a, *container_b); | 20 return Strategy::CommonAncestor(*container_a, *container_b); |
| 21 } | 21 } |
| 22 } | 22 } // namespace |
| 23 | 23 |
| 24 template <typename Strategy> | 24 template <typename Strategy> |
| 25 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate( | 25 EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate( |
| 26 const PositionTemplate<Strategy>& start, | 26 const PositionTemplate<Strategy>& start, |
| 27 const PositionTemplate<Strategy>& end) | 27 const PositionTemplate<Strategy>& end) |
| 28 : start_position_(start), | 28 : start_position_(start), |
| 29 end_position_(end) | 29 end_position_(end) |
| 30 #if DCHECK_IS_ON() | 30 #if DCHECK_IS_ON() |
| 31 , | 31 , |
| 32 dom_tree_version_(start.IsNull() ? 0 | 32 dom_tree_version_(start.IsNull() ? 0 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 return nullptr; | 165 return nullptr; |
| 166 return Range::Create(range.GetDocument(), range.StartPosition(), | 166 return Range::Create(range.GetDocument(), range.StartPosition(), |
| 167 range.EndPosition()); | 167 range.EndPosition()); |
| 168 } | 168 } |
| 169 | 169 |
| 170 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingStrategy>; | 170 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingStrategy>; |
| 171 template class CORE_TEMPLATE_EXPORT | 171 template class CORE_TEMPLATE_EXPORT |
| 172 EphemeralRangeTemplate<EditingInFlatTreeStrategy>; | 172 EphemeralRangeTemplate<EditingInFlatTreeStrategy>; |
| 173 | 173 |
| 174 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |