OLD | NEW |
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 // DO NOT EDIT | 5 // DO NOT EDIT |
6 // Auto-generated dart:html library. | 6 // Auto-generated dart:html library. |
7 | 7 |
8 /** | 8 /** |
9 * HTML elements and other resources for web-based applications that need to | 9 * HTML elements and other resources for web-based applications that need to |
10 * interact with the browser and the DOM (Document Object Model). | 10 * interact with the browser and the DOM (Document Object Model). |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 397 } |
398 | 398 |
399 // TODO(alanknight): With upgraded custom elements this causes a failure bec
ause | 399 // TODO(alanknight): With upgraded custom elements this causes a failure bec
ause |
400 // we need a new wrapper after the type changes. We could possibly invalidat
e this | 400 // we need a new wrapper after the type changes. We could possibly invalidat
e this |
401 // if the constructor name didn't match? | 401 // if the constructor name didn't match? |
402 var wrapper = js.getDartHtmlWrapperFor(jsObject); | 402 var wrapper = js.getDartHtmlWrapperFor(jsObject); |
403 if (wrapper != null) { | 403 if (wrapper != null) { |
404 return wrapper; | 404 return wrapper; |
405 } | 405 } |
406 | 406 |
407 if (jsObject is js.JsArray) { | |
408 var wrappingList = new _DartHtmlWrappingList(jsObject); | |
409 js.setDartHtmlWrapperFor(jsObject, wrappingList); | |
410 return wrappingList; | |
411 } | |
412 | |
413 // Try the most general type conversions on it. | 407 // Try the most general type conversions on it. |
414 // TODO(alanknight): We may be able to do better. This maintains identity, | 408 // TODO(alanknight): We may be able to do better. This maintains identity, |
415 // which is useful, but expensive. And if we nest something that only | 409 // which is useful, but expensive. And if we nest something that only |
416 // this conversion handles, how does that work? e.g. a list of maps of eleme
nts. | 410 // this conversion handles, how does that work? e.g. a list of maps of eleme
nts. |
417 var converted = convertNativeToDart_SerializedScriptValue(jsObject); | 411 var converted = convertNativeToDart_SerializedScriptValue(jsObject); |
418 if (!identical(converted, jsObject)) { | 412 if (!identical(converted, jsObject)) { |
419 return converted; | 413 return converted; |
420 } | 414 } |
421 var constructor = jsObject['constructor']; | 415 var constructor = jsObject['constructor']; |
422 if (__interop_checks) { | 416 if (__interop_checks) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 }); | 542 }); |
549 return jsObject; | 543 return jsObject; |
550 } | 544 } |
551 | 545 |
552 // Converts a Dart list into a JsArray. For the Dartium version only. | 546 // Converts a Dart list into a JsArray. For the Dartium version only. |
553 convertDartToNative_List(List input) => new js.JsArray()..addAll(input); | 547 convertDartToNative_List(List input) => new js.JsArray()..addAll(input); |
554 | 548 |
555 // Conversion function place holder (currently not used in dart2js or dartium). | 549 // Conversion function place holder (currently not used in dart2js or dartium). |
556 List convertDartToNative_StringArray(List<String> input) => input; | 550 List convertDartToNative_StringArray(List<String> input) => input; |
557 | 551 |
558 /** | |
559 * Wraps a JsArray and will call wrap_jso on its entries. | |
560 */ | |
561 class _DartHtmlWrappingList extends ListBase { | |
562 _DartHtmlWrappingList(this._basicList); | |
563 | |
564 final js.JsArray _basicList; | |
565 | |
566 operator [](int index) => wrap_jso(_basicList[index]); | |
567 | |
568 operator []=(int index, value) => _basicList[index] = unwrap_jso(value); | |
569 | |
570 int get length => _basicList.length; | |
571 int set length(int newLength) => _basicList.length = newLength; | |
572 } | |
573 | |
574 $else | 552 $else |
575 class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {} | 553 class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {} |
576 | 554 |
577 unwrap_jso(dartClass_instance) => dartClass_instance; | 555 unwrap_jso(dartClass_instance) => dartClass_instance; |
578 wrap_jso(jsObject) => jsObject; | 556 wrap_jso(jsObject) => jsObject; |
579 make_dart_rectangle(r) => r; | 557 make_dart_rectangle(r) => r; |
580 convertDartToNative_Dictionary(Map dict) => dict; | 558 convertDartToNative_Dictionary(Map dict) => dict; |
581 List convertDartToNative_StringArray(List<String> input) => input; | 559 List convertDartToNative_StringArray(List<String> input) => input; |
582 convertDartToNative_List(List input) => input; | 560 convertDartToNative_List(List input) => input; |
583 | 561 |
584 $endif | 562 $endif |
OLD | NEW |