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

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

Issue 11779024: Fix FrozenElementListIterator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Run go.sh Created 7 years, 11 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
« no previous file with comments | « sdk/lib/web_audio/dartium/web_audio_dartium.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 html; 5 part of html;
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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 382 }
383 383
384 Element max([int compare(Element a, Element b)]) { 384 Element max([int compare(Element a, Element b)]) {
385 return _Collections.maxInList(this, compare); 385 return _Collections.maxInList(this, compare);
386 } 386 }
387 } 387 }
388 388
389 class _FrozenElementListIterator implements Iterator<Element> { 389 class _FrozenElementListIterator implements Iterator<Element> {
390 final _FrozenElementList _list; 390 final _FrozenElementList _list;
391 int _index = 0; 391 int _index = 0;
392 Element _current;
392 393
393 _FrozenElementListIterator(this._list); 394 _FrozenElementListIterator(this._list);
394 395
395 /** 396 /**
396 * Moves to the next element. Returns true if the iterator is positioned 397 * Moves to the next element. Returns true if the iterator is positioned
397 * at an element. Returns false if it is positioned after the last element. 398 * at an element. Returns false if it is positioned after the last element.
398 */ 399 */
399 bool moveNext() { 400 bool moveNext() {
400 int nextIndex = _index + 1; 401 int nextIndex = _index + 1;
401 if (nextIndex < _list.length) { 402 if (nextIndex < _list.length) {
402 _current = _list[nextIndex]; 403 _current = _list[nextIndex];
403 _index = nextIndex; 404 _index = nextIndex;
404 return true; 405 return true;
405 } 406 }
406 _index = _list.length; 407 _index = _list.length;
407 _current = null; 408 _current = null;
408 return false; 409 return false;
409 } 410 }
410 411
411 /** 412 /**
412 * Returns the element the [Iterator] is positioned at. 413 * Returns the element the [Iterator] is positioned at.
413 * 414 *
414 * Return [:null:] if the iterator is positioned before the first, or 415 * Return [:null:] if the iterator is positioned before the first, or
415 * after the last element. 416 * after the last element.
416 */ 417 */
417 E get current => _current; 418 Element get current => _current;
418 } 419 }
419 420
420 class _ElementCssClassSet extends CssClassSet { 421 class _ElementCssClassSet extends CssClassSet {
421 422
422 final Element _element; 423 final Element _element;
423 424
424 _ElementCssClassSet(this._element); 425 _ElementCssClassSet(this._element);
425 426
426 Set<String> readClasses() { 427 Set<String> readClasses() {
427 var s = new Set<String>(); 428 var s = new Set<String>();
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 $if DART2JS 881 $if DART2JS
881 // Optimization to improve performance until the dart2js compiler inlines this 882 // Optimization to improve performance until the dart2js compiler inlines this
882 // method. 883 // method.
883 static dynamic createElement_tag(String tag) => 884 static dynamic createElement_tag(String tag) =>
884 JS('Element', 'document.createElement(#)', tag); 885 JS('Element', 'document.createElement(#)', tag);
885 $else 886 $else
886 static Element createElement_tag(String tag) => 887 static Element createElement_tag(String tag) =>
887 document.$dom_createElement(tag); 888 document.$dom_createElement(tag);
888 $endif 889 $endif
889 } 890 }
OLDNEW
« no previous file with comments | « sdk/lib/web_audio/dartium/web_audio_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698