| 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 | 5 |
| 6 // Conversions for Window. These check if the window is the local | 6 // Conversions for Window. These check if the window is the local |
| 7 // window, and if it's not, wraps or unwraps it with a secure wrapper. | 7 // window, and if it's not, wraps or unwraps it with a secure wrapper. |
| 8 // We need to test for EventTarget here as well as it's a base type. | 8 // We need to test for EventTarget here as well as it's a base type. |
| 9 // We omit an unwrapper for Window as no methods take a non-local | 9 // We omit an unwrapper for Window as no methods take a non-local |
| 10 // window as a parameter. | 10 // window as a parameter. |
| 11 | 11 |
| 12 part of html; | 12 part of html; |
| 13 | 13 |
| 14 Window _convertNativeToDart_Window(win) { | 14 WindowBase _convertNativeToDart_Window(win) { |
| 15 return _DOMWindowCrossFrame._createSafe(win); | 15 return _DOMWindowCrossFrame._createSafe(win); |
| 16 } | 16 } |
| 17 | 17 |
| 18 EventTarget _convertNativeToDart_EventTarget(e) { | 18 EventTarget _convertNativeToDart_EventTarget(e) { |
| 19 // Assume it's a Window if it contains the setInterval property. It may be | 19 // Assume it's a Window if it contains the setInterval property. It may be |
| 20 // from a different frame - without a patched prototype - so we cannot | 20 // from a different frame - without a patched prototype - so we cannot |
| 21 // rely on Dart type checking. | 21 // rely on Dart type checking. |
| 22 if (JS('bool', r'"setInterval" in #', e)) | 22 if (JS('bool', r'"setInterval" in #', e)) |
| 23 return _DOMWindowCrossFrame._createSafe(e); | 23 return _DOMWindowCrossFrame._createSafe(e); |
| 24 else | 24 else |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // We can get rid of this conversion if _TypedImageData implements the fields | 69 // We can get rid of this conversion if _TypedImageData implements the fields |
| 70 // with native names. | 70 // with native names. |
| 71 _convertDartToNative_ImageData(ImageData imageData) { | 71 _convertDartToNative_ImageData(ImageData imageData) { |
| 72 if (imageData is _TypedImageData) { | 72 if (imageData is _TypedImageData) { |
| 73 return JS('', '{data: #, height: #, width: #}', | 73 return JS('', '{data: #, height: #, width: #}', |
| 74 imageData.data, imageData.height, imageData.width); | 74 imageData.data, imageData.height, imageData.width); |
| 75 } | 75 } |
| 76 return imageData; | 76 return imageData; |
| 77 } | 77 } |
| OLD | NEW |