| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 // Assume anything else is already a valid Dart object, either by having | 288 // Assume anything else is already a valid Dart object, either by having |
| 289 // already been processed, or e.g. a clonable native class. | 289 // already been processed, or e.g. a clonable native class. |
| 290 return e; | 290 return e; |
| 291 } | 291 } |
| 292 | 292 |
| 293 var copy = walk(object); | 293 var copy = walk(object); |
| 294 return copy; | 294 return copy; |
| 295 } | 295 } |
| 296 | 296 |
| 297 // Conversions for ContextAttributes. |
| 298 // |
| 299 // On Firefox, the returned ContextAttributes is a plain object. |
| 300 class _TypedContextAttributes implements gl.ContextAttributes { |
| 301 bool alpha; |
| 302 bool antialias; |
| 303 bool depth; |
| 304 bool premultipliedAlpha; |
| 305 bool preserveDrawingBuffer; |
| 306 bool stencil; |
| 307 |
| 308 _TypedContextAttributes(this.alpha, this.antialias, this.depth, |
| 309 this.premultipliedAlpha, this.preserveDrawingBuffer, this.stencil); |
| 310 } |
| 311 |
| 312 gl.ContextAttributes convertNativeToDart_ContextAttributes( |
| 313 nativeContextAttributes) { |
| 314 if (nativeContextAttributes is gl.ContextAttributes) { |
| 315 return nativeContextAttributes; |
| 316 } |
| 317 |
| 318 // On Firefox the above test fails because ContextAttributes is a plain |
| 319 // object so we create a _TypedContextAttributes. |
| 320 |
| 321 return new _TypedContextAttributes( |
| 322 JS('var', '#.alpha', nativeContextAttributes), |
| 323 JS('var', '#.antialias', nativeContextAttributes), |
| 324 JS('var', '#.depth', nativeContextAttributes), |
| 325 JS('var', '#.premultipliedAlpha', nativeContextAttributes), |
| 326 JS('var', '#.preserveDrawingBuffer', nativeContextAttributes), |
| 327 JS('var', '#.stencil', nativeContextAttributes)); |
| 328 } |
| 329 |
| 297 // Conversions for ImageData | 330 // Conversions for ImageData |
| 298 // | 331 // |
| 299 // On Firefox, the returned ImageData is a plain object. | 332 // On Firefox, the returned ImageData is a plain object. |
| 300 | 333 |
| 301 class _TypedImageData implements ImageData { | 334 class _TypedImageData implements ImageData { |
| 302 final Uint8ClampedList data; | 335 final Uint8ClampedList data; |
| 303 final int height; | 336 final int height; |
| 304 final int width; | 337 final int width; |
| 305 | 338 |
| 306 _TypedImageData(this.data, this.height, this.width); | 339 _TypedImageData(this.data, this.height, this.width); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 const String _serializedScriptValue = | 384 const String _serializedScriptValue = |
| 352 'num|String|bool|' | 385 'num|String|bool|' |
| 353 'JSExtendableArray|=Object|' | 386 'JSExtendableArray|=Object|' |
| 354 'Blob|File|ByteBuffer|TypedData' | 387 'Blob|File|ByteBuffer|TypedData' |
| 355 // TODO(sra): Add Date, RegExp. | 388 // TODO(sra): Add Date, RegExp. |
| 356 ; | 389 ; |
| 357 const annotation_Creates_SerializedScriptValue = | 390 const annotation_Creates_SerializedScriptValue = |
| 358 const Creates(_serializedScriptValue); | 391 const Creates(_serializedScriptValue); |
| 359 const annotation_Returns_SerializedScriptValue = | 392 const annotation_Returns_SerializedScriptValue = |
| 360 const Returns(_serializedScriptValue); | 393 const Returns(_serializedScriptValue); |
| OLD | NEW |