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 these conversion methods in a consist
ent place for dart2js and dartium. | 259 // TODO(jacobr): it would be nice to place this in a consistent place for dart2j
s 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 | |
293 _convertNativeToDart_XHR_Response(o) { | 260 _convertNativeToDart_XHR_Response(o) { |
294 if (o is Document) { | 261 if (o is Document) { |
295 return o; | 262 return o; |
296 } | 263 } |
297 return convertNativeToDart_SerializedScriptValue(o); | 264 return convertNativeToDart_SerializedScriptValue(o); |
298 } | 265 } |
299 | 266 |
300 $if JSINTEROP | 267 $if JSINTEROP |
301 | 268 |
302 /****************************************************************************** | 269 /****************************************************************************** |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 DebugAssertException(this.message); | 314 DebugAssertException(this.message); |
348 } | 315 } |
349 | 316 |
350 @Deprecated("Internal Use Only") | 317 @Deprecated("Internal Use Only") |
351 debug_or_assert(message, expression) { | 318 debug_or_assert(message, expression) { |
352 if (!expression) { | 319 if (!expression) { |
353 throw new DebugAssertException("$message"); | 320 throw new DebugAssertException("$message"); |
354 } | 321 } |
355 } | 322 } |
356 | 323 |
| 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 |
357 @Deprecated("Internal Use Only") | 328 @Deprecated("Internal Use Only") |
358 Map<String, dynamic> convertNativeObjectToDartMap(js.JsObject jsObject) { | 329 Map<String, dynamic> convertNativeObjectToDartMap(js.JsObject jsObject) { |
359 var result = new Map(); | 330 var result = new Map(); |
360 var keys = js.JsNative.callMethod(js.JsNative.getProperty(js.context, 'Object'
), 'keys', [jsObject]); | 331 var keys = js.JsNative.callMethod(js.JsNative.getProperty(js.context, 'Object'
), 'keys', [jsObject]); |
361 for (var key in keys) { | 332 for (var key in keys) { |
362 result[key] = js.JsNative.getProperty(jsObject, key); | 333 result[key] = js.JsNative.getProperty(jsObject, key); |
363 } | 334 } |
364 return result; | 335 return result; |
365 } | 336 } |
366 | 337 |
367 /** | 338 /** |
368 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. | 339 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. |
369 */ | 340 */ |
370 _createCustomUpgrader(Type customElementClass, $this) { | 341 _createCustomUpgrader(Type customElementClass, $this) { |
371 return _blink.Blink_Utils.setInstanceInterceptor($this, customElementClass, cu
stomElement: true); | 342 return _blink.Blink_Utils.setInstanceInterceptor($this, customElementClass, cu
stomElement: true); |
372 } | 343 } |
373 | 344 |
374 $else | 345 $else |
375 class DartHtmlDomObject extends NativeFieldWrapperClass2 {} | 346 class DartHtmlDomObject extends NativeFieldWrapperClass2 {} |
376 | 347 |
377 _createCustomUpgrader(Type customElementClass, $this) => $this; | 348 _createCustomUpgrader(Type customElementClass, $this) => $this; |
378 | 349 |
379 $endif | 350 $endif |
OLD | NEW |