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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 IDBKey. 6 // Conversions for IDBKey.
7 // 7 //
8 // Per http://www.w3.org/TR/IndexedDB/#key-construct 8 // Per http://www.w3.org/TR/IndexedDB/#key-construct
9 // 9 //
10 // "A value is said to be a valid key if it is one of the following types: Array 10 // "A value is said to be a valid key if it is one of the following types: Array
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 class _TypedImageData implements ImageData { 334 class _TypedImageData implements ImageData {
335 final Uint8ClampedList data; 335 final Uint8ClampedList data;
336 final int height; 336 final int height;
337 final int width; 337 final int width;
338 338
339 _TypedImageData(this.data, this.height, this.width); 339 _TypedImageData(this.data, this.height, this.width);
340 } 340 }
341 341
342 ImageData convertNativeToDart_ImageData(nativeImageData) { 342 ImageData convertNativeToDart_ImageData(nativeImageData) {
343 343
344 // None of the native getters that return ImageData have the type ImageData 344 // None of the native getters that return ImageData are declared as returning
345 // since that is incorrect for FireFox (which returns a plain Object). So we 345 // [ImageData] since that is incorrect for FireFox, which returns a plain
346 // need something that tells the compiler that the ImageData class has been 346 // Object. So we need something that tells the compiler that the ImageData
347 // instantiated. 347 // class has been instantiated.
348 // TODO(sra): Remove this when all the ImageData returning APIs have been 348 // TODO(sra): Remove this when all the ImageData returning APIs have been
349 // annotated as returning the union ImageData + Object. 349 // annotated as returning the union ImageData + Object.
350 JS('ImageData', '0'); 350 JS('ImageData', '0');
351 351
352 if (nativeImageData is ImageData) return nativeImageData; 352 if (nativeImageData is ImageData) {
353
354 // Fix for Issue 16069: on IE, the `data` field is a CanvasPixelArray which
355 // has Array as the constructor property. This interferes with finding the
356 // correct interceptor. Fix it by overwriting the constructor property.
357 var data = nativeImageData.data;
358 if (JS('bool', '#.constructor === Array', data)) {
359 if (JS('bool', 'typeof CanvasPixelArray !== "undefined"')) {
360 JS('void', '#.constructor = CanvasPixelArray', data);
361 // This TypedArray property is missing from CanvasPixelArray.
362 JS('void', '#.BYTES_PER_ELEMENT = 1', data);
363 }
364 }
365
366 return nativeImageData;
367 }
353 368
354 // On Firefox the above test fails because [nativeImageData] is a plain 369 // On Firefox the above test fails because [nativeImageData] is a plain
355 // object. So we create a _TypedImageData. 370 // object. So we create a _TypedImageData.
356 371
357 return new _TypedImageData( 372 return new _TypedImageData(
358 JS('Uint8ClampedList', '#.data', nativeImageData), 373 JS('Uint8ClampedList', '#.data', nativeImageData),
359 JS('var', '#.height', nativeImageData), 374 JS('var', '#.height', nativeImageData),
360 JS('var', '#.width', nativeImageData)); 375 JS('var', '#.width', nativeImageData));
361 } 376 }
362 377
(...skipping 21 matching lines...) Expand all
384 const String _serializedScriptValue = 399 const String _serializedScriptValue =
385 'num|String|bool|' 400 'num|String|bool|'
386 'JSExtendableArray|=Object|' 401 'JSExtendableArray|=Object|'
387 'Blob|File|ByteBuffer|TypedData' 402 'Blob|File|ByteBuffer|TypedData'
388 // TODO(sra): Add Date, RegExp. 403 // TODO(sra): Add Date, RegExp.
389 ; 404 ;
390 const annotation_Creates_SerializedScriptValue = 405 const annotation_Creates_SerializedScriptValue =
391 const Creates(_serializedScriptValue); 406 const Creates(_serializedScriptValue);
392 const annotation_Returns_SerializedScriptValue = 407 const annotation_Returns_SerializedScriptValue =
393 const Returns(_serializedScriptValue); 408 const Returns(_serializedScriptValue);
OLDNEW
« 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