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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Issue 802603002: Simplify _FrozenElementList (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 601400bee07e91a822e47db397c928087399ee01..173e527236904996c2cbb082a0a9cc3e15cb0ed2 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -11089,19 +11089,12 @@ abstract class ElementList<T extends Element> extends ListBase<T> {
}
-// TODO(jacobr): this is an inefficient implementation but it is hard to see
-// a better option given that we cannot quite force NodeList to be an
-// ElementList as there are valid cases where a NodeList JavaScript object
-// contains Node objects that are not Elements.
-class _FrozenElementList<T extends Element> extends ListBase<T>
- implements ElementList<T>, NodeListWrapper {
+// Wrapper over an immutable NodeList to make it implement ElementList<Element>.
+class _FrozenElementList extends ListBase
+ implements ElementList, NodeListWrapper {
final List<Node> _nodeList;
- // The subset of _nodeList that are Elements.
- List<Element> _elementList;
- _FrozenElementList._wrap(this._nodeList) {
- _elementList = _nodeList.where((e) => e is Element).toList();
- }
+ _FrozenElementList._wrap(this._nodeList);
int get length => _nodeList.length;
@@ -11129,22 +11122,22 @@ class _FrozenElementList<T extends Element> extends ListBase<T>
Element get single => _nodeList.single;
- CssClassSet get classes => new _MultiElementCssClassSet(_elementList);
+ CssClassSet get classes => new _MultiElementCssClassSet(this);
CssStyleDeclarationBase get style =>
- new _CssStyleDeclarationSet(_elementList);
+ new _CssStyleDeclarationSet(this);
void set classes(Iterable<String> value) {
- _elementList.forEach((e) => e.classes = value);
+ _nodeList.forEach((e) => e.classes = value);
}
- CssRect get contentEdge => new _ContentCssListRect(_elementList);
+ CssRect get contentEdge => new _ContentCssListRect(this);
- CssRect get paddingEdge => _elementList.first.paddingEdge;
+ CssRect get paddingEdge => this.first.paddingEdge;
- CssRect get borderEdge => _elementList.first.borderEdge;
+ CssRect get borderEdge => this.first.borderEdge;
- CssRect get marginEdge => _elementList.first.marginEdge;
+ CssRect get marginEdge => this.first.marginEdge;
List<Node> get rawList => _nodeList;
@@ -31426,10 +31419,10 @@ class Url extends NativeFieldWrapperClass2 implements UrlUtils {
if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is MediaStream)) {
+ if ((blob_OR_source_OR_stream is MediaSource)) {
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is MediaSource)) {
+ if ((blob_OR_source_OR_stream is MediaStream)) {
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
}
throw new ArgumentError("Incorrect number or type of arguments");
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698