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 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } | 335 } |
336 } | 336 } |
337 | 337 |
338 return nativeImageData; | 338 return nativeImageData; |
339 } | 339 } |
340 | 340 |
341 // On Firefox the above test fails because [nativeImageData] is a plain | 341 // On Firefox the above test fails because [nativeImageData] is a plain |
342 // object. So we create a _TypedImageData. | 342 // object. So we create a _TypedImageData. |
343 | 343 |
344 return new _TypedImageData( | 344 return new _TypedImageData( |
345 JS('NativeUint8ClampedList', '#.data', nativeImageData), | 345 JS('Uint8ClampedList', '#.data', nativeImageData), |
346 JS('var', '#.height', nativeImageData), | 346 JS('var', '#.height', nativeImageData), |
347 JS('var', '#.width', nativeImageData)); | 347 JS('var', '#.width', nativeImageData)); |
348 } | 348 } |
349 | 349 |
350 // We can get rid of this conversion if _TypedImageData implements the fields | 350 // We can get rid of this conversion if _TypedImageData implements the fields |
351 // with native names. | 351 // with native names. |
352 convertDartToNative_ImageData(ImageData imageData) { | 352 convertDartToNative_ImageData(ImageData imageData) { |
353 if (imageData is _TypedImageData) { | 353 if (imageData is _TypedImageData) { |
354 return JS('', '{data: #, height: #, width: #}', | 354 return JS('', '{data: #, height: #, width: #}', |
355 imageData.data, imageData.height, imageData.width); | 355 imageData.data, imageData.height, imageData.width); |
356 } | 356 } |
357 return imageData; | 357 return imageData; |
358 } | 358 } |
359 | 359 |
360 const String _serializedScriptValue = | 360 const String _serializedScriptValue = |
361 'num|String|bool|' | 361 'num|String|bool|' |
362 'JSExtendableArray|=Object|' | 362 'JSExtendableArray|=Object|' |
363 'Blob|File|NativeByteBuffer|NativeTypedData' | 363 'Blob|File|NativeByteBuffer|NativeTypedData' |
364 // TODO(sra): Add Date, RegExp. | 364 // TODO(sra): Add Date, RegExp. |
365 ; | 365 ; |
366 const annotation_Creates_SerializedScriptValue = | 366 const annotation_Creates_SerializedScriptValue = |
367 const Creates(_serializedScriptValue); | 367 const Creates(_serializedScriptValue); |
368 const annotation_Returns_SerializedScriptValue = | 368 const annotation_Returns_SerializedScriptValue = |
369 const Returns(_serializedScriptValue); | 369 const Returns(_serializedScriptValue); |
OLD | NEW |