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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 return null; | 344 return null; |
345 } | 345 } |
346 | 346 |
347 | 347 |
348 /****************************************************************************** | 348 /****************************************************************************** |
349 ********** ********** | 349 ********** ********** |
350 ********** JS Interop Support ********** | 350 ********** JS Interop Support ********** |
351 ********** ********** | 351 ********** ********** |
352 ******************************************************************************/ | 352 ******************************************************************************/ |
353 | 353 |
| 354 // List of known tagName to DartClass for custom elements, used for upgrade. |
| 355 var _knownCustomeElements = new Map<String, Type>(); |
| 356 |
354 Rectangle make_dart_rectangle(r) => | 357 Rectangle make_dart_rectangle(r) => |
355 r == null ? null : new Rectangle(r['left'], r['top'], r['width'], r['height'
]); | 358 r == null ? null : new Rectangle(r['left'], r['top'], r['width'], r['height'
]); |
356 | 359 |
357 // Need a default constructor for constructing classes with mixins that are | 360 // Need a default constructor for constructing classes with mixins that are |
358 // also extending NativeFieldWrapperClass2. Defining JsoNativeFieldWrapper | 361 // also extending NativeFieldWrapperClass2. Defining JsoNativeFieldWrapper |
359 // extending NativeFieldWrapperClass2 creates a default constructor. | 362 // extending NativeFieldWrapperClass2 creates a default constructor. |
360 class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {} | 363 class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {} |
361 | 364 |
362 // Flag to disable JS interop asserts. Setting to false will speed up the | 365 // Flag to disable JS interop asserts. Setting to false will speed up the |
363 // wrap_jso calls. | 366 // wrap_jso calls. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 var jsTypeName = constructor['name']; | 416 var jsTypeName = constructor['name']; |
414 if (__interop_checks) { | 417 if (__interop_checks) { |
415 debug_or_assert("constructor != null && jsTypeName.length > 0", constructo
r != null && jsTypeName.length > 0); | 418 debug_or_assert("constructor != null && jsTypeName.length > 0", constructo
r != null && jsTypeName.length > 0); |
416 } | 419 } |
417 | 420 |
418 var dartClass_instance; | 421 var dartClass_instance; |
419 if (jsObject.hasProperty('dart_class')) { | 422 if (jsObject.hasProperty('dart_class')) { |
420 // Got a dart_class (it's a custom element) use it it's already set up. | 423 // Got a dart_class (it's a custom element) use it it's already set up. |
421 dartClass_instance = jsObject['dart_class']; | 424 dartClass_instance = jsObject['dart_class']; |
422 } else { | 425 } else { |
423 var func = getHtmlCreateFunction(jsTypeName); | 426 var localName = jsObject['localName']; |
424 if (func != null) { | 427 var customElementClass = _knownCustomeElements[localName]; |
425 dartClass_instance = func(); | 428 // Custom Element to upgrade. |
426 dartClass_instance.blink_jsObject = jsObject; | 429 if (jsTypeName == 'HTMLElement' && customElementClass != null) { |
427 js.setDartHtmlWrapperFor(jsObject, dartClass_instance); | 430 try { |
| 431 dartClass_instance = _blink.Blink_Utils.constructElement(customElement
Class, jsObject); |
| 432 } finally { |
| 433 dartClass_instance.blink_jsObject = jsObject; |
| 434 jsObject['dart_class'] = dartClass_instance; |
| 435 js.setDartHtmlWrapperFor(jsObject, dartClass_instance); |
| 436 } |
| 437 } else { |
| 438 var func = getHtmlCreateFunction(jsTypeName); |
| 439 if (func != null) { |
| 440 dartClass_instance = func(); |
| 441 dartClass_instance.blink_jsObject = jsObject; |
| 442 js.setDartHtmlWrapperFor(jsObject, dartClass_instance); |
| 443 } |
428 } | 444 } |
429 } | 445 } |
430 return dartClass_instance; | 446 return dartClass_instance; |
431 } catch(e, stacktrace){ | 447 } catch(e, stacktrace){ |
432 if (__interop_checks) { | 448 if (__interop_checks) { |
433 if (e is DebugAssertException) | 449 if (e is DebugAssertException) |
434 window.console.log("${e.message}\n ${stacktrace}"); | 450 window.console.log("${e.message}\n ${stacktrace}"); |
435 else | 451 else |
436 window.console.log("${stacktrace}"); | 452 window.console.log("${stacktrace}"); |
437 } | 453 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 599 |
584 unwrap_jso(dartClass_instance) => dartClass_instance; | 600 unwrap_jso(dartClass_instance) => dartClass_instance; |
585 wrap_jso(jsObject) => jsObject; | 601 wrap_jso(jsObject) => jsObject; |
586 make_dart_rectangle(r) => r; | 602 make_dart_rectangle(r) => r; |
587 convertDartToNative_Dictionary(Map dict) => dict; | 603 convertDartToNative_Dictionary(Map dict) => dict; |
588 List convertDartToNative_StringArray(List<String> input) => input; | 604 List convertDartToNative_StringArray(List<String> input) => input; |
589 convertDartToNative_List(List input) => input; | 605 convertDartToNative_List(List input) => input; |
590 createCustomUpgrader(Type customElementClass, $this) => $this; | 606 createCustomUpgrader(Type customElementClass, $this) => $this; |
591 | 607 |
592 $endif | 608 $endif |
OLD | NEW |