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. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } else { | 43 } else { |
44 return e; | 44 return e; |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 // Conversions for ImageData | 48 // Conversions for ImageData |
49 // | 49 // |
50 // On Firefox, the returned ImageData is a plain object. | 50 // On Firefox, the returned ImageData is a plain object. |
51 | 51 |
52 class _TypedImageData implements ImageData { | 52 class _TypedImageData implements ImageData { |
53 final Uint8ClampedArray data; | 53 final Uint8ClampedList data; |
54 final int height; | 54 final int height; |
55 final int width; | 55 final int width; |
56 | 56 |
57 _TypedImageData(this.data, this.height, this.width); | 57 _TypedImageData(this.data, this.height, this.width); |
58 } | 58 } |
59 | 59 |
60 ImageData _convertNativeToDart_ImageData(nativeImageData) { | 60 ImageData _convertNativeToDart_ImageData(nativeImageData) { |
61 | 61 |
62 // None of the native getters that return ImageData have the type ImageData | 62 // None of the native getters that return ImageData have the type ImageData |
63 // since that is incorrect for FireFox (which returns a plain Object). So we | 63 // since that is incorrect for FireFox (which returns a plain Object). So we |
(...skipping 16 matching lines...) Expand all Loading... |
80 | 80 |
81 // We can get rid of this conversion if _TypedImageData implements the fields | 81 // We can get rid of this conversion if _TypedImageData implements the fields |
82 // with native names. | 82 // with native names. |
83 _convertDartToNative_ImageData(ImageData imageData) { | 83 _convertDartToNative_ImageData(ImageData imageData) { |
84 if (imageData is _TypedImageData) { | 84 if (imageData is _TypedImageData) { |
85 return JS('', '{data: #, height: #, width: #}', | 85 return JS('', '{data: #, height: #, width: #}', |
86 imageData.data, imageData.height, imageData.width); | 86 imageData.data, imageData.height, imageData.width); |
87 } | 87 } |
88 return imageData; | 88 return imageData; |
89 } | 89 } |
OLD | NEW |