| 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/EphemeralRange.h" | 6 #include "core/editing/EphemeralRange.h" |
| 7 | 7 |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/Range.h" | 10 #include "core/dom/Range.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 template <typename Strategy> | 113 template <typename Strategy> |
| 114 bool EphemeralRangeTemplate<Strategy>::isCollapsed() const | 114 bool EphemeralRangeTemplate<Strategy>::isCollapsed() const |
| 115 { | 115 { |
| 116 ASSERT(isValid()); | 116 ASSERT(isValid()); |
| 117 return m_startPosition == m_endPosition; | 117 return m_startPosition == m_endPosition; |
| 118 } | 118 } |
| 119 | 119 |
| 120 template <typename Strategy> | 120 template <typename Strategy> |
| 121 bool EphemeralRangeTemplate<Strategy>::isNotNull() const | |
| 122 { | |
| 123 ASSERT(isValid()); | |
| 124 return m_startPosition.isNotNull(); | |
| 125 } | |
| 126 | |
| 127 template <typename Strategy> | |
| 128 EphemeralRangeTemplate<Strategy> EphemeralRangeTemplate<Strategy>::rangeOfConten
ts(const Node& node) | 121 EphemeralRangeTemplate<Strategy> EphemeralRangeTemplate<Strategy>::rangeOfConten
ts(const Node& node) |
| 129 { | 122 { |
| 130 return EphemeralRangeTemplate<Strategy>(PositionAlgorithm<Strategy>::firstPo
sitionInNode(&const_cast<Node&>(node)), PositionAlgorithm<Strategy>::lastPositio
nInNode(&const_cast<Node&>(node))); | 123 return EphemeralRangeTemplate<Strategy>(PositionAlgorithm<Strategy>::firstPo
sitionInNode(&const_cast<Node&>(node)), PositionAlgorithm<Strategy>::lastPositio
nInNode(&const_cast<Node&>(node))); |
| 131 } | 124 } |
| 132 | 125 |
| 133 #if ENABLE(ASSERT) | 126 #if ENABLE(ASSERT) |
| 134 template <typename Strategy> | 127 template <typename Strategy> |
| 135 bool EphemeralRangeTemplate<Strategy>::isValid() const | 128 bool EphemeralRangeTemplate<Strategy>::isValid() const |
| 136 { | 129 { |
| 137 return m_startPosition.isNull() || m_domTreeVersion == m_startPosition.docum
ent()->domTreeVersion(); | 130 return m_startPosition.isNull() || m_domTreeVersion == m_startPosition.docum
ent()->domTreeVersion(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 148 { | 141 { |
| 149 if (range.isNull()) | 142 if (range.isNull()) |
| 150 return nullptr; | 143 return nullptr; |
| 151 return Range::create(range.document(), range.startPosition(), range.endPosit
ion()); | 144 return Range::create(range.document(), range.startPosition(), range.endPosit
ion()); |
| 152 } | 145 } |
| 153 | 146 |
| 154 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingStrategy>; | 147 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingStrategy>; |
| 155 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingInComposedTree
Strategy>; | 148 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingInComposedTree
Strategy>; |
| 156 | 149 |
| 157 } // namespace blink | 150 } // namespace blink |
| OLD | NEW |