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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11757002: Fixing ArrayBuffer et al on IE. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
OLDNEW
1 library html; 1 library html;
2 2
3 import 'dart:collection'; 3 import 'dart:collection';
4 import 'dart:html_common'; 4 import 'dart:html_common';
5 import 'dart:indexed_db'; 5 import 'dart:indexed_db';
6 import 'dart:isolate'; 6 import 'dart:isolate';
7 import 'dart:json'; 7 import 'dart:json';
8 import 'dart:math';
8 import 'dart:svg' as svg; 9 import 'dart:svg' as svg;
9 import 'dart:web_audio' as web_audio; 10 import 'dart:web_audio' as web_audio;
10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 11 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
11 // for details. All rights reserved. Use of this source code is governed by a 12 // for details. All rights reserved. Use of this source code is governed by a
12 // BSD-style license that can be found in the LICENSE file. 13 // BSD-style license that can be found in the LICENSE file.
13 14
14 // DO NOT EDIT 15 // DO NOT EDIT
15 // Auto-generated dart:html library. 16 // Auto-generated dart:html library.
16 17
17 18
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 339
339 /// @domName HTMLAreaElement.search; @docsEditable true 340 /// @domName HTMLAreaElement.search; @docsEditable true
340 final String search; 341 final String search;
341 342
342 /// @domName HTMLAreaElement.shape; @docsEditable true 343 /// @domName HTMLAreaElement.shape; @docsEditable true
343 String shape; 344 String shape;
344 345
345 /// @domName HTMLAreaElement.target; @docsEditable true 346 /// @domName HTMLAreaElement.target; @docsEditable true
346 String target; 347 String target;
347 } 348 }
348 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 349 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
349 // for details. All rights reserved. Use of this source code is governed by a 350 // for details. All rights reserved. Use of this source code is governed by a
350 // BSD-style license that can be found in the LICENSE file. 351 // BSD-style license that can be found in the LICENSE file.
351 352
352 353
353 /// @domName ArrayBuffer; @docsEditable true 354 /// @domName ArrayBuffer
355 @SupportedBrowser(SupportedBrowser.CHROME)
356 @SupportedBrowser(SupportedBrowser.FIREFOX)
357 @SupportedBrowser(SupportedBrowser.IE, '10')
358 @SupportedBrowser(SupportedBrowser.SAFARI)
354 class ArrayBuffer native "*ArrayBuffer" { 359 class ArrayBuffer native "*ArrayBuffer" {
355 360
356 ///@docsEditable true 361 ///@docsEditable true
357 factory ArrayBuffer(int length) => ArrayBuffer._create(length); 362 factory ArrayBuffer(int length) => ArrayBuffer._create(length);
358 static ArrayBuffer _create(int length) => JS('ArrayBuffer', 'new ArrayBuffer(# )', length); 363 static ArrayBuffer _create(int length) => JS('ArrayBuffer', 'new ArrayBuffer(# )', length);
359 364
365 /**
366 * Checks if this type is supported on the current platform
367 */
368 static bool get supported => JS('bool', 'typeof window.ArrayBuffer != "undefin ed"');
369
360 /// @domName ArrayBuffer.byteLength; @docsEditable true 370 /// @domName ArrayBuffer.byteLength; @docsEditable true
361 final int byteLength; 371 final int byteLength;
362 372
363 /// @domName ArrayBuffer.slice; @docsEditable true 373 /// @domName ArrayBuffer.slice;
364 ArrayBuffer slice(int begin, [int end]) native; 374 ArrayBuffer slice(int begin, [int end]) {
375 // IE10 supports ArrayBuffers but does not have the slice method.
376 if (JS('bool', '!!#.slice', this)) {
377 if (?end) {
378 return JS('ArrayBuffer', '#.slice(#, #)', this, begin, end);
379 }
380 return JS('ArrayBuffer', '#.slice(#)', this, begin);
381 } else {
382 var start = begin;
383 // Negative values go from end.
384 if (start < 0) {
385 start = this.byteLength + start;
386 }
387 var finish = ?end ? min(end, byteLength) : byteLength;
388 if (finish < 0) {
389 finish = this.byteLength + finish;
390 }
391 var length = max(finish - start, 0);
392
393 var clone = new Int8Array(length);
394 var source = new Int8Array.fromBuffer(this, start);
395 for (var i = 0; i < length; ++i) {
396 clone[i] = source[i];
397 }
398 return clone.buffer;
399 }
400 }
365 } 401 }
366 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 402 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
367 // for details. All rights reserved. Use of this source code is governed by a 403 // for details. All rights reserved. Use of this source code is governed by a
368 // BSD-style license that can be found in the LICENSE file. 404 // BSD-style license that can be found in the LICENSE file.
369 405
370 406
371 /// @domName ArrayBufferView; @docsEditable true 407 /// @domName ArrayBufferView; @docsEditable true
408 @SupportedBrowser(SupportedBrowser.CHROME)
409 @SupportedBrowser(SupportedBrowser.FIREFOX)
410 @SupportedBrowser(SupportedBrowser.IE, '10')
411 @SupportedBrowser(SupportedBrowser.SAFARI)
372 class ArrayBufferView native "*ArrayBufferView" { 412 class ArrayBufferView native "*ArrayBufferView" {
373 413
374 /// @domName ArrayBufferView.buffer; @docsEditable true 414 /// @domName ArrayBufferView.buffer; @docsEditable true
375 final ArrayBuffer buffer; 415 final ArrayBuffer buffer;
376 416
377 /// @domName ArrayBufferView.byteLength; @docsEditable true 417 /// @domName ArrayBufferView.byteLength; @docsEditable true
378 final int byteLength; 418 final int byteLength;
379 419
380 /// @domName ArrayBufferView.byteOffset; @docsEditable true 420 /// @domName ArrayBufferView.byteOffset; @docsEditable true
381 final int byteOffset; 421 final int byteOffset;
(...skipping 25108 matching lines...) Expand 10 before | Expand all | Expand 10 after
25490 T next() { 25530 T next() {
25491 if (!hasNext) { 25531 if (!hasNext) {
25492 throw new StateError("No more elements"); 25532 throw new StateError("No more elements");
25493 } 25533 }
25494 return _array[_pos++]; 25534 return _array[_pos++];
25495 } 25535 }
25496 25536
25497 final List<T> _array; 25537 final List<T> _array;
25498 int _pos; 25538 int _pos;
25499 } 25539 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/native_helper.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698