OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/PositionWithAffinity.h" | 5 #include "core/editing/PositionWithAffinity.h" |
6 | 6 |
7 namespace blink { | 7 namespace blink { |
8 | 8 |
9 template <typename Strategy> | 9 template <typename Strategy> |
10 PositionWithAffinityTemplate<Strategy>::PositionWithAffinityTemplate( | 10 PositionWithAffinityTemplate<Strategy>::PositionWithAffinityTemplate( |
11 const PositionTemplate<Strategy>& position, | 11 const PositionTemplate<Strategy>& position, |
12 TextAffinity affinity) | 12 TextAffinity affinity) |
13 : m_position(position), m_affinity(affinity) {} | 13 : m_position(position), m_affinity(affinity) {} |
14 | 14 |
15 template <typename Strategy> | 15 template <typename Strategy> |
16 PositionWithAffinityTemplate<Strategy>::PositionWithAffinityTemplate() | 16 PositionWithAffinityTemplate<Strategy>::PositionWithAffinityTemplate() |
17 : m_affinity(TextAffinity::Downstream) {} | 17 : m_affinity(TextAffinity::Downstream) {} |
18 | 18 |
19 template <typename Strategy> | 19 template <typename Strategy> |
20 PositionWithAffinityTemplate<Strategy>::~PositionWithAffinityTemplate() {} | 20 PositionWithAffinityTemplate<Strategy>::~PositionWithAffinityTemplate() {} |
21 | 21 |
22 template <typename Strategy> | 22 template <typename Strategy> |
| 23 DEFINE_TRACE(PositionWithAffinityTemplate<Strategy>) { |
| 24 visitor->trace(m_position); |
| 25 } |
| 26 |
| 27 template <typename Strategy> |
23 bool PositionWithAffinityTemplate<Strategy>::operator==( | 28 bool PositionWithAffinityTemplate<Strategy>::operator==( |
24 const PositionWithAffinityTemplate& other) const { | 29 const PositionWithAffinityTemplate& other) const { |
25 if (isNull()) | 30 if (isNull()) |
26 return other.isNull(); | 31 return other.isNull(); |
27 return m_affinity == other.m_affinity && m_position == other.m_position; | 32 return m_affinity == other.m_affinity && m_position == other.m_position; |
28 } | 33 } |
29 | 34 |
30 template class CORE_TEMPLATE_EXPORT | 35 template class CORE_TEMPLATE_EXPORT |
31 PositionWithAffinityTemplate<EditingStrategy>; | 36 PositionWithAffinityTemplate<EditingStrategy>; |
32 template class CORE_TEMPLATE_EXPORT | 37 template class CORE_TEMPLATE_EXPORT |
33 PositionWithAffinityTemplate<EditingInFlatTreeStrategy>; | 38 PositionWithAffinityTemplate<EditingInFlatTreeStrategy>; |
34 | 39 |
35 std::ostream& operator<<(std::ostream& ostream, | 40 std::ostream& operator<<(std::ostream& ostream, |
36 const PositionWithAffinity& positionWithAffinity) { | 41 const PositionWithAffinity& positionWithAffinity) { |
37 return ostream << positionWithAffinity.position() << '/' | 42 return ostream << positionWithAffinity.position() << '/' |
38 << positionWithAffinity.affinity(); | 43 << positionWithAffinity.affinity(); |
39 } | 44 } |
40 | 45 |
41 std::ostream& operator<<( | 46 std::ostream& operator<<( |
42 std::ostream& ostream, | 47 std::ostream& ostream, |
43 const PositionInFlatTreeWithAffinity& positionWithAffinity) { | 48 const PositionInFlatTreeWithAffinity& positionWithAffinity) { |
44 return ostream << positionWithAffinity.position() << '/' | 49 return ostream << positionWithAffinity.position() << '/' |
45 << positionWithAffinity.affinity(); | 50 << positionWithAffinity.affinity(); |
46 } | 51 } |
47 | 52 |
48 } // namespace blink | 53 } // namespace blink |
OLD | NEW |