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

Side by Side Diff: client/dom/frog/frog_dom.dart

Issue 8885004: Revert "Implement typed array constructors." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 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:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | client/dom/frog_dom.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #library('dom'); 1 #library('dom');
2 2
3 #native('frog_dom.js'); 3 #native('frog_dom.js');
4 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 4 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
5 // for details. All rights reserved. Use of this source code is governed by a 5 // for details. All rights reserved. Use of this source code is governed by a
6 // BSD-style license that can be found in the LICENSE file. 6 // BSD-style license that can be found in the LICENSE file.
7 7
8 // DO NOT EDIT 8 // DO NOT EDIT
9 // Auto-generated Dart DOM library. 9 // Auto-generated Dart DOM library.
10 10
11 11
12 12
13 // #source('src/_FactoryProviders.dart');
14 13
15 class Window extends DOMWindow {} 14 class Window extends DOMWindow {}
16 DOMWindow get window() native "return window;"; 15 DOMWindow get window() native "return window;";
17 // TODO(vsm): Revert to Dart method when 508 is fixed. 16 // TODO(vsm): Revert to Dart method when 508 is fixed.
18 HTMLDocument get document() native "return window.document;"; 17 HTMLDocument get document() native "return window.document;";
19 18
20 class AbstractWorker native "*AbstractWorker" { 19 class AbstractWorker native "*AbstractWorker" {
21 20
22 void addEventListener(String type, EventListener listener, [bool useCapture = null]) native; 21 void addEventListener(String type, EventListener listener, [bool useCapture = null]) native;
23 22
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 590
592 String get typeName() native; 591 String get typeName() native;
593 } 592 }
594 593
595 class CanvasPixelArray native "*CanvasPixelArray" { 594 class CanvasPixelArray native "*CanvasPixelArray" {
596 595
597 int length; 596 int length;
598 597
599 int operator[](int index) native; 598 int operator[](int index) native;
600 599
601 void operator[]=(int index, int value) native;
602
603 var dartObjectLocalStorage; 600 var dartObjectLocalStorage;
604 601
605 String get typeName() native; 602 String get typeName() native;
606 } 603 }
607 604
608 class CanvasRenderingContext native "*CanvasRenderingContext" { 605 class CanvasRenderingContext native "*CanvasRenderingContext" {
609 606
610 HTMLCanvasElement canvas; 607 HTMLCanvasElement canvas;
611 608
612 var dartObjectLocalStorage; 609 var dartObjectLocalStorage;
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 2311
2315 void truncate(int size) native; 2312 void truncate(int size) native;
2316 2313
2317 void write(Blob data) native; 2314 void write(Blob data) native;
2318 2315
2319 var dartObjectLocalStorage; 2316 var dartObjectLocalStorage;
2320 2317
2321 String get typeName() native; 2318 String get typeName() native;
2322 } 2319 }
2323 2320
2324 class Float32Array extends ArrayBufferView implements List<num> native "Float32A rray" { 2321 class Float32Array extends ArrayBufferView native "*Float32Array" {
2325
2326 factory Float32Array(int length) => _construct(length);
2327
2328 factory Float32Array.fromList(List<num> list) => _construct(list);
2329
2330 factory Float32Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
2331
2332 static _construct(arg) native 'return new Float32Array(arg);';
2333 2322
2334 static final int BYTES_PER_ELEMENT = 4; 2323 static final int BYTES_PER_ELEMENT = 4;
2335 2324
2336 int length; 2325 int length;
2337 2326
2338 num operator[](int index) native;
2339
2340 void operator[]=(int index, num value) native;
2341
2342 Float32Array subarray(int start, [int end = null]) native; 2327 Float32Array subarray(int start, [int end = null]) native;
2343 } 2328 }
2344 2329
2345 class Float64Array extends ArrayBufferView implements List<num> native "Float64A rray" { 2330 class Float64Array extends ArrayBufferView native "*Float64Array" {
2346
2347 factory Float64Array(int length) => _construct(length);
2348
2349 factory Float64Array.fromList(List<num> list) => _construct(list);
2350
2351 factory Float64Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
2352
2353 static _construct(arg) native 'return new Float64Array(arg);';
2354 2331
2355 static final int BYTES_PER_ELEMENT = 8; 2332 static final int BYTES_PER_ELEMENT = 8;
2356 2333
2357 int length; 2334 int length;
2358 2335
2359 num operator[](int index) native;
2360
2361 void operator[]=(int index, num value) native;
2362
2363 Float64Array subarray(int start, [int end = null]) native; 2336 Float64Array subarray(int start, [int end = null]) native;
2364 } 2337 }
2365 2338
2366 class Geolocation native "*Geolocation" { 2339 class Geolocation native "*Geolocation" {
2367 2340
2368 void clearWatch(int watchId) native; 2341 void clearWatch(int watchId) native;
2369 2342
2370 void getCurrentPosition(PositionCallback successCallback, [PositionErrorCallba ck errorCallback = null]) native; 2343 void getCurrentPosition(PositionCallback successCallback, [PositionErrorCallba ck errorCallback = null]) native;
2371 2344
2372 int watchPosition(PositionCallback successCallback, [PositionErrorCallback err orCallback = null]) native; 2345 int watchPosition(PositionCallback successCallback, [PositionErrorCallback err orCallback = null]) native;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 2574
2602 String toDataURL(String type) native; 2575 String toDataURL(String type) native;
2603 } 2576 }
2604 2577
2605 class HTMLCollection native "HTMLCollection" { 2578 class HTMLCollection native "HTMLCollection" {
2606 2579
2607 int length; 2580 int length;
2608 2581
2609 Node operator[](int index) native; 2582 Node operator[](int index) native;
2610 2583
2611 void operator[]=(int index, Node value) {
2612 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
2613 }
2614
2615 Node item(int index) native; 2584 Node item(int index) native;
2616 2585
2617 Node namedItem(String name) native; 2586 Node namedItem(String name) native;
2618 2587
2619 var dartObjectLocalStorage; 2588 var dartObjectLocalStorage;
2620 2589
2621 String get typeName() native; 2590 String get typeName() native;
2622 } 2591 }
2623 2592
2624 class HTMLDListElement extends HTMLElement native "*HTMLDListElement" { 2593 class HTMLDListElement extends HTMLElement native "*HTMLDListElement" {
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
4230 4199
4231 void setExtensionAPI(String script) native; 4200 void setExtensionAPI(String script) native;
4232 4201
4233 void showContextMenu(MouseEvent event, Object items) native; 4202 void showContextMenu(MouseEvent event, Object items) native;
4234 4203
4235 var dartObjectLocalStorage; 4204 var dartObjectLocalStorage;
4236 4205
4237 String get typeName() native; 4206 String get typeName() native;
4238 } 4207 }
4239 4208
4240 class Int16Array extends ArrayBufferView implements List<int> native "Int16Array " { 4209 class Int16Array extends ArrayBufferView native "*Int16Array" {
4241
4242 factory Int16Array(int length) => _construct(length);
4243
4244 factory Int16Array.fromList(List<int> list) => _construct(list);
4245
4246 factory Int16Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
4247
4248 static _construct(arg) native 'return new Int16Array(arg);';
4249 4210
4250 static final int BYTES_PER_ELEMENT = 2; 4211 static final int BYTES_PER_ELEMENT = 2;
4251 4212
4252 int length; 4213 int length;
4253 4214
4254 int operator[](int index) native;
4255
4256 void operator[]=(int index, int value) native;
4257
4258 Int16Array subarray(int start, [int end = null]) native; 4215 Int16Array subarray(int start, [int end = null]) native;
4259 } 4216 }
4260 4217
4261 class Int32Array extends ArrayBufferView implements List<int> native "Int32Array " { 4218 class Int32Array extends ArrayBufferView native "*Int32Array" {
4262
4263 factory Int32Array(int length) => _construct(length);
4264
4265 factory Int32Array.fromList(List<int> list) => _construct(list);
4266
4267 factory Int32Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
4268
4269 static _construct(arg) native 'return new Int32Array(arg);';
4270 4219
4271 static final int BYTES_PER_ELEMENT = 4; 4220 static final int BYTES_PER_ELEMENT = 4;
4272 4221
4273 int length; 4222 int length;
4274 4223
4275 int operator[](int index) native;
4276
4277 void operator[]=(int index, int value) native;
4278
4279 Int32Array subarray(int start, [int end = null]) native; 4224 Int32Array subarray(int start, [int end = null]) native;
4280 } 4225 }
4281 4226
4282 class Int8Array extends ArrayBufferView implements List<int> native "Int8Array" { 4227 class Int8Array extends ArrayBufferView native "*Int8Array" {
4283
4284 factory Int8Array(int length) => _construct(length);
4285
4286 factory Int8Array.fromList(List<int> list) => _construct(list);
4287
4288 factory Int8Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
4289
4290 static _construct(arg) native 'return new Int8Array(arg);';
4291 4228
4292 static final int BYTES_PER_ELEMENT = 1; 4229 static final int BYTES_PER_ELEMENT = 1;
4293 4230
4294 int length; 4231 int length;
4295 4232
4296 int operator[](int index) native;
4297
4298 void operator[]=(int index, int value) native;
4299
4300 Int8Array subarray(int start, [int end = null]) native; 4233 Int8Array subarray(int start, [int end = null]) native;
4301 } 4234 }
4302 4235
4303 class JavaScriptAudioNode extends AudioNode native "*JavaScriptAudioNode" { 4236 class JavaScriptAudioNode extends AudioNode native "*JavaScriptAudioNode" {
4304 4237
4305 int bufferSize; 4238 int bufferSize;
4306 } 4239 }
4307 4240
4308 class JavaScriptCallFrame native "*JavaScriptCallFrame" { 4241 class JavaScriptCallFrame native "*JavaScriptCallFrame" {
4309 4242
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
4424 } 4357 }
4425 4358
4426 class MediaList native "*MediaList" { 4359 class MediaList native "*MediaList" {
4427 4360
4428 int length; 4361 int length;
4429 4362
4430 String mediaText; 4363 String mediaText;
4431 4364
4432 String operator[](int index) native; 4365 String operator[](int index) native;
4433 4366
4434 void operator[]=(int index, String value) {
4435 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
4436 }
4437
4438 void appendMedium(String newMedium) native; 4367 void appendMedium(String newMedium) native;
4439 4368
4440 void deleteMedium(String oldMedium) native; 4369 void deleteMedium(String oldMedium) native;
4441 4370
4442 String item(int index) native; 4371 String item(int index) native;
4443 4372
4444 var dartObjectLocalStorage; 4373 var dartObjectLocalStorage;
4445 4374
4446 String get typeName() native; 4375 String get typeName() native;
4447 } 4376 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
4632 4561
4633 String get typeName() native; 4562 String get typeName() native;
4634 } 4563 }
4635 4564
4636 class NamedNodeMap native "*NamedNodeMap" { 4565 class NamedNodeMap native "*NamedNodeMap" {
4637 4566
4638 int length; 4567 int length;
4639 4568
4640 Node operator[](int index) native; 4569 Node operator[](int index) native;
4641 4570
4642 void operator[]=(int index, Node value) {
4643 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
4644 }
4645
4646 Node getNamedItem(String name) native; 4571 Node getNamedItem(String name) native;
4647 4572
4648 Node getNamedItemNS(String namespaceURI, String localName) native; 4573 Node getNamedItemNS(String namespaceURI, String localName) native;
4649 4574
4650 Node item(int index) native; 4575 Node item(int index) native;
4651 4576
4652 Node removeNamedItem(String name) native; 4577 Node removeNamedItem(String name) native;
4653 4578
4654 Node removeNamedItemNS(String namespaceURI, String localName) native; 4579 Node removeNamedItemNS(String namespaceURI, String localName) native;
4655 4580
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
4899 4824
4900 String get typeName() native; 4825 String get typeName() native;
4901 } 4826 }
4902 4827
4903 class NodeList native "*NodeList" { 4828 class NodeList native "*NodeList" {
4904 4829
4905 int length; 4830 int length;
4906 4831
4907 Node operator[](int index) native; 4832 Node operator[](int index) native;
4908 4833
4909 void operator[]=(int index, Node value) {
4910 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
4911 }
4912
4913 Node item(int index) native; 4834 Node item(int index) native;
4914 4835
4915 var dartObjectLocalStorage; 4836 var dartObjectLocalStorage;
4916 4837
4917 String get typeName() native; 4838 String get typeName() native;
4918 } 4839 }
4919 4840
4920 class NodeSelector native "*NodeSelector" { 4841 class NodeSelector native "*NodeSelector" {
4921 4842
4922 Element querySelector(String selectors) native; 4843 Element querySelector(String selectors) native;
(...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after
9000 8921
9001 String get typeName() native; 8922 String get typeName() native;
9002 } 8923 }
9003 8924
9004 class StyleSheetList native "*StyleSheetList" { 8925 class StyleSheetList native "*StyleSheetList" {
9005 8926
9006 int length; 8927 int length;
9007 8928
9008 StyleSheet operator[](int index) native; 8929 StyleSheet operator[](int index) native;
9009 8930
9010 void operator[]=(int index, StyleSheet value) {
9011 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
9012 }
9013
9014 StyleSheet item(int index) native; 8931 StyleSheet item(int index) native;
9015 8932
9016 var dartObjectLocalStorage; 8933 var dartObjectLocalStorage;
9017 8934
9018 String get typeName() native; 8935 String get typeName() native;
9019 } 8936 }
9020 8937
9021 class Text extends CharacterData native "Text" { 8938 class Text extends CharacterData native "Text" {
9022 8939
9023 String wholeText; 8940 String wholeText;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
9190 9107
9191 void initTouchEvent(TouchList touches, TouchList targetTouches, TouchList chan gedTouches, String type, DOMWindow view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) native; 9108 void initTouchEvent(TouchList touches, TouchList targetTouches, TouchList chan gedTouches, String type, DOMWindow view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) native;
9192 } 9109 }
9193 9110
9194 class TouchList native "*TouchList" { 9111 class TouchList native "*TouchList" {
9195 9112
9196 int length; 9113 int length;
9197 9114
9198 Touch operator[](int index) native; 9115 Touch operator[](int index) native;
9199 9116
9200 void operator[]=(int index, Touch value) {
9201 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
9202 }
9203
9204 Touch item(int index) native; 9117 Touch item(int index) native;
9205 9118
9206 var dartObjectLocalStorage; 9119 var dartObjectLocalStorage;
9207 9120
9208 String get typeName() native; 9121 String get typeName() native;
9209 } 9122 }
9210 9123
9211 class TreeWalker native "*TreeWalker" { 9124 class TreeWalker native "*TreeWalker" {
9212 9125
9213 Node currentNode; 9126 Node currentNode;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
9255 9168
9256 int pageY; 9169 int pageY;
9257 9170
9258 DOMWindow view; 9171 DOMWindow view;
9259 9172
9260 int which; 9173 int which;
9261 9174
9262 void initUIEvent(String type, bool canBubble, bool cancelable, DOMWindow view, int detail) native; 9175 void initUIEvent(String type, bool canBubble, bool cancelable, DOMWindow view, int detail) native;
9263 } 9176 }
9264 9177
9265 class Uint16Array extends ArrayBufferView implements List<int> native "Uint16Arr ay" { 9178 class Uint16Array extends ArrayBufferView native "*Uint16Array" {
9266
9267 factory Uint16Array(int length) => _construct(length);
9268
9269 factory Uint16Array.fromList(List<int> list) => _construct(list);
9270
9271 factory Uint16Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
9272
9273 static _construct(arg) native 'return new Uint16Array(arg);';
9274 9179
9275 static final int BYTES_PER_ELEMENT = 2; 9180 static final int BYTES_PER_ELEMENT = 2;
9276 9181
9277 int length; 9182 int length;
9278 9183
9279 int operator[](int index) native;
9280
9281 void operator[]=(int index, int value) native;
9282
9283 Uint16Array subarray(int start, [int end = null]) native; 9184 Uint16Array subarray(int start, [int end = null]) native;
9284 } 9185 }
9285 9186
9286 class Uint32Array extends ArrayBufferView implements List<int> native "Uint32Arr ay" { 9187 class Uint32Array extends ArrayBufferView native "*Uint32Array" {
9287
9288 factory Uint32Array(int length) => _construct(length);
9289
9290 factory Uint32Array.fromList(List<int> list) => _construct(list);
9291
9292 factory Uint32Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
9293
9294 static _construct(arg) native 'return new Uint32Array(arg);';
9295 9188
9296 static final int BYTES_PER_ELEMENT = 4; 9189 static final int BYTES_PER_ELEMENT = 4;
9297 9190
9298 int length; 9191 int length;
9299 9192
9300 int operator[](int index) native;
9301
9302 void operator[]=(int index, int value) native;
9303
9304 Uint32Array subarray(int start, [int end = null]) native; 9193 Uint32Array subarray(int start, [int end = null]) native;
9305 } 9194 }
9306 9195
9307 class Uint8Array extends ArrayBufferView implements List<int> native "Uint8Array " { 9196 class Uint8Array extends ArrayBufferView native "*Uint8Array" {
9308
9309 factory Uint8Array(int length) => _construct(length);
9310
9311 factory Uint8Array.fromList(List<int> list) => _construct(list);
9312
9313 factory Uint8Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
9314
9315 static _construct(arg) native 'return new Uint8Array(arg);';
9316 9197
9317 static final int BYTES_PER_ELEMENT = 1; 9198 static final int BYTES_PER_ELEMENT = 1;
9318 9199
9319 int length; 9200 int length;
9320 9201
9321 int operator[](int index) native;
9322
9323 void operator[]=(int index, int value) native;
9324
9325 Uint8Array subarray(int start, [int end = null]) native; 9202 Uint8Array subarray(int start, [int end = null]) native;
9326 } 9203 }
9327 9204
9328 class ValidityState native "*ValidityState" { 9205 class ValidityState native "*ValidityState" {
9329 9206
9330 bool customError; 9207 bool customError;
9331 9208
9332 bool patternMismatch; 9209 bool patternMismatch;
9333 9210
9334 bool rangeOverflow; 9211 bool rangeOverflow;
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after
11175 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 11052 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
11176 // for details. All rights reserved. Use of this source code is governed by a 11053 // for details. All rights reserved. Use of this source code is governed by a
11177 // BSD-style license that can be found in the LICENSE file. 11054 // BSD-style license that can be found in the LICENSE file.
11178 11055
11179 typedef bool RequestAnimationFrameCallback(int time); 11056 typedef bool RequestAnimationFrameCallback(int time);
11180 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 11057 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
11181 // for details. All rights reserved. Use of this source code is governed by a 11058 // for details. All rights reserved. Use of this source code is governed by a
11182 // BSD-style license that can be found in the LICENSE file. 11059 // BSD-style license that can be found in the LICENSE file.
11183 11060
11184 typedef void TimeoutHandler(); 11061 typedef void TimeoutHandler();
11185 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
11186 // for details. All rights reserved. Use of this source code is governed by a
11187 // BSD-style license that can be found in the LICENSE file.
11188
11189 /**
11190 * The [Collections] class implements static methods useful when
11191 * writing a class that implements [Collection] and the [iterator]
11192 * method.
11193 */
11194 class _Collections {
11195 static void forEach(Iterable<Object> iterable, void f(Object o)) {
11196 for (final e in iterable) {
11197 f(e);
11198 }
11199 }
11200
11201 static bool some(Iterable<Object> iterable, bool f(Object o)) {
11202 for (final e in iterable) {
11203 if (f(e)) return true;
11204 }
11205 return false;
11206 }
11207
11208 static bool every(Iterable<Object> iterable, bool f(Object o)) {
11209 for (final e in iterable) {
11210 if (!f(e)) return false;
11211 }
11212 return true;
11213 }
11214
11215 static List filter(Iterable<Object> source,
11216 List<Object> destination,
11217 bool f(o)) {
11218 for (final e in source) {
11219 if (f(e)) destination.add(e);
11220 }
11221 return destination;
11222 }
11223
11224 static bool isEmpty(Iterable<Object> iterable) {
11225 return !iterable.iterator().hasNext();
11226 }
11227 }
11228 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
11229 // for details. All rights reserved. Use of this source code is governed by a
11230 // BSD-style license that can be found in the LICENSE file.
11231
11232 // Iterator for arrays with fixed size.
11233 class _FixedSizeListIterator<T> extends _VariableSizeListIterator<T> {
11234 _FixedSizeListIterator(List<T> array)
11235 : super(array),
11236 _length = array.length;
11237
11238 bool hasNext() => _length > _pos;
11239
11240 final int _length; // Cache array length for faster access.
11241 }
11242
11243 // Iterator for arrays with variable size.
11244 class _VariableSizeListIterator<T> implements Iterator<T> {
11245 _VariableSizeListIterator(List<T> array)
11246 : _array = array,
11247 _pos = 0;
11248
11249 bool hasNext() => _array.length > _pos;
11250
11251 T next() {
11252 if (!hasNext()) {
11253 throw const NoMoreElementsException();
11254 }
11255 return _array[_pos++];
11256 }
11257
11258 final List<T> _array;
11259 int _pos;
11260 }
11261 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
11262 // for details. All rights reserved. Use of this source code is governed by a
11263 // BSD-style license that can be found in the LICENSE file.
11264
11265 class _Lists {
11266
11267 /**
11268 * Returns the index in the array [a] of the given [element], starting
11269 * the search at index [startIndex] to [endIndex] (exclusive).
11270 * Returns -1 if [element] is not found.
11271 */
11272 static int indexOf(List a,
11273 Object element,
11274 int startIndex,
11275 int endIndex) {
11276 if (startIndex >= a.length) {
11277 return -1;
11278 }
11279 if (startIndex < 0) {
11280 startIndex = 0;
11281 }
11282 for (int i = startIndex; i < endIndex; i++) {
11283 if (a[i] == element) {
11284 return i;
11285 }
11286 }
11287 return -1;
11288 }
11289
11290 /**
11291 * Returns the last index in the array [a] of the given [element], starting
11292 * the search at index [startIndex] to 0.
11293 * Returns -1 if [element] is not found.
11294 */
11295 static int lastIndexOf(List a, Object element, int startIndex) {
11296 if (startIndex < 0) {
11297 return -1;
11298 }
11299 if (startIndex >= a.length) {
11300 startIndex = a.length - 1;
11301 }
11302 for (int i = startIndex; i >= 0; i--) {
11303 if (a[i] == element) {
11304 return i;
11305 }
11306 }
11307 return -1;
11308 }
11309 }
OLDNEW
« no previous file with comments | « no previous file | client/dom/frog_dom.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698