Chromium Code Reviews| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 * See also: | 111 * See also: |
| 112 * | 112 * |
| 113 * * [Window](https://developer.mozilla.org/en-US/docs/Web/API/window) from MD N. | 113 * * [Window](https://developer.mozilla.org/en-US/docs/Web/API/window) from MD N. |
| 114 */ | 114 */ |
| 115 Window get window { | 115 Window get window { |
| 116 if (_window != null) { | 116 if (_window != null) { |
| 117 return _window; | 117 return _window; |
| 118 } | 118 } |
| 119 $if DARTIUM | 119 $if DARTIUM |
| 120 $if JSINTEROP | 120 $if JSINTEROP |
| 121 _window = wrap_jso(js.JsNative.getProperty(js.context, 'window')); | 121 _window = js.JsNative.toTypedObject(js.context); |
| 122 $else | 122 $else |
| 123 _window = _Utils.window(); | 123 _window = _Utils.window(); |
| 124 $endif | 124 $endif |
| 125 $endif | 125 $endif |
| 126 return _window; | 126 return _window; |
| 127 } | 127 } |
| 128 | 128 |
| 129 HtmlDocument _document; | 129 HtmlDocument _document; |
| 130 | 130 |
| 131 /** | 131 /** |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 154 @Deprecated("Internal Use Only") | 154 @Deprecated("Internal Use Only") |
| 155 final htmlBlinkMap = { | 155 final htmlBlinkMap = { |
| 156 '_HistoryCrossFrame': () => _HistoryCrossFrame, | 156 '_HistoryCrossFrame': () => _HistoryCrossFrame, |
| 157 '_LocationCrossFrame': () => _LocationCrossFrame, | 157 '_LocationCrossFrame': () => _LocationCrossFrame, |
| 158 '_DOMWindowCrossFrame': () => _DOMWindowCrossFrame, | 158 '_DOMWindowCrossFrame': () => _DOMWindowCrossFrame, |
| 159 // FIXME: Move these to better locations. | 159 // FIXME: Move these to better locations. |
| 160 'DateTime': () => DateTime, | 160 'DateTime': () => DateTime, |
| 161 'JsObject': () => js.JsObject, | 161 'JsObject': () => js.JsObject, |
| 162 'JsFunction': () => js.JsFunction, | 162 'JsFunction': () => js.JsFunction, |
| 163 'JsArray': () => js.JsArray, | 163 'JsArray': () => js.JsArray, |
| 164 // We have to call .instanceRuntimeType as these classes have a private | |
| 165 // implementation class defined dynamically at runtime via a patch file. | |
| 166 'JSObject': () => js.JSObject.instanceRuntimeType, | |
| 167 'JSFunction': () => js.JSFunction.instanceRuntimeType, | |
| 168 'JSArray': () => js.JSArray.instanceRuntimeType, | |
| 164 $!TYPE_MAP | 169 $!TYPE_MAP |
| 165 }; | 170 }; |
| 166 | 171 |
| 167 // TODO(leafp): We may want to move this elsewhere if html becomes | 172 // TODO(leafp): We may want to move this elsewhere if html becomes |
| 168 // a package to avoid dartium depending on pkg:html. | 173 // a package to avoid dartium depending on pkg:html. |
| 169 Type _getType(String key) { | 174 Type _getType(String key) { |
| 170 var result; | 175 var result; |
| 171 | 176 |
| 172 // TODO(vsm): Add Cross Frame and JS types here as well. | 177 // TODO(vsm): Add Cross Frame and JS types here as well. |
| 173 | 178 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 if (!expression) { | 415 if (!expression) { |
| 411 throw new DebugAssertException("$message"); | 416 throw new DebugAssertException("$message"); |
| 412 } | 417 } |
| 413 } | 418 } |
| 414 | 419 |
| 415 @Deprecated("Internal Use Only") | 420 @Deprecated("Internal Use Only") |
| 416 Map<String, dynamic> convertNativeObjectToDartMap(js.JsObject jsObject) { | 421 Map<String, dynamic> convertNativeObjectToDartMap(js.JsObject jsObject) { |
| 417 var result = new Map(); | 422 var result = new Map(); |
| 418 var keys = js.JsNative.callMethod(js.JsNative.getProperty(js.context, 'Object' ), 'keys', [jsObject]); | 423 var keys = js.JsNative.callMethod(js.JsNative.getProperty(js.context, 'Object' ), 'keys', [jsObject]); |
| 419 for (var key in keys) { | 424 for (var key in keys) { |
| 420 result[key] = wrap_jso(js.JsNative.getProperty(jsObject, key)); | 425 result[key] = js.JsNative.getProperty(jsObject, key); |
| 421 } | 426 } |
| 422 return result; | 427 return result; |
| 423 } | 428 } |
| 424 | 429 |
| 425 /** | 430 /** |
| 426 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. | 431 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. |
| 427 */ | 432 */ |
| 428 _createCustomUpgrader(Type customElementClass, $this) { | 433 _createCustomUpgrader(Type customElementClass, $this) { |
| 429 var dartClass; | 434 var dartClass; |
| 435 throw 'TODO(jacobr): implement _createCustomUpgrader'; | |
| 430 try { | 436 try { |
| 431 dartClass = _blink.Blink_Utils.constructElement(customElementClass, $this); | 437 dartClass = _blink.Blink_Utils.constructElement(customElementClass, $this); |
| 432 } catch (e) { | 438 } catch (e) { |
| 433 // Did the dartClass get allocated but the created failed? Otherwise, other | 439 // Did the dartClass get allocated but the created failed? Otherwise, other |
| 434 // components inside of this failed somewhere (could be JS custom element). | 440 // components inside of this failed somewhere (could be JS custom element). |
| 441 // TODO(jacobr): clearly this can't happen otherwise an exception wouldn't | |
|
Alan Knight
2016/03/25 21:39:09
I think I remember Terry introducing this because
Jacob
2016/03/30 00:19:00
This code path is now obsolete. I've rewritten all
| |
| 442 // have been thrown. This code needs to be carefully reviewed. | |
| 435 if (dartClass != null) { | 443 if (dartClass != null) { |
| 436 // Yes, mark as didn't upgrade. | 444 // Yes, mark as didn't upgrade. |
| 437 dartClass._badUpgrade(); | 445 dartClass._badUpgrade(); |
| 438 } | 446 } |
| 439 throw e; | 447 throw e; |
| 440 } finally { | 448 } finally { |
| 441 // Need to remember the Dart class that was created for this custom so | 449 // Need to remember the Dart class that was created for this custom so |
| 442 // return it and setup the blink_jsObject to the $this that we'll be working | 450 // return it and setup the blink_jsObject to the $this that we'll be working |
| 443 // with as we talk to blink. | 451 // with as we talk to blink. |
| 444 js.setDartHtmlWrapperFor($this, dartClass); | 452 // XXX terry, what do we need to do for this code? |
| 453 print("XXX VALIDATE THIS CASE WORKS"); | |
| 454 // XXX THIS IS ALL KINDS OF FOOBAR. | |
| 455 // js.setDartHtmlWrapperFor($this, dartClass); | |
| 445 } | 456 } |
| 446 | 457 |
| 447 return dartClass; | 458 return dartClass; |
| 448 } | 459 } |
| 449 | 460 |
| 450 $else | 461 $else |
| 451 class DartHtmlDomObject extends NativeFieldWrapperClass2 {} | 462 class DartHtmlDomObject extends NativeFieldWrapperClass2 {} |
| 452 | 463 |
| 453 _createCustomUpgrader(Type customElementClass, $this) => $this; | 464 _createCustomUpgrader(Type customElementClass, $this) => $this; |
| 454 | 465 |
| 455 $endif | 466 $endif |
| OLD | NEW |