OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/SelectionTemplate.h" | 5 #include "core/editing/SelectionTemplate.h" |
6 | 6 |
7 #include "wtf/Assertions.h" | 7 #include "wtf/Assertions.h" |
8 #include <ostream> // NOLINT | 8 #include <ostream> // NOLINT |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 .utf8() | 126 .utf8() |
127 .data() | 127 .data() |
128 << "base: " << m_base.toAnchorTypeAndOffsetString().utf8().data() | 128 << "base: " << m_base.toAnchorTypeAndOffsetString().utf8().data() |
129 << "\n" | 129 << "\n" |
130 << "extent: " | 130 << "extent: " |
131 << m_extent.toAnchorTypeAndOffsetString().utf8().data(); | 131 << m_extent.toAnchorTypeAndOffsetString().utf8().data(); |
132 } | 132 } |
133 #endif | 133 #endif |
134 | 134 |
135 template <typename Strategy> | 135 template <typename Strategy> |
136 const PositionTemplate<Strategy>& | |
137 SelectionTemplate<Strategy>::computeEndPosition() const { | |
yoichio
2017/02/17 02:26:11
Could you rename just endPosition because
this fu
yosin_UTC9
2017/02/17 05:14:49
No, compute{Start,End}Position() compares position
| |
138 if (m_base == m_extent) | |
139 return m_base; | |
140 return m_base < m_extent ? m_extent : m_base; | |
141 } | |
142 | |
143 template <typename Strategy> | |
144 const PositionTemplate<Strategy>& | |
145 SelectionTemplate<Strategy>::computeStartPosition() const { | |
yoichio
2017/02/17 02:26:11
ditto
yosin_UTC9
2017/02/17 05:14:49
computeStartPosition() isn't cheap due by comparin
| |
146 if (m_base == m_extent) | |
147 return m_base; | |
148 return m_base < m_extent ? m_base : m_extent; | |
149 } | |
150 | |
151 template <typename Strategy> | |
136 void SelectionTemplate<Strategy>::printTo(std::ostream* ostream, | 152 void SelectionTemplate<Strategy>::printTo(std::ostream* ostream, |
137 const char* type) const { | 153 const char* type) const { |
138 if (isNone()) { | 154 if (isNone()) { |
139 *ostream << "()"; | 155 *ostream << "()"; |
140 return; | 156 return; |
141 } | 157 } |
142 *ostream << type << '('; | 158 *ostream << type << '('; |
143 #if DCHECK_IS_ON() | 159 #if DCHECK_IS_ON() |
144 if (m_domTreeVersion != m_base.document()->domTreeVersion()) { | 160 if (m_domTreeVersion != m_base.document()->domTreeVersion()) { |
145 *ostream << "Dirty: " << m_domTreeVersion; | 161 *ostream << "Dirty: " << m_domTreeVersion; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 SelectionTemplate<Strategy>::Builder::setIsHandleVisible(bool isHandleVisible) { | 314 SelectionTemplate<Strategy>::Builder::setIsHandleVisible(bool isHandleVisible) { |
299 m_selection.m_isHandleVisible = isHandleVisible; | 315 m_selection.m_isHandleVisible = isHandleVisible; |
300 return *this; | 316 return *this; |
301 } | 317 } |
302 | 318 |
303 template class CORE_TEMPLATE_EXPORT SelectionTemplate<EditingStrategy>; | 319 template class CORE_TEMPLATE_EXPORT SelectionTemplate<EditingStrategy>; |
304 template class CORE_TEMPLATE_EXPORT | 320 template class CORE_TEMPLATE_EXPORT |
305 SelectionTemplate<EditingInFlatTreeStrategy>; | 321 SelectionTemplate<EditingInFlatTreeStrategy>; |
306 | 322 |
307 } // namespace blink | 323 } // namespace blink |
OLD | NEW |