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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 return null; | 249 return null; |
250 } | 250 } |
251 | 251 |
252 Type _getSvgType(String key) { | 252 Type _getSvgType(String key) { |
253 if (svgBlinkMap.containsKey(key)) { | 253 if (svgBlinkMap.containsKey(key)) { |
254 return svgBlinkMap[key](); | 254 return svgBlinkMap[key](); |
255 } | 255 } |
256 return null; | 256 return null; |
257 } | 257 } |
258 | 258 |
259 // TODO(jacobr): it would be nice to place this in a consistent place for dart2j
s and dartium. | 259 // TODO(jacobr): it would be nice to place these conversion methods in a consist
ent place for dart2js and dartium. |
| 260 |
| 261 WindowBase _convertNativeToDart_Window(win) { |
| 262 if (win == null) return null; |
| 263 return _DOMWindowCrossFrame._createSafe(win); |
| 264 } |
| 265 |
| 266 EventTarget _convertNativeToDart_EventTarget(e) { |
| 267 if (e == null) { |
| 268 return null; |
| 269 } |
| 270 // Assume it's a Window if it contains the postMessage property. It may be |
| 271 // from a different frame - without a patched prototype - so we cannot |
| 272 // rely on Dart type checking. |
| 273 try { |
| 274 if (js.JsNative.hasProperty(e, "postMessage")) { |
| 275 var window = _DOMWindowCrossFrame._createSafe(e); |
| 276 // If it's a native window. |
| 277 if (window is EventTarget) { |
| 278 return window; |
| 279 } |
| 280 return null; |
| 281 } |
| 282 } catch (err) { |
| 283 print("Error calling _convertNativeToDart_EventTarget... $err"); |
| 284 } |
| 285 return e; |
| 286 } |
| 287 |
| 288 EventTarget _convertDartToNative_EventTarget(e) { |
| 289 // _DOMWindowCrossFrame uses an interceptor so we don't need to do anything un
like Dart2Js. |
| 290 return e; |
| 291 } |
| 292 |
260 _convertNativeToDart_XHR_Response(o) { | 293 _convertNativeToDart_XHR_Response(o) { |
261 if (o is Document) { | 294 if (o is Document) { |
262 return o; | 295 return o; |
263 } | 296 } |
264 return convertNativeToDart_SerializedScriptValue(o); | 297 return convertNativeToDart_SerializedScriptValue(o); |
265 } | 298 } |
266 | 299 |
267 $if JSINTEROP | 300 $if JSINTEROP |
268 | 301 |
269 /****************************************************************************** | 302 /****************************************************************************** |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 DebugAssertException(this.message); | 347 DebugAssertException(this.message); |
315 } | 348 } |
316 | 349 |
317 @Deprecated("Internal Use Only") | 350 @Deprecated("Internal Use Only") |
318 debug_or_assert(message, expression) { | 351 debug_or_assert(message, expression) { |
319 if (!expression) { | 352 if (!expression) { |
320 throw new DebugAssertException("$message"); | 353 throw new DebugAssertException("$message"); |
321 } | 354 } |
322 } | 355 } |
323 | 356 |
324 // TODO(jacobr): we shouldn't be generating this call in the dart:html | |
325 // bindings but we are. | |
326 _convertDartToNative_EventTarget(target) => target; | |
327 | |
328 @Deprecated("Internal Use Only") | 357 @Deprecated("Internal Use Only") |
329 Map<String, dynamic> convertNativeObjectToDartMap(js.JsObject jsObject) { | 358 Map<String, dynamic> convertNativeObjectToDartMap(js.JsObject jsObject) { |
330 var result = new Map(); | 359 var result = new Map(); |
331 var keys = js.JsNative.callMethod(js.JsNative.getProperty(js.context, 'Object'
), 'keys', [jsObject]); | 360 var keys = js.JsNative.callMethod(js.JsNative.getProperty(js.context, 'Object'
), 'keys', [jsObject]); |
332 for (var key in keys) { | 361 for (var key in keys) { |
333 result[key] = js.JsNative.getProperty(jsObject, key); | 362 result[key] = js.JsNative.getProperty(jsObject, key); |
334 } | 363 } |
335 return result; | 364 return result; |
336 } | 365 } |
337 | 366 |
338 /** | 367 /** |
339 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. | 368 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. |
340 */ | 369 */ |
341 _createCustomUpgrader(Type customElementClass, $this) { | 370 _createCustomUpgrader(Type customElementClass, $this) { |
342 return _blink.Blink_Utils.setInstanceInterceptor($this, customElementClass, cu
stomElement: true); | 371 return _blink.Blink_Utils.setInstanceInterceptor($this, customElementClass, cu
stomElement: true); |
343 } | 372 } |
344 | 373 |
345 $else | 374 $else |
346 class DartHtmlDomObject extends NativeFieldWrapperClass2 {} | 375 class DartHtmlDomObject extends NativeFieldWrapperClass2 {} |
347 | 376 |
348 _createCustomUpgrader(Type customElementClass, $this) => $this; | 377 _createCustomUpgrader(Type customElementClass, $this) => $this; |
349 | 378 |
350 $endif | 379 $endif |
OLD | NEW |