Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(685)

Side by Side Diff: third_party/WebKit/Source/core/editing/EphemeralRange.cpp

Issue 2251703002: Introduce EphemeralRange::nodes() helper to traverse over a range. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 #endif 139 #endif
140 140
141 Range* createRange(const EphemeralRange& range) 141 Range* createRange(const EphemeralRange& range)
142 { 142 {
143 if (range.isNull()) 143 if (range.isNull())
144 return nullptr; 144 return nullptr;
145 return Range::create(range.document(), range.startPosition(), range.endPosit ion()); 145 return Range::create(range.document(), range.startPosition(), range.endPosit ion());
146 } 146 }
147 147
148 internal::RangeTraversal inRange(const Position& start, const Position& end)
149 {
150 return internal::RangeTraversal(start.nodeAsRangeFirstNode(), end.nodeAsRang ePastLastNode());
151 }
152
153 internal::RangeTraversalInFlatTree inRange(const PositionInFlatTree& start, cons t PositionInFlatTree& end)
154 {
155 return internal::RangeTraversalInFlatTree(start.nodeAsRangeFirstNode(), end. nodeAsRangePastLastNode());
156 }
157
158 internal::RangeTraversal inRange(const EphemeralRange& range)
159 {
160 return inRange(range.startPosition(), range.endPosition());
161 }
162
163 internal::RangeTraversalInFlatTree inRange(const EphemeralRangeInFlatTree& range )
164 {
165 return inRange(range.startPosition(), range.endPosition());
166 }
167
148 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingStrategy>; 168 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingStrategy>;
149 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingInFlatTreeStra tegy>; 169 template class CORE_TEMPLATE_EXPORT EphemeralRangeTemplate<EditingInFlatTreeStra tegy>;
150 170
151 } // namespace blink 171 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698