Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Unified Diff: sdk/lib/html/html_common/conversions.dart

Issue 138663002: Fix for Issue 16069 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/html_common/conversions.dart
diff --git a/sdk/lib/html/html_common/conversions.dart b/sdk/lib/html/html_common/conversions.dart
index 3bd2973a9e1c50d9872f665897e96ec6706578f2..d2d3a45d08549de20cb98b6c491b9bae1a48a389 100644
--- a/sdk/lib/html/html_common/conversions.dart
+++ b/sdk/lib/html/html_common/conversions.dart
@@ -341,15 +341,30 @@ class _TypedImageData implements ImageData {
ImageData convertNativeToDart_ImageData(nativeImageData) {
- // None of the native getters that return ImageData have the type ImageData
- // since that is incorrect for FireFox (which returns a plain Object). So we
- // need something that tells the compiler that the ImageData class has been
- // instantiated.
+ // None of the native getters that return ImageData are declared as returning
+ // [ImageData] since that is incorrect for FireFox, which returns a plain
+ // Object. So we need something that tells the compiler that the ImageData
+ // class has been instantiated.
// TODO(sra): Remove this when all the ImageData returning APIs have been
// annotated as returning the union ImageData + Object.
JS('ImageData', '0');
- if (nativeImageData is ImageData) return nativeImageData;
+ if (nativeImageData is ImageData) {
+
+ // Fix for Issue 16069: on IE, the `data` field is a CanvasPixelArray which
+ // has Array as the constructor property. This interferes with finding the
+ // correct interceptor. Fix it by overwriting the constructor property.
+ var data = nativeImageData.data;
+ if (JS('bool', '#.constructor === Array', data)) {
+ if (JS('bool', 'typeof CanvasPixelArray !== "undefined"')) {
+ JS('void', '#.constructor = CanvasPixelArray', data);
+ // This TypedArray property is missing from CanvasPixelArray.
+ JS('void', '#.BYTES_PER_ELEMENT = 1', data);
+ }
+ }
+
+ return nativeImageData;
+ }
// On Firefox the above test fails because [nativeImageData] is a plain
// object. So we create a _TypedImageData.
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698