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

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

Side-by-side diff isn't available for this file because of its large size.
Issue 9270054: Make ElementList return ElementLists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « client/html/release/html.dart ('k') | client/html/src/Element.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/html/release/htmlimpl.dart
diff --git a/client/html/release/htmlimpl.dart b/client/html/release/htmlimpl.dart
index e631aec33dc42be33362c861aa088477707c3a88..291cf3dcbf972b95c0067b6b10aaf0d0bdc38d25 100644
--- a/client/html/release/htmlimpl.dart
+++ b/client/html/release/htmlimpl.dart
@@ -22362,7 +22362,8 @@ class _ChildrenElementList implements ElementList {
Collection map(f(Element element)) => _toList().map(f);
- Collection<Element> filter(bool f(Element element)) => _toList().filter(f);
+ ElementList filter(bool f(Element element)) =>
+ new _ElementList(_toList().filter(f));
bool every(bool f(Element element)) {
for(Element element in this) {
@@ -22436,7 +22437,8 @@ class _ChildrenElementList implements ElementList {
throw const NotImplementedException();
}
- List getRange(int start, int length) => Lists.getRange(this, start, length);
+ ElementList getRange(int start, int length) =>
+ new _ElementList(Lists.getRange(this, start, length));
int indexOf(Element element, [int start = 0]) {
return Lists.indexOf(this, element, start, this.length);
@@ -22489,7 +22491,8 @@ class FrozenElementList implements ElementList {
Collection map(f(Element element)) => _toList().map(f);
- Collection<Element> filter(bool f(Element element)) => _toList().filter(f);
+ ElementList filter(bool f(Element element)) =>
+ new _ElementList(_toList().filter(f));
bool every(bool f(Element element)) {
for(Element element in this) {
@@ -22564,7 +22567,8 @@ class FrozenElementList implements ElementList {
throw const UnsupportedOperationException('');
}
- List getRange(int start, int length) => Lists.getRange(this, start, length);
+ ElementList getRange(int start, int length) =>
+ new _ElementList(Lists.getRange(this, start, length));
int indexOf(Element element, [int start = 0]) =>
Lists.indexOf(this, element, start, this.length);
@@ -22611,6 +22615,16 @@ class FrozenElementListIterator implements Iterator<Element> {
bool hasNext() => _index < _list.length;
}
+class _ElementList extends _ListWrapper<Element> implements ElementList {
+ _ElementList(List<Element> list) : super(list);
+
+ ElementList filter(bool f(Element element)) =>
+ new _ElementList(super.filter(f));
+
+ ElementList getRange(int start, int length) =>
+ new _ElementList(super.getRange(start, length));
+}
+
class ElementAttributeMap implements Map<String, String> {
final _element;
@@ -23770,65 +23784,73 @@ class _ChildrenNodeList implements NodeList {
}
// TODO(nweiz): when all implementations we target have the same name for the
-// coreimpl implementation of List<Node>, extend that rather than wrapping.
-class _NodeList implements NodeList {
- List<Node> _list;
+// coreimpl implementation of List<E>, extend that rather than wrapping.
+class _ListWrapper<E> implements List<E> {
+ List<E> _list;
- _NodeList(List<Node> this._list);
+ _ListWrapper(List<E> this._list);
- Iterator<Node> iterator() => _list.iterator();
+ Iterator<E> iterator() => _list.iterator();
- void forEach(void f(Node element)) => _list.forEach(f);
+ void forEach(void f(E element)) => _list.forEach(f);
- Collection map(f(Node element)) => _list.map(f);
+ Collection map(f(E element)) => _list.map(f);
- NodeList filter(bool f(Node element)) => new _NodeList(_list.filter(f));
+ List<E> filter(bool f(E element)) => _list.filter(f);
- bool every(bool f(Node element)) => _list.every(f);
+ bool every(bool f(E element)) => _list.every(f);
- bool some(bool f(Node element)) => _list.some(f);
+ bool some(bool f(E element)) => _list.some(f);
bool isEmpty() => _list.isEmpty();
int get length() => _list.length;
- Node operator [](int index) => _list[index];
+ E operator [](int index) => _list[index];
- void operator []=(int index, Node value) { _list[index] = value; }
+ void operator []=(int index, E value) { _list[index] = value; }
void set length(int newLength) { _list.length = newLength; }
- void add(Node value) => _list.add(value);
+ void add(E value) => _list.add(value);
- void addLast(Node value) => _list.addLast(value);
+ void addLast(E value) => _list.addLast(value);
- void addAll(Collection<Node> collection) => _list.addAll(collection);
+ void addAll(Collection<E> collection) => _list.addAll(collection);
- void sort(int compare(Node a, Node b)) => _list.sort(compare);
+ void sort(int compare(E a, E b)) => _list.sort(compare);
- int indexOf(Node element, [int start = 0]) => _list.indexOf(element, start);
+ int indexOf(E element, [int start = 0]) => _list.indexOf(element, start);
- int lastIndexOf(Node element, [int start = 0]) =>
+ int lastIndexOf(E element, [int start = 0]) =>
_list.lastIndexOf(element, start);
void clear() => _list.clear();
- Node removeLast() => _list.removeLast();
+ E removeLast() => _list.removeLast();
- Node last() => _list.last();
+ E last() => _list.last();
- NodeList getRange(int start, int length) =>
- new _NodeList(_list.getRange(start, length));
+ List<E> getRange(int start, int length) => _list.getRange(start, length);
- void setRange(int start, int length, List<Node> from, [int startFrom = 0]) =>
+ void setRange(int start, int length, List<E> from, [int startFrom = 0]) =>
_list.setRange(start, length, from, startFrom);
void removeRange(int start, int length) => _list.removeRange(start, length);
- void insertRange(int start, int length, [Node initialValue = null]) =>
+ void insertRange(int start, int length, [E initialValue = null]) =>
_list.insertRange(start, length, initialValue);
- Node get first() => _list[0];
+ E get first() => _list[0];
+}
+
+class _NodeList extends _ListWrapper<Node> implements NodeList {
+ _NodeList(List<Node> list) : super(list);
+
+ NodeList filter(bool f(Node element)) => new _NodeList(super.filter(f));
+
+ NodeList getRange(int start, int length) =>
+ new _NodeList(super.getRange(start, length));
}
class NodeWrappingImplementation extends EventTargetWrappingImplementation implements Node {
« no previous file with comments | « client/html/release/html.dart ('k') | client/html/src/Element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698