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

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 12817003: Change getRange to sublist. Make getRange deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated 7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated
8 // functionality. 8 // functionality.
9 class _ChildrenElementList implements List { 9 class _ChildrenElementList implements List {
10 // Raw Element. 10 // Raw Element.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 195
196 void removeRange(int start, int rangeLength) { 196 void removeRange(int start, int rangeLength) {
197 throw new UnimplementedError(); 197 throw new UnimplementedError();
198 } 198 }
199 199
200 void insertRange(int start, int rangeLength, [initialValue = null]) { 200 void insertRange(int start, int rangeLength, [initialValue = null]) {
201 throw new UnimplementedError(); 201 throw new UnimplementedError();
202 } 202 }
203 203
204 List sublist(int start, [int end]) {
205 if (end == null) end = length;
206 return new _FrozenElementList._wrap(Lists.getRange(this, start, end, []));
207 }
208
204 List getRange(int start, int rangeLength) => 209 List getRange(int start, int rangeLength) =>
205 new _FrozenElementList._wrap(Lists.getRange(this, start, rangeLength, 210 sublist(start, start + rangeLength);
206 []));
207 211
208 int indexOf(Element element, [int start = 0]) { 212 int indexOf(Element element, [int start = 0]) {
209 return Lists.indexOf(this, element, start, this.length); 213 return Lists.indexOf(this, element, start, this.length);
210 } 214 }
211 215
212 int lastIndexOf(Element element, [int start = null]) { 216 int lastIndexOf(Element element, [int start = null]) {
213 if (start == null) start = length - 1; 217 if (start == null) start = length - 1;
214 return Lists.lastIndexOf(this, element, start); 218 return Lists.lastIndexOf(this, element, start);
215 } 219 }
216 220
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 419 }
416 420
417 void removeRange(int start, int rangeLength) { 421 void removeRange(int start, int rangeLength) {
418 throw new UnsupportedError(''); 422 throw new UnsupportedError('');
419 } 423 }
420 424
421 void insertRange(int start, int rangeLength, [initialValue = null]) { 425 void insertRange(int start, int rangeLength, [initialValue = null]) {
422 throw new UnsupportedError(''); 426 throw new UnsupportedError('');
423 } 427 }
424 428
429 List<Element> sublist(int start, [int end]) {
430 return new _FrozenElementList._wrap(_nodeList.sublist(start, end));
431 }
432
425 List<Element> getRange(int start, int rangeLength) => 433 List<Element> getRange(int start, int rangeLength) =>
426 new _FrozenElementList._wrap(_nodeList.getRange(start, rangeLength)); 434 sublist(start, start + rangeLength);
427 435
428 int indexOf(Element element, [int start = 0]) => 436 int indexOf(Element element, [int start = 0]) =>
429 _nodeList.indexOf(element, start); 437 _nodeList.indexOf(element, start);
430 438
431 int lastIndexOf(Element element, [int start = null]) => 439 int lastIndexOf(Element element, [int start = null]) =>
432 _nodeList.lastIndexOf(element, start); 440 _nodeList.lastIndexOf(element, start);
433 441
434 void clear() { 442 void clear() {
435 throw new UnsupportedError(''); 443 throw new UnsupportedError('');
436 } 444 }
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 const ScrollAlignment._internal(this._value); 1149 const ScrollAlignment._internal(this._value);
1142 toString() => 'ScrollAlignment.$_value'; 1150 toString() => 'ScrollAlignment.$_value';
1143 1151
1144 /// Attempt to align the element to the top of the scrollable area. 1152 /// Attempt to align the element to the top of the scrollable area.
1145 static const TOP = const ScrollAlignment._internal('TOP'); 1153 static const TOP = const ScrollAlignment._internal('TOP');
1146 /// Attempt to center the element in the scrollable area. 1154 /// Attempt to center the element in the scrollable area.
1147 static const CENTER = const ScrollAlignment._internal('CENTER'); 1155 static const CENTER = const ScrollAlignment._internal('CENTER');
1148 /// Attempt to align the element to the bottom of the scrollable area. 1156 /// Attempt to align the element to the bottom of the scrollable area.
1149 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1157 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1150 } 1158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698