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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 DCHECK(position.isConnected()) << position; | 178 DCHECK(position.isConnected()) << position; |
179 DCHECK_EQ(m_selection.document(), position.document()); | 179 DCHECK_EQ(m_selection.document(), position.document()); |
180 DCHECK(m_selection.base().isConnected()) << m_selection.base(); | 180 DCHECK(m_selection.base().isConnected()) << m_selection.base(); |
181 DCHECK(m_selection.assertValid()); | 181 DCHECK(m_selection.assertValid()); |
182 m_selection.m_extent = position; | 182 m_selection.m_extent = position; |
183 return *this; | 183 return *this; |
184 } | 184 } |
185 | 185 |
186 template <typename Strategy> | 186 template <typename Strategy> |
187 typename SelectionTemplate<Strategy>::Builder& | 187 typename SelectionTemplate<Strategy>::Builder& |
| 188 SelectionTemplate<Strategy>::Builder::selectAllChildren(const Node& node) { |
| 189 DCHECK(node.canContainRangeEndPoint()) << node; |
| 190 return setBaseAndExtent( |
| 191 EphemeralRangeTemplate<Strategy>::rangeOfContents(node)); |
| 192 } |
| 193 |
| 194 template <typename Strategy> |
| 195 typename SelectionTemplate<Strategy>::Builder& |
188 SelectionTemplate<Strategy>::Builder::setAffinity(TextAffinity affinity) { | 196 SelectionTemplate<Strategy>::Builder::setAffinity(TextAffinity affinity) { |
189 m_selection.m_affinity = affinity; | 197 m_selection.m_affinity = affinity; |
190 return *this; | 198 return *this; |
191 } | 199 } |
192 | 200 |
193 template <typename Strategy> | 201 template <typename Strategy> |
194 typename SelectionTemplate<Strategy>::Builder& | 202 typename SelectionTemplate<Strategy>::Builder& |
195 SelectionTemplate<Strategy>::Builder::setBaseAndExtent( | 203 SelectionTemplate<Strategy>::Builder::setBaseAndExtent( |
196 const EphemeralRangeTemplate<Strategy>& range) { | 204 const EphemeralRangeTemplate<Strategy>& range) { |
197 if (range.isNull()) { | 205 if (range.isNull()) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 SelectionTemplate<Strategy>::Builder::setIsDirectional(bool isDirectional) { | 262 SelectionTemplate<Strategy>::Builder::setIsDirectional(bool isDirectional) { |
255 m_selection.m_isDirectional = isDirectional; | 263 m_selection.m_isDirectional = isDirectional; |
256 return *this; | 264 return *this; |
257 } | 265 } |
258 | 266 |
259 template class CORE_TEMPLATE_EXPORT SelectionTemplate<EditingStrategy>; | 267 template class CORE_TEMPLATE_EXPORT SelectionTemplate<EditingStrategy>; |
260 template class CORE_TEMPLATE_EXPORT | 268 template class CORE_TEMPLATE_EXPORT |
261 SelectionTemplate<EditingInFlatTreeStrategy>; | 269 SelectionTemplate<EditingInFlatTreeStrategy>; |
262 | 270 |
263 } // namespace blink | 271 } // namespace blink |
OLD | NEW |