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

Side by Side Diff: sdk/lib/html/html_common/conversions.dart

Issue 41583005: ImageData.data is a Uint8ClampedList (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/scripts/dartmetadata.py » ('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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // None of the native getters that return ImageData have the type ImageData 344 // None of the native getters that return ImageData have the type ImageData
345 // since that is incorrect for FireFox (which returns a plain Object). So we 345 // since that is incorrect for FireFox (which returns a plain Object). So we
346 // need something that tells the compiler that the ImageData class has been 346 // need something that tells the compiler that the ImageData class has been
347 // instantiated. 347 // 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) return nativeImageData;
353 353
354 // On Firefox the above test fails because imagedata is a plain object. 354 // On Firefox the above test fails because [nativeImageData] is a plain
355 // So we create a _TypedImageData. 355 // object. So we create a _TypedImageData.
356 356
357 return new _TypedImageData( 357 return new _TypedImageData(
358 JS('var', '#.data', nativeImageData), 358 JS('Uint8ClampedList', '#.data', nativeImageData),
359 JS('var', '#.height', nativeImageData), 359 JS('var', '#.height', nativeImageData),
360 JS('var', '#.width', nativeImageData)); 360 JS('var', '#.width', nativeImageData));
361 } 361 }
362 362
363 // We can get rid of this conversion if _TypedImageData implements the fields 363 // We can get rid of this conversion if _TypedImageData implements the fields
364 // with native names. 364 // with native names.
365 convertDartToNative_ImageData(ImageData imageData) { 365 convertDartToNative_ImageData(ImageData imageData) {
366 if (imageData is _TypedImageData) { 366 if (imageData is _TypedImageData) {
367 return JS('', '{data: #, height: #, width: #}', 367 return JS('', '{data: #, height: #, width: #}',
368 imageData.data, imageData.height, imageData.width); 368 imageData.data, imageData.height, imageData.width);
(...skipping 15 matching lines...) Expand all
384 const String _serializedScriptValue = 384 const String _serializedScriptValue =
385 'num|String|bool|' 385 'num|String|bool|'
386 'JSExtendableArray|=Object|' 386 'JSExtendableArray|=Object|'
387 'Blob|File|ByteBuffer|TypedData' 387 'Blob|File|ByteBuffer|TypedData'
388 // TODO(sra): Add Date, RegExp. 388 // TODO(sra): Add Date, RegExp.
389 ; 389 ;
390 const annotation_Creates_SerializedScriptValue = 390 const annotation_Creates_SerializedScriptValue =
391 const Creates(_serializedScriptValue); 391 const Creates(_serializedScriptValue);
392 const annotation_Returns_SerializedScriptValue = 392 const annotation_Returns_SerializedScriptValue =
393 const Returns(_serializedScriptValue); 393 const Returns(_serializedScriptValue);
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/scripts/dartmetadata.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698