| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 try { | 392 try { |
| 393 if (jsObject is! js.JsObject || jsObject == null) { | 393 if (jsObject is! js.JsObject || jsObject == null) { |
| 394 // JS Interop converted the object to a Dart class e.g., Uint8ClampedList. | 394 // JS Interop converted the object to a Dart class e.g., Uint8ClampedList. |
| 395 // or it's a simple type. | 395 // or it's a simple type. |
| 396 return jsObject; | 396 return jsObject; |
| 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 if (jsObject.dartWrapper != null) { | 402 var wrapper = js.getDartHtmlWrapperFor(jsObject); |
| 403 return jsObject.dartWrapper; | 403 if (wrapper != null) { |
| 404 return wrapper; |
| 404 } | 405 } |
| 405 | 406 |
| 406 // Try the most general type conversions on it. | 407 // Try the most general type conversions on it. |
| 407 // 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, |
| 408 // 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 |
| 409 // 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. |
| 410 var converted = convertNativeToDart_SerializedScriptValue(jsObject); | 411 var converted = convertNativeToDart_SerializedScriptValue(jsObject); |
| 411 if (!identical(converted, jsObject)) { | 412 if (!identical(converted, jsObject)) { |
| 412 return converted; | 413 return converted; |
| 413 } | 414 } |
| 414 var constructor = jsObject['constructor']; | 415 var constructor = jsObject['constructor']; |
| 415 if (__interop_checks) { | 416 if (__interop_checks) { |
| 416 debug_or_assert("constructor != null", constructor != null); | 417 debug_or_assert("constructor != null", constructor != null); |
| 417 } | 418 } |
| 418 var jsTypeName = constructor['name']; | 419 var jsTypeName = constructor['name']; |
| 419 if (__interop_checks) { | 420 if (__interop_checks) { |
| 420 debug_or_assert("constructor != null && jsTypeName.length > 0", constructo
r != null && jsTypeName.length > 0); | 421 debug_or_assert("constructor != null && jsTypeName.length > 0", constructo
r != null && jsTypeName.length > 0); |
| 421 } | 422 } |
| 422 | 423 |
| 423 var dartClass_instance; | 424 var dartClass_instance; |
| 424 if (jsObject.hasProperty('dart_class')) { | 425 if (jsObject.hasProperty('dart_class')) { |
| 425 // Got a dart_class (it's a custom element) use it it's already set up. | 426 // Got a dart_class (it's a custom element) use it it's already set up. |
| 426 dartClass_instance = jsObject['dart_class']; | 427 dartClass_instance = jsObject['dart_class']; |
| 427 } else { | 428 } else { |
| 428 var func = getHtmlCreateFunction(jsTypeName); | 429 var func = getHtmlCreateFunction(jsTypeName); |
| 429 if (func != null) { | 430 if (func != null) { |
| 430 dartClass_instance = func(); | 431 dartClass_instance = func(); |
| 431 dartClass_instance.blink_jsObject = jsObject; | 432 dartClass_instance.blink_jsObject = jsObject; |
| 432 jsObject.dartWrapper = dartClass_instance; | 433 js.setDartHtmlWrapperFor(jsObject, dartClass_instance); |
| 433 } | 434 } |
| 434 } | 435 } |
| 435 return dartClass_instance; | 436 return dartClass_instance; |
| 436 } catch(e, stacktrace){ | 437 } catch(e, stacktrace){ |
| 437 if (__interop_checks) { | 438 if (__interop_checks) { |
| 438 if (e is DebugAssertException) | 439 if (e is DebugAssertException) |
| 439 window.console.log("${e.message}\n ${stacktrace}"); | 440 window.console.log("${e.message}\n ${stacktrace}"); |
| 440 else | 441 else |
| 441 window.console.log("${stacktrace}"); | 442 window.console.log("${stacktrace}"); |
| 442 } | 443 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {} | 553 class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {} |
| 553 | 554 |
| 554 unwrap_jso(dartClass_instance) => dartClass_instance; | 555 unwrap_jso(dartClass_instance) => dartClass_instance; |
| 555 wrap_jso(jsObject) => jsObject; | 556 wrap_jso(jsObject) => jsObject; |
| 556 make_dart_rectangle(r) => r; | 557 make_dart_rectangle(r) => r; |
| 557 convertDartToNative_Dictionary(Map dict) => dict; | 558 convertDartToNative_Dictionary(Map dict) => dict; |
| 558 List convertDartToNative_StringArray(List<String> input) => input; | 559 List convertDartToNative_StringArray(List<String> input) => input; |
| 559 convertDartToNative_List(List input) => input; | 560 convertDartToNative_List(List input) => input; |
| 560 | 561 |
| 561 $endif | 562 $endif |
| OLD | NEW |