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

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

Issue 9600035: Enable new dart:html wrapperless frog bindings and wrapper dartium bindings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Handle all code review comments Created 8 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 // TODO(jacobr): use _Lists.dart to remove some of the duplicated 5 // TODO(jacobr): use _Lists.dart to remove some of the duplicated
6 // functionality. 6 // functionality.
7 class _ChildrenElementList implements ElementList { 7 class _ChildrenElementList implements ElementList {
8 // Raw Element. 8 // Raw Element.
9 final _ElementImpl _element; 9 final _ElementImpl _element;
10 final _HTMLCollectionImpl _childElements; 10 final _HTMLCollectionImpl _childElements;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 bool some(bool f(Element element)) { 53 bool some(bool f(Element element)) {
54 for(Element element in this) { 54 for(Element element in this) {
55 if (f(element)) { 55 if (f(element)) {
56 return true; 56 return true;
57 } 57 }
58 }; 58 };
59 return false; 59 return false;
60 } 60 }
61 61
62 Collection map(f(Element element)) {
63 final out = [];
64 for (Element el in this) {
65 out.add(f(el));
66 }
67 return out;
68 }
69
62 bool isEmpty() { 70 bool isEmpty() {
63 return _element._firstElementChild == null; 71 return _element._firstElementChild == null;
64 } 72 }
65 73
66 int get length() { 74 int get length() {
67 return _childElements.length; 75 return _childElements.length;
68 } 76 }
69 77
70 _ElementImpl operator [](int index) { 78 _ElementImpl operator [](int index) {
71 return _childElements[index]; 79 return _childElements[index];
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // TODO(jacobr): this is an inefficient implementation but it is hard to see 157 // TODO(jacobr): this is an inefficient implementation but it is hard to see
150 // a better option given that we cannot quite force NodeList to be an 158 // a better option given that we cannot quite force NodeList to be an
151 // ElementList as there are valid cases where a NodeList JavaScript object 159 // ElementList as there are valid cases where a NodeList JavaScript object
152 // contains Node objects that are not Elements. 160 // contains Node objects that are not Elements.
153 class _FrozenElementList implements ElementList { 161 class _FrozenElementList implements ElementList {
154 final List<Node> _nodeList; 162 final List<Node> _nodeList;
155 163
156 _FrozenElementList._wrap(this._nodeList); 164 _FrozenElementList._wrap(this._nodeList);
157 165
158 Element get first() { 166 Element get first() {
159 return _nodeList.first; 167 return _nodeList[0];
160 } 168 }
161 169
162 void forEach(void f(Element element)) { 170 void forEach(void f(Element element)) {
163 for (Element el in this) { 171 for (Element el in this) {
164 f(el); 172 f(el);
165 } 173 }
166 } 174 }
167 175
168 Collection map(f(Element element)) { 176 Collection map(f(Element element)) {
169 final out = []; 177 final out = [];
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 return getComputedStyle(''); 532 return getComputedStyle('');
525 } 533 }
526 534
527 Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) { 535 Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) {
528 return _createMeasurementFuture(() => 536 return _createMeasurementFuture(() =>
529 window._getComputedStyle(this, pseudoElement), 537 window._getComputedStyle(this, pseudoElement),
530 new Completer<CSSStyleDeclaration>()); 538 new Completer<CSSStyleDeclaration>());
531 } 539 }
532 $!MEMBERS 540 $!MEMBERS
533 } 541 }
OLDNEW
« no previous file with comments | « client/dom/templates/html/frog/impl_Document.darttemplate ('k') | client/dom/templates/html/impl/impl_Node.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698