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

Unified Diff: client/html/release/htmlimpl.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 9199002: Support various range methods on NodeList. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge with HEAD Created 8 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:
Download patch
Index: client/html/release/htmlimpl.dart
diff --git a/client/html/release/htmlimpl.dart b/client/html/release/htmlimpl.dart
index ee016ffbdbff8d6bbef8c9b6b4d1116b7ab3f1b7..512a5de4d982ebf9559c0176a88e807a791fcc7c 100644
--- a/client/html/release/htmlimpl.dart
+++ b/client/html/release/htmlimpl.dart
@@ -23667,7 +23667,7 @@ class _ChildrenNodeList implements NodeList {
}
void operator []=(int index, Node value) {
- _childNodes[index] = LevelDom.unwrap(value);
+ _node.replaceChild(LevelDom.unwrap(value), _childNodes[index]);
}
void set length(int newLength) {
@@ -23704,11 +23704,39 @@ class _ChildrenNodeList implements NodeList {
}
void setRange(int start, int length, List from, [int startFrom = 0]) {
- throw const NotImplementedException();
+ // TODO(nweiz): remove these IndexOutOfRange checks once Frog has bounds
+ // checking for List indexing
+ if (start < 0) {
+ throw new IndexOutOfRangeException(start);
+ } else if (startFrom < 0) {
+ throw new IndexOutOfRangeException(startFrom);
+ } else if (length < 0) {
+ throw new IllegalArgumentException("negative length $length");
+ } else if (start + length > this.length) {
+ throw new IndexOutOfRangeException(Math.min(this.length, start));
+ } else if (startFrom + length > from.length) {
+ throw new IndexOutOfRangeException(Math.min(from.length, startFrom));
+ }
+
+ for (var i = 0; i < length; i++) {
+ this[start + i] = from[startFrom + i];
+ }
}
void removeRange(int start, int length) {
- throw const NotImplementedException();
+ // TODO(nweiz): remove these IndexOutOfRange checks once Frog has bounds
+ // checking for List indexing
+ if (start < 0) {
+ throw new IndexOutOfRangeException(start);
+ } else if (length < 0) {
+ throw new IllegalArgumentException("negative length $length");
+ } else if (start + length > this.length) {
+ throw new IndexOutOfRangeException(Math.min(this.length, start));
+ }
+
+ for (var i = 0; i < length; i++) {
+ this[start].remove();
+ }
}
void insertRange(int start, int length, [initialValue = null]) {
@@ -23716,7 +23744,21 @@ class _ChildrenNodeList implements NodeList {
}
List getRange(int start, int length) {
- throw const NotImplementedException();
+ // TODO(nweiz): remove these IndexOutOfRange checks once Frog has bounds
+ // checking for List indexing
+ if (start < 0) {
+ throw new IndexOutOfRangeException(start);
+ } else if (length < 0) {
+ throw new IllegalArgumentException("negative length $length");
+ } else if (start + length > this.length) {
+ throw new IndexOutOfRangeException(Math.min(this.length, start));
+ }
+
+ var nodes = <Node>[];
+ for (var i = 0; i < length; i++) {
+ nodes.add(this[start + i]);
+ }
+ return nodes;
}
int indexOf(Node element, [int start = 0]) {
« no previous file with comments | « no previous file | client/html/src/NodeWrappingImplementation.dart » ('j') | client/html/src/NodeWrappingImplementation.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698