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

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

Issue 11794031: Fixing FrozenElementList Iterator (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
« no previous file with comments | « no previous file | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library html; 1 library html;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'dart:html_common'; 5 import 'dart:html_common';
6 import 'dart:indexed_db'; 6 import 'dart:indexed_db';
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 import 'dart:json' as json; 8 import 'dart:json' as json;
9 import 'dart:math'; 9 import 'dart:math';
10 import 'dart:svg' as svg; 10 import 'dart:svg' as svg;
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 770
771 /// The height of this canvas element in CSS pixels. 771 /// The height of this canvas element in CSS pixels.
772 /// @domName HTMLCanvasElement.height; @docsEditable true 772 /// @domName HTMLCanvasElement.height; @docsEditable true
773 int height; 773 int height;
774 774
775 /// The width of this canvas element in CSS pixels. 775 /// The width of this canvas element in CSS pixels.
776 /// @domName HTMLCanvasElement.width; @docsEditable true 776 /// @domName HTMLCanvasElement.width; @docsEditable true
777 int width; 777 int width;
778 778
779 /** 779 /**
780 * Returns a data URI containing a representation of the image in the 780 * Returns a data URI containing a representation of the image in the
781 * format specified by type (defaults to 'image/png'). 781 * format specified by type (defaults to 'image/png').
782 * 782 *
783 * Data Uri format is as follow `data:[<MIME-type>][;charset=<encoding>][;base 64],<data>` 783 * Data Uri format is as follow `data:[<MIME-type>][;charset=<encoding>][;base 64],<data>`
784 * 784 *
785 * Optional parameter [quality] in the range of 0.0 and 1.0 can be used when r equesting [type] 785 * Optional parameter [quality] in the range of 0.0 and 1.0 can be used when r equesting [type]
786 * 'image/jpeg' or 'image/webp'. If [quality] is not passed the default 786 * 'image/jpeg' or 'image/webp'. If [quality] is not passed the default
787 * value is used. Note: the default value varies by browser. 787 * value is used. Note: the default value varies by browser.
788 * 788 *
789 * If the height or width of this canvas element is 0, then 'data:' is returne d, 789 * If the height or width of this canvas element is 0, then 'data:' is returne d,
790 * representing no data. 790 * representing no data.
791 * 791 *
792 * If the type requested is not 'image/png', and the returned value is 792 * If the type requested is not 'image/png', and the returned value is
793 * 'data:image/png', then the requested type is not supported. 793 * 'data:image/png', then the requested type is not supported.
794 * 794 *
795 * Example usage: 795 * Example usage:
796 * 796 *
797 * CanvasElement canvas = new CanvasElement(); 797 * CanvasElement canvas = new CanvasElement();
798 * var ctx = canvas.context2d 798 * var ctx = canvas.context2d
799 * ..fillStyle = "rgb(200,0,0)" 799 * ..fillStyle = "rgb(200,0,0)"
800 * ..fillRect(10, 10, 55, 50); 800 * ..fillRect(10, 10, 55, 50);
801 * var dataUrl = canvas.toDataURL("image/jpeg", 0.95); 801 * var dataUrl = canvas.toDataURL("image/jpeg", 0.95);
802 * // The Data Uri would look similar to 802 * // The Data Uri would look similar to
803 * // 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA 803 * // 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
804 * // AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 804 * // AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
805 * // 9TXL0Y4OHwAAAABJRU5ErkJggg==' 805 * // 9TXL0Y4OHwAAAABJRU5ErkJggg=='
806 * //Create a new image element from the data URI. 806 * //Create a new image element from the data URI.
807 * var img = new ImageElement(); 807 * var img = new ImageElement();
808 * img.src = dataUrl; 808 * img.src = dataUrl;
809 * document.body.children.add(img); 809 * document.body.children.add(img);
810 * 810 *
811 * See also: 811 * See also:
812 * 812 *
813 * * [Data URI Scheme](http://en.wikipedia.org/wiki/Data_URI_scheme) from Wiki pedia. 813 * * [Data URI Scheme](http://en.wikipedia.org/wiki/Data_URI_scheme) from Wiki pedia.
814 * 814 *
815 * * [HTMLCanvasElement](https://developer.mozilla.org/en-US/docs/DOM/HTMLCanv asElement) from MDN. 815 * * [HTMLCanvasElement](https://developer.mozilla.org/en-US/docs/DOM/HTMLCanv asElement) from MDN.
816 * 816 *
817 * * [toDataUrl](http://dev.w3.org/html5/spec/the-canvas-element.html#dom-canv as-todataurl) from W3C. 817 * * [toDataUrl](http://dev.w3.org/html5/spec/the-canvas-element.html#dom-canv as-todataurl) from W3C.
818 */ 818 */
819 /// @domName HTMLCanvasElement.toDataURL; @docsEditable true 819 /// @domName HTMLCanvasElement.toDataURL; @docsEditable true
820 @JSName('toDataURL') 820 @JSName('toDataURL')
821 String toDataUrl(String type, [num quality]) native; 821 String toDataUrl(String type, [num quality]) native;
822 822
823 823
824 CanvasRenderingContext getContext(String contextId) native; 824 CanvasRenderingContext getContext(String contextId) native;
825 CanvasRenderingContext2D get context2d => getContext('2d'); 825 CanvasRenderingContext2D get context2d => getContext('2d');
826 } 826 }
(...skipping 6687 matching lines...) Expand 10 before | Expand all | Expand 10 after
7514 return _Collections.minInList(this, compare); 7514 return _Collections.minInList(this, compare);
7515 } 7515 }
7516 7516
7517 Element max([int compare(Element a, Element b)]) { 7517 Element max([int compare(Element a, Element b)]) {
7518 return _Collections.maxInList(this, compare); 7518 return _Collections.maxInList(this, compare);
7519 } 7519 }
7520 } 7520 }
7521 7521
7522 class _FrozenElementListIterator implements Iterator<Element> { 7522 class _FrozenElementListIterator implements Iterator<Element> {
7523 final _FrozenElementList _list; 7523 final _FrozenElementList _list;
7524 int _index = 0; 7524 int _index = -1;
7525 Element _current; 7525 Element _current;
7526 7526
7527 _FrozenElementListIterator(this._list); 7527 _FrozenElementListIterator(this._list);
7528 7528
7529 /** 7529 /**
7530 * Moves to the next element. Returns true if the iterator is positioned 7530 * Moves to the next element. Returns true if the iterator is positioned
7531 * at an element. Returns false if it is positioned after the last element. 7531 * at an element. Returns false if it is positioned after the last element.
7532 */ 7532 */
7533 bool moveNext() { 7533 bool moveNext() {
7534 int nextIndex = _index + 1; 7534 int nextIndex = _index + 1;
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
8783 // for details. All rights reserved. Use of this source code is governed by a 8783 // for details. All rights reserved. Use of this source code is governed by a
8784 // BSD-style license that can be found in the LICENSE file. 8784 // BSD-style license that can be found in the LICENSE file.
8785 8785
8786 8786
8787 /** 8787 /**
8788 * Base class that supports listening for and dispatching browser events. 8788 * Base class that supports listening for and dispatching browser events.
8789 * 8789 *
8790 * Events can either be accessed by string name (using the indexed getter) or by 8790 * Events can either be accessed by string name (using the indexed getter) or by
8791 * getters exposed by subclasses. Use the getters exposed by subclasses when 8791 * getters exposed by subclasses. Use the getters exposed by subclasses when
8792 * possible for better compile-time type checks. 8792 * possible for better compile-time type checks.
8793 * 8793 *
8794 * Using an indexed getter: 8794 * Using an indexed getter:
8795 * events['mouseover'].add((e) => print("Mouse over!")); 8795 * events['mouseover'].add((e) => print("Mouse over!"));
8796 * 8796 *
8797 * Using a getter provided by a subclass: 8797 * Using a getter provided by a subclass:
8798 * elementEvents.mouseOver.add((e) => print("Mouse over!")); 8798 * elementEvents.mouseOver.add((e) => print("Mouse over!"));
8799 */ 8799 */
8800 class Events { 8800 class Events {
8801 /* Raw event target. */ 8801 /* Raw event target. */
8802 final EventTarget _ptr; 8802 final EventTarget _ptr;
8803 8803
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
8846 } 8846 }
8847 8847
8848 /// @domName EventTarget 8848 /// @domName EventTarget
8849 /** 8849 /**
8850 * Base class for all browser objects that support events. 8850 * Base class for all browser objects that support events.
8851 * 8851 *
8852 * Use the [on] property to add, remove, and dispatch events (rather than 8852 * Use the [on] property to add, remove, and dispatch events (rather than
8853 * [$dom_addEventListener], [$dom_dispatchEvent], and 8853 * [$dom_addEventListener], [$dom_dispatchEvent], and
8854 * [$dom_removeEventListener]) for compile-time type checks and a more concise 8854 * [$dom_removeEventListener]) for compile-time type checks and a more concise
8855 * API. 8855 * API.
8856 */ 8856 */
8857 class EventTarget native "*EventTarget" { 8857 class EventTarget native "*EventTarget" {
8858 8858
8859 /** @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent */ 8859 /** @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent */
8860 Events get on => new Events(this); 8860 Events get on => new Events(this);
8861 8861
8862 /// @domName EventTarget.addEventListener; @docsEditable true 8862 /// @domName EventTarget.addEventListener; @docsEditable true
8863 @JSName('addEventListener') 8863 @JSName('addEventListener')
8864 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native; 8864 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native;
8865 8865
8866 /// @domName EventTarget.dispatchEvent; @docsEditable true 8866 /// @domName EventTarget.dispatchEvent; @docsEditable true
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
9477 9477
9478 /// @domName Float32Array; @docsEditable true 9478 /// @domName Float32Array; @docsEditable true
9479 class Float32Array extends ArrayBufferView implements JavaScriptIndexingBehavior , List<num> native "*Float32Array" { 9479 class Float32Array extends ArrayBufferView implements JavaScriptIndexingBehavior , List<num> native "*Float32Array" {
9480 9480
9481 factory Float32Array(int length) => 9481 factory Float32Array(int length) =>
9482 _TypedArrayFactoryProvider.createFloat32Array(length); 9482 _TypedArrayFactoryProvider.createFloat32Array(length);
9483 9483
9484 factory Float32Array.fromList(List<num> list) => 9484 factory Float32Array.fromList(List<num> list) =>
9485 _TypedArrayFactoryProvider.createFloat32Array_fromList(list); 9485 _TypedArrayFactoryProvider.createFloat32Array_fromList(list);
9486 9486
9487 factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => 9487 factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) =>
9488 _TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset, length); 9488 _TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset, length);
9489 9489
9490 static const int BYTES_PER_ELEMENT = 4; 9490 static const int BYTES_PER_ELEMENT = 4;
9491 9491
9492 /// @domName Float32Array.length; @docsEditable true 9492 /// @domName Float32Array.length; @docsEditable true
9493 int get length => JS("int", "#.length", this); 9493 int get length => JS("int", "#.length", this);
9494 9494
9495 num operator[](int index) => JS("num", "#[#]", this, index); 9495 num operator[](int index) => JS("num", "#[#]", this, index);
9496 9496
9497 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins. 9497 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
9648 9648
9649 /// @domName Float64Array; @docsEditable true 9649 /// @domName Float64Array; @docsEditable true
9650 class Float64Array extends ArrayBufferView implements JavaScriptIndexingBehavior , List<num> native "*Float64Array" { 9650 class Float64Array extends ArrayBufferView implements JavaScriptIndexingBehavior , List<num> native "*Float64Array" {
9651 9651
9652 factory Float64Array(int length) => 9652 factory Float64Array(int length) =>
9653 _TypedArrayFactoryProvider.createFloat64Array(length); 9653 _TypedArrayFactoryProvider.createFloat64Array(length);
9654 9654
9655 factory Float64Array.fromList(List<num> list) => 9655 factory Float64Array.fromList(List<num> list) =>
9656 _TypedArrayFactoryProvider.createFloat64Array_fromList(list); 9656 _TypedArrayFactoryProvider.createFloat64Array_fromList(list);
9657 9657
9658 factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => 9658 factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) =>
9659 _TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset, length); 9659 _TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset, length);
9660 9660
9661 static const int BYTES_PER_ELEMENT = 8; 9661 static const int BYTES_PER_ELEMENT = 8;
9662 9662
9663 /// @domName Float64Array.length; @docsEditable true 9663 /// @domName Float64Array.length; @docsEditable true
9664 int get length => JS("int", "#.length", this); 9664 int get length => JS("int", "#.length", this);
9665 9665
9666 num operator[](int index) => JS("num", "#[#]", this, index); 9666 num operator[](int index) => JS("num", "#[#]", this, index);
9667 9667
9668 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins. 9668 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins.
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
10656 /// @domName HTMLOptionsCollection.remove; @docsEditable true 10656 /// @domName HTMLOptionsCollection.remove; @docsEditable true
10657 void remove(int index) native; 10657 void remove(int index) native;
10658 } 10658 }
10659 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 10659 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
10660 // for details. All rights reserved. Use of this source code is governed by a 10660 // for details. All rights reserved. Use of this source code is governed by a
10661 // BSD-style license that can be found in the LICENSE file. 10661 // BSD-style license that can be found in the LICENSE file.
10662 10662
10663 10663
10664 /** 10664 /**
10665 * A utility for retrieving data from a URL. 10665 * A utility for retrieving data from a URL.
10666 * 10666 *
10667 * HttpRequest can be used to obtain data from http, ftp, and file 10667 * HttpRequest can be used to obtain data from http, ftp, and file
10668 * protocols. 10668 * protocols.
10669 * 10669 *
10670 * For example, suppose we're developing these API docs, and we 10670 * For example, suppose we're developing these API docs, and we
10671 * wish to retrieve the HTML of the top-level page and print it out. 10671 * wish to retrieve the HTML of the top-level page and print it out.
10672 * The easiest way to do that would be: 10672 * The easiest way to do that would be:
10673 * 10673 *
10674 * var httpRequest = HttpRequest.get('http://api.dartlang.org', 10674 * var httpRequest = HttpRequest.get('http://api.dartlang.org',
10675 * (request) => print(request.responseText)); 10675 * (request) => print(request.responseText));
10676 * 10676 *
10677 * **Important**: With the default behavior of this class, your 10677 * **Important**: With the default behavior of this class, your
10678 * code making the request should be served from the same origin (domain name, 10678 * code making the request should be served from the same origin (domain name,
10679 * port, and application layer protocol) as the URL you are trying to access 10679 * port, and application layer protocol) as the URL you are trying to access
10680 * with HttpRequest. However, there are ways to 10680 * with HttpRequest. However, there are ways to
10681 * [get around this restriction](http://www.dartlang.org/articles/json-web-servi ce/#note-on-jsonp). 10681 * [get around this restriction](http://www.dartlang.org/articles/json-web-servi ce/#note-on-jsonp).
10682 * 10682 *
10683 * See also: 10683 * See also:
10684 * 10684 *
10685 * * [Dart article on using HttpRequests](http://www.dartlang.org/articles/json- web-service/#getting-data) 10685 * * [Dart article on using HttpRequests](http://www.dartlang.org/articles/json- web-service/#getting-data)
10686 * * [JS XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpReq uest) 10686 * * [JS XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpReq uest)
10687 * * [Using XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttp Request/Using_XMLHttpRequest) 10687 * * [Using XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttp Request/Using_XMLHttpRequest)
10688 */ 10688 */
10689 /// @domName XMLHttpRequest 10689 /// @domName XMLHttpRequest
10690 class HttpRequest extends EventTarget native "*XMLHttpRequest" { 10690 class HttpRequest extends EventTarget native "*XMLHttpRequest" {
10691 /** 10691 /**
10692 * Creates a URL get request for the specified `url`. 10692 * Creates a URL get request for the specified `url`.
10693 * 10693 *
10694 * After completing the request, the object will call the user-provided 10694 * After completing the request, the object will call the user-provided
10695 * [onComplete] callback. 10695 * [onComplete] callback.
10696 */ 10696 */
10697 factory HttpRequest.get(String url, onComplete(HttpRequest request)) => 10697 factory HttpRequest.get(String url, onComplete(HttpRequest request)) =>
10698 _HttpRequestUtils.get(url, onComplete, false); 10698 _HttpRequestUtils.get(url, onComplete, false);
10699 10699
10700 // 80 char issue for comments in lists: dartbug.com/7588. 10700 // 80 char issue for comments in lists: dartbug.com/7588.
10701 /** 10701 /**
10702 * Creates a URL GET request for the specified `url` with 10702 * Creates a URL GET request for the specified `url` with
10703 * credentials such a cookie (already) set in the header or 10703 * credentials such a cookie (already) set in the header or
10704 * [authorization headers](http://tools.ietf.org/html/rfc1945#section-10.2). 10704 * [authorization headers](http://tools.ietf.org/html/rfc1945#section-10.2).
10705 * 10705 *
10706 * After completing the request, the object will call the user-provided 10706 * After completing the request, the object will call the user-provided
10707 * [onComplete] callback. 10707 * [onComplete] callback.
10708 * 10708 *
10709 * A few other details to keep in mind when using credentials: 10709 * A few other details to keep in mind when using credentials:
10710 * 10710 *
10711 * * Using credentials is only useful for cross-origin requests. 10711 * * Using credentials is only useful for cross-origin requests.
10712 * * The `Access-Control-Allow-Origin` header of `url` cannot contain a wildca rd (*). 10712 * * The `Access-Control-Allow-Origin` header of `url` cannot contain a wildca rd (*).
10713 * * The `Access-Control-Allow-Credentials` header of `url` must be set to tru e. 10713 * * The `Access-Control-Allow-Credentials` header of `url` must be set to tru e.
10714 * * If `Access-Control-Expose-Headers` has not been set to true, only a subse t of all the response headers will be returned when calling [getAllRequestHeader s]. 10714 * * If `Access-Control-Expose-Headers` has not been set to true, only a subse t of all the response headers will be returned when calling [getAllRequestHeader s].
10715 * 10715 *
10716 * See also: [authorization headers](http://en.wikipedia.org/wiki/Basic_access _authentication). 10716 * See also: [authorization headers](http://en.wikipedia.org/wiki/Basic_access _authentication).
10717 */ 10717 */
10718 factory HttpRequest.getWithCredentials(String url, 10718 factory HttpRequest.getWithCredentials(String url,
10719 onComplete(HttpRequest request)) => 10719 onComplete(HttpRequest request)) =>
10720 _HttpRequestUtils.get(url, onComplete, true); 10720 _HttpRequestUtils.get(url, onComplete, true);
10721 10721
10722 10722
10723 ///@docsEditable true 10723 ///@docsEditable true
10724 factory HttpRequest() => HttpRequest._create(); 10724 factory HttpRequest() => HttpRequest._create();
10725 static HttpRequest _create() => JS('HttpRequest', 'new XMLHttpRequest()'); 10725 static HttpRequest _create() => JS('HttpRequest', 'new XMLHttpRequest()');
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
10775 * </tr> 10775 * </tr>
10776 * </table> 10776 * </table>
10777 */ 10777 */
10778 /// @domName XMLHttpRequest.readyState; @docsEditable true 10778 /// @domName XMLHttpRequest.readyState; @docsEditable true
10779 final int readyState; 10779 final int readyState;
10780 10780
10781 /** 10781 /**
10782 * The data received as a reponse from the request. 10782 * The data received as a reponse from the request.
10783 * 10783 *
10784 * The data could be in the 10784 * The data could be in the
10785 * form of a [String], [ArrayBuffer], [Document], [Blob], or json (also a 10785 * form of a [String], [ArrayBuffer], [Document], [Blob], or json (also a
10786 * [String]). `null` indicates request failure. 10786 * [String]). `null` indicates request failure.
10787 */ 10787 */
10788 /// @domName XMLHttpRequest.response; @docsEditable true 10788 /// @domName XMLHttpRequest.response; @docsEditable true
10789 @Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num') 10789 @Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num')
10790 final Object response; 10790 final Object response;
10791 10791
10792 /** 10792 /**
10793 * The response in string form or null on failure. 10793 * The response in string form or null on failure.
10794 */ 10794 */
10795 /// @domName XMLHttpRequest.responseText; @docsEditable true 10795 /// @domName XMLHttpRequest.responseText; @docsEditable true
10796 final String responseText; 10796 final String responseText;
10797 10797
10798 /** 10798 /**
10799 * [String] telling the server the desired response format. 10799 * [String] telling the server the desired response format.
10800 * 10800 *
10801 * Default is `String`. 10801 * Default is `String`.
10802 * Other options are one of 'arraybuffer', 'blob', 'document', 'json', 10802 * Other options are one of 'arraybuffer', 'blob', 'document', 'json',
10803 * 'text'. Some newer browsers will throw `NS_ERROR_DOM_INVALID_ACCESS_ERR` if 10803 * 'text'. Some newer browsers will throw `NS_ERROR_DOM_INVALID_ACCESS_ERR` if
10804 * `responseType` is set while performing a synchronous request. 10804 * `responseType` is set while performing a synchronous request.
10805 * 10805 *
10806 * See also: [MDN responseType](https://developer.mozilla.org/en-US/docs/DOM/X MLHttpRequest#responseType) 10806 * See also: [MDN responseType](https://developer.mozilla.org/en-US/docs/DOM/X MLHttpRequest#responseType)
10807 */ 10807 */
10808 /// @domName XMLHttpRequest.responseType; @docsEditable true 10808 /// @domName XMLHttpRequest.responseType; @docsEditable true
10809 String responseType; 10809 String responseType;
10810 10810
10811 /** 10811 /**
10812 * The request response, or null on failure. 10812 * The request response, or null on failure.
10813 * 10813 *
10814 * The response is processed as 10814 * The response is processed as
10815 * `text/xml` stream, unless responseType = 'document' and the request is 10815 * `text/xml` stream, unless responseType = 'document' and the request is
10816 * synchronous. 10816 * synchronous.
10817 */ 10817 */
10818 /// @domName XMLHttpRequest.responseXML; @docsEditable true 10818 /// @domName XMLHttpRequest.responseXML; @docsEditable true
10819 @JSName('responseXML') 10819 @JSName('responseXML')
10820 final Document responseXml; 10820 final Document responseXml;
10821 10821
10822 /** 10822 /**
10823 * The http result code from the request (200, 404, etc). 10823 * The http result code from the request (200, 404, etc).
(...skipping 11 matching lines...) Expand all
10835 10835
10836 /** 10836 /**
10837 * [EventTarget] that can hold listeners to track the progress of the request. 10837 * [EventTarget] that can hold listeners to track the progress of the request.
10838 * The events fired will be members of [HttpRequestUploadEvents]. 10838 * The events fired will be members of [HttpRequestUploadEvents].
10839 */ 10839 */
10840 /// @domName XMLHttpRequest.upload; @docsEditable true 10840 /// @domName XMLHttpRequest.upload; @docsEditable true
10841 final HttpRequestUpload upload; 10841 final HttpRequestUpload upload;
10842 10842
10843 /** 10843 /**
10844 * True if cross-site requests should use credentials such as cookies 10844 * True if cross-site requests should use credentials such as cookies
10845 * or authorization headers; false otherwise. 10845 * or authorization headers; false otherwise.
10846 * 10846 *
10847 * This value is ignored for same-site requests. 10847 * This value is ignored for same-site requests.
10848 */ 10848 */
10849 /// @domName XMLHttpRequest.withCredentials; @docsEditable true 10849 /// @domName XMLHttpRequest.withCredentials; @docsEditable true
10850 bool withCredentials; 10850 bool withCredentials;
10851 10851
10852 /** 10852 /**
10853 * Stop the current request. 10853 * Stop the current request.
10854 * 10854 *
10855 * The request can only be stopped if readyState is `HEADERS_RECIEVED` or 10855 * The request can only be stopped if readyState is `HEADERS_RECIEVED` or
10856 * `LOADING`. If this method is not in the process of being sent, the method 10856 * `LOADING`. If this method is not in the process of being sent, the method
10857 * has no effect. 10857 * has no effect.
10858 */ 10858 */
10859 /// @domName XMLHttpRequest.abort; @docsEditable true 10859 /// @domName XMLHttpRequest.abort; @docsEditable true
10860 void abort() native; 10860 void abort() native;
10861 10861
10862 /// @domName XMLHttpRequest.addEventListener; @docsEditable true 10862 /// @domName XMLHttpRequest.addEventListener; @docsEditable true
10863 @JSName('addEventListener') 10863 @JSName('addEventListener')
10864 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native; 10864 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native;
10865 10865
10866 /// @domName XMLHttpRequest.dispatchEvent; @docsEditable true 10866 /// @domName XMLHttpRequest.dispatchEvent; @docsEditable true
10867 @JSName('dispatchEvent') 10867 @JSName('dispatchEvent')
10868 bool $dom_dispatchEvent(Event evt) native; 10868 bool $dom_dispatchEvent(Event evt) native;
10869 10869
10870 /** 10870 /**
10871 * Retrieve all the response headers from a request. 10871 * Retrieve all the response headers from a request.
10872 * 10872 *
10873 * `null` if no headers have been received. For multipart requests, 10873 * `null` if no headers have been received. For multipart requests,
10874 * `getAllResponseHeaders` will return the response headers for the current 10874 * `getAllResponseHeaders` will return the response headers for the current
10875 * part of the request. 10875 * part of the request.
10876 * 10876 *
10877 * See also [HTTP response headers](http://en.wikipedia.org/wiki/List_of_HTTP_ header_fields#Responses) 10877 * See also [HTTP response headers](http://en.wikipedia.org/wiki/List_of_HTTP_ header_fields#Responses)
10878 * for a list of common response headers. 10878 * for a list of common response headers.
10879 */ 10879 */
10880 /// @domName XMLHttpRequest.getAllResponseHeaders; @docsEditable true 10880 /// @domName XMLHttpRequest.getAllResponseHeaders; @docsEditable true
10881 String getAllResponseHeaders() native; 10881 String getAllResponseHeaders() native;
10882 10882
10883 /** 10883 /**
10884 * Return the response header named `header`, or `null` if not found. 10884 * Return the response header named `header`, or `null` if not found.
10885 * 10885 *
10886 * See also [HTTP response headers](http://en.wikipedia.org/wiki/List_of_HTTP_ header_fields#Responses) 10886 * See also [HTTP response headers](http://en.wikipedia.org/wiki/List_of_HTTP_ header_fields#Responses)
10887 * for a list of common response headers. 10887 * for a list of common response headers.
10888 */ 10888 */
10889 /// @domName XMLHttpRequest.getResponseHeader; @docsEditable true 10889 /// @domName XMLHttpRequest.getResponseHeader; @docsEditable true
10890 String getResponseHeader(String header) native; 10890 String getResponseHeader(String header) native;
10891 10891
10892 /** 10892 /**
10893 * Specify the desired `url`, and `method` to use in making the request. 10893 * Specify the desired `url`, and `method` to use in making the request.
10894 * 10894 *
10895 * By default the request is done asyncronously, with no user or password 10895 * By default the request is done asyncronously, with no user or password
10896 * authentication information. If `async` is false, the request will be send 10896 * authentication information. If `async` is false, the request will be send
10897 * synchronously. 10897 * synchronously.
10898 * 10898 *
10899 * Calling `open` again on a currently active request is equivalent to 10899 * Calling `open` again on a currently active request is equivalent to
10900 * calling `abort`. 10900 * calling `abort`.
10901 */ 10901 */
10902 /// @domName XMLHttpRequest.open; @docsEditable true 10902 /// @domName XMLHttpRequest.open; @docsEditable true
10903 void open(String method, String url, [bool async, String user, String password ]) native; 10903 void open(String method, String url, [bool async, String user, String password ]) native;
10904 10904
10905 /** 10905 /**
10906 * Specify a particular MIME type (such as `text/xml`) desired for the 10906 * Specify a particular MIME type (such as `text/xml`) desired for the
10907 * response. 10907 * response.
10908 * 10908 *
10909 * This value must be set before the request has been sent. See also the list 10909 * This value must be set before the request has been sent. See also the list
10910 * of [common MIME types](http://en.wikipedia.org/wiki/Internet_media_type#Lis t_of_common_media_types) 10910 * of [common MIME types](http://en.wikipedia.org/wiki/Internet_media_type#Lis t_of_common_media_types)
10911 */ 10911 */
10912 /// @domName XMLHttpRequest.overrideMimeType; @docsEditable true 10912 /// @domName XMLHttpRequest.overrideMimeType; @docsEditable true
10913 void overrideMimeType(String override) native; 10913 void overrideMimeType(String override) native;
10914 10914
10915 /// @domName XMLHttpRequest.removeEventListener; @docsEditable true 10915 /// @domName XMLHttpRequest.removeEventListener; @docsEditable true
10916 @JSName('removeEventListener') 10916 @JSName('removeEventListener')
10917 void $dom_removeEventListener(String type, EventListener listener, [bool useCa pture]) native; 10917 void $dom_removeEventListener(String type, EventListener listener, [bool useCa pture]) native;
10918 10918
10919 /** 10919 /**
10920 * Send the request with any given `data`. 10920 * Send the request with any given `data`.
10921 * 10921 *
10922 * See also: 10922 * See also:
10923 * [send() docs](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#s end()) 10923 * [send() docs](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#s end())
10924 * from MDN. 10924 * from MDN.
10925 */ 10925 */
10926 /// @domName XMLHttpRequest.send; @docsEditable true 10926 /// @domName XMLHttpRequest.send; @docsEditable true
10927 void send([data]) native; 10927 void send([data]) native;
10928 10928
10929 /** Sets HTTP `header` to `value`. */ 10929 /** Sets HTTP `header` to `value`. */
10930 /// @domName XMLHttpRequest.setRequestHeader; @docsEditable true 10930 /// @domName XMLHttpRequest.setRequestHeader; @docsEditable true
10931 void setRequestHeader(String header, String value) native; 10931 void setRequestHeader(String header, String value) native;
10932 10932
10933 } 10933 }
10934 10934
10935 /** 10935 /**
10936 * A class that supports listening for and dispatching events that can fire when 10936 * A class that supports listening for and dispatching events that can fire when
10937 * making an HTTP request. 10937 * making an HTTP request.
10938 * 10938 *
10939 * Here's an example of adding an event handler that executes once an HTTP 10939 * Here's an example of adding an event handler that executes once an HTTP
10940 * request has fully loaded: 10940 * request has fully loaded:
10941 * 10941 *
10942 * httpRequest.on.loadEnd.add((e) => myCustomLoadEndHandler(e)); 10942 * httpRequest.on.loadEnd.add((e) => myCustomLoadEndHandler(e));
10943 * 10943 *
10944 * Each property of this class is a read-only pointer to an [EventListenerList]. 10944 * Each property of this class is a read-only pointer to an [EventListenerList].
10945 * That list holds all of the [EventListener]s that have registered for that 10945 * That list holds all of the [EventListener]s that have registered for that
10946 * particular type of event that fires from an HttpRequest. 10946 * particular type of event that fires from an HttpRequest.
10947 */ 10947 */
10948 /// @docsEditable true 10948 /// @docsEditable true
10949 class HttpRequestEvents extends Events { 10949 class HttpRequestEvents extends Events {
10950 /// @docsEditable true 10950 /// @docsEditable true
10951 HttpRequestEvents(EventTarget _ptr) : super(_ptr); 10951 HttpRequestEvents(EventTarget _ptr) : super(_ptr);
(...skipping 27 matching lines...) Expand all
10979 EventListenerList get loadEnd => this['loadend']; 10979 EventListenerList get loadEnd => this['loadend'];
10980 10980
10981 /** 10981 /**
10982 * Event listeners to be notified when the request starts, once 10982 * Event listeners to be notified when the request starts, once
10983 * `httpRequest.send()` has been called. 10983 * `httpRequest.send()` has been called.
10984 */ 10984 */
10985 /// @docsEditable true 10985 /// @docsEditable true
10986 EventListenerList get loadStart => this['loadstart']; 10986 EventListenerList get loadStart => this['loadstart'];
10987 10987
10988 /** 10988 /**
10989 * Event listeners to be notified when data for the request 10989 * Event listeners to be notified when data for the request
10990 * is being sent or loaded. 10990 * is being sent or loaded.
10991 * 10991 *
10992 * Progress events are fired every 50ms or for every byte transmitted, 10992 * Progress events are fired every 50ms or for every byte transmitted,
10993 * whichever is less frequent. 10993 * whichever is less frequent.
10994 */ 10994 */
10995 /// @docsEditable true 10995 /// @docsEditable true
10996 EventListenerList get progress => this['progress']; 10996 EventListenerList get progress => this['progress'];
10997 10997
10998 /** 10998 /**
10999 * Event listeners to be notified every time the [HttpRequest] 10999 * Event listeners to be notified every time the [HttpRequest]
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
12016 12016
12017 /// @domName Int16Array; @docsEditable true 12017 /// @domName Int16Array; @docsEditable true
12018 class Int16Array extends ArrayBufferView implements JavaScriptIndexingBehavior, List<int> native "*Int16Array" { 12018 class Int16Array extends ArrayBufferView implements JavaScriptIndexingBehavior, List<int> native "*Int16Array" {
12019 12019
12020 factory Int16Array(int length) => 12020 factory Int16Array(int length) =>
12021 _TypedArrayFactoryProvider.createInt16Array(length); 12021 _TypedArrayFactoryProvider.createInt16Array(length);
12022 12022
12023 factory Int16Array.fromList(List<int> list) => 12023 factory Int16Array.fromList(List<int> list) =>
12024 _TypedArrayFactoryProvider.createInt16Array_fromList(list); 12024 _TypedArrayFactoryProvider.createInt16Array_fromList(list);
12025 12025
12026 factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => 12026 factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) =>
12027 _TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, l ength); 12027 _TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, l ength);
12028 12028
12029 static const int BYTES_PER_ELEMENT = 2; 12029 static const int BYTES_PER_ELEMENT = 2;
12030 12030
12031 /// @domName Int16Array.length; @docsEditable true 12031 /// @domName Int16Array.length; @docsEditable true
12032 int get length => JS("int", "#.length", this); 12032 int get length => JS("int", "#.length", this);
12033 12033
12034 int operator[](int index) => JS("int", "#[#]", this, index); 12034 int operator[](int index) => JS("int", "#[#]", this, index);
12035 12035
12036 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 12036 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
12187 12187
12188 /// @domName Int32Array; @docsEditable true 12188 /// @domName Int32Array; @docsEditable true
12189 class Int32Array extends ArrayBufferView implements JavaScriptIndexingBehavior, List<int> native "*Int32Array" { 12189 class Int32Array extends ArrayBufferView implements JavaScriptIndexingBehavior, List<int> native "*Int32Array" {
12190 12190
12191 factory Int32Array(int length) => 12191 factory Int32Array(int length) =>
12192 _TypedArrayFactoryProvider.createInt32Array(length); 12192 _TypedArrayFactoryProvider.createInt32Array(length);
12193 12193
12194 factory Int32Array.fromList(List<int> list) => 12194 factory Int32Array.fromList(List<int> list) =>
12195 _TypedArrayFactoryProvider.createInt32Array_fromList(list); 12195 _TypedArrayFactoryProvider.createInt32Array_fromList(list);
12196 12196
12197 factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => 12197 factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) =>
12198 _TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, l ength); 12198 _TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, l ength);
12199 12199
12200 static const int BYTES_PER_ELEMENT = 4; 12200 static const int BYTES_PER_ELEMENT = 4;
12201 12201
12202 /// @domName Int32Array.length; @docsEditable true 12202 /// @domName Int32Array.length; @docsEditable true
12203 int get length => JS("int", "#.length", this); 12203 int get length => JS("int", "#.length", this);
12204 12204
12205 int operator[](int index) => JS("int", "#[#]", this, index); 12205 int operator[](int index) => JS("int", "#[#]", this, index);
12206 12206
12207 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 12207 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
12358 12358
12359 /// @domName Int8Array; @docsEditable true 12359 /// @domName Int8Array; @docsEditable true
12360 class Int8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, L ist<int> native "*Int8Array" { 12360 class Int8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, L ist<int> native "*Int8Array" {
12361 12361
12362 factory Int8Array(int length) => 12362 factory Int8Array(int length) =>
12363 _TypedArrayFactoryProvider.createInt8Array(length); 12363 _TypedArrayFactoryProvider.createInt8Array(length);
12364 12364
12365 factory Int8Array.fromList(List<int> list) => 12365 factory Int8Array.fromList(List<int> list) =>
12366 _TypedArrayFactoryProvider.createInt8Array_fromList(list); 12366 _TypedArrayFactoryProvider.createInt8Array_fromList(list);
12367 12367
12368 factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) => 12368 factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
12369 _TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, le ngth); 12369 _TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, le ngth);
12370 12370
12371 static const int BYTES_PER_ELEMENT = 1; 12371 static const int BYTES_PER_ELEMENT = 1;
12372 12372
12373 /// @domName Int8Array.length; @docsEditable true 12373 /// @domName Int8Array.length; @docsEditable true
12374 int get length => JS("int", "#.length", this); 12374 int get length => JS("int", "#.length", this);
12375 12375
12376 int operator[](int index) => JS("int", "#[#]", this, index); 12376 int operator[](int index) => JS("int", "#[#]", this, index);
12377 12377
12378 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 12378 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
(...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
14289 // for details. All rights reserved. Use of this source code is governed by a 14289 // for details. All rights reserved. Use of this source code is governed by a
14290 // BSD-style license that can be found in the LICENSE file. 14290 // BSD-style license that can be found in the LICENSE file.
14291 14291
14292 14292
14293 /// @domName Navigator; @docsEditable true 14293 /// @domName Navigator; @docsEditable true
14294 class Navigator native "*Navigator" { 14294 class Navigator native "*Navigator" {
14295 14295
14296 /// @domName Navigator.language; @docsEditable true 14296 /// @domName Navigator.language; @docsEditable true
14297 String get language => JS('String', '#.language || #.userLanguage', this, 14297 String get language => JS('String', '#.language || #.userLanguage', this,
14298 this); 14298 this);
14299 14299
14300 /// @domName Navigator.appCodeName; @docsEditable true 14300 /// @domName Navigator.appCodeName; @docsEditable true
14301 final String appCodeName; 14301 final String appCodeName;
14302 14302
14303 /// @domName Navigator.appName; @docsEditable true 14303 /// @domName Navigator.appName; @docsEditable true
14304 final String appName; 14304 final String appName;
14305 14305
14306 /// @domName Navigator.appVersion; @docsEditable true 14306 /// @domName Navigator.appVersion; @docsEditable true
14307 final String appVersion; 14307 final String appVersion;
14308 14308
14309 /// @domName Navigator.cookieEnabled; @docsEditable true 14309 /// @domName Navigator.cookieEnabled; @docsEditable true
(...skipping 4704 matching lines...) Expand 10 before | Expand all | Expand 10 after
19014 19014
19015 /// @domName Uint16Array; @docsEditable true 19015 /// @domName Uint16Array; @docsEditable true
19016 class Uint16Array extends ArrayBufferView implements JavaScriptIndexingBehavior, List<int> native "*Uint16Array" { 19016 class Uint16Array extends ArrayBufferView implements JavaScriptIndexingBehavior, List<int> native "*Uint16Array" {
19017 19017
19018 factory Uint16Array(int length) => 19018 factory Uint16Array(int length) =>
19019 _TypedArrayFactoryProvider.createUint16Array(length); 19019 _TypedArrayFactoryProvider.createUint16Array(length);
19020 19020
19021 factory Uint16Array.fromList(List<int> list) => 19021 factory Uint16Array.fromList(List<int> list) =>
19022 _TypedArrayFactoryProvider.createUint16Array_fromList(list); 19022 _TypedArrayFactoryProvider.createUint16Array_fromList(list);
19023 19023
19024 factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => 19024 factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) =>
19025 _TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset, length); 19025 _TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset, length);
19026 19026
19027 static const int BYTES_PER_ELEMENT = 2; 19027 static const int BYTES_PER_ELEMENT = 2;
19028 19028
19029 /// @domName Uint16Array.length; @docsEditable true 19029 /// @domName Uint16Array.length; @docsEditable true
19030 int get length => JS("int", "#.length", this); 19030 int get length => JS("int", "#.length", this);
19031 19031
19032 int operator[](int index) => JS("int", "#[#]", this, index); 19032 int operator[](int index) => JS("int", "#[#]", this, index);
19033 19033
19034 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 19034 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
19185 19185
19186 /// @domName Uint32Array; @docsEditable true 19186 /// @domName Uint32Array; @docsEditable true
19187 class Uint32Array extends ArrayBufferView implements JavaScriptIndexingBehavior, List<int> native "*Uint32Array" { 19187 class Uint32Array extends ArrayBufferView implements JavaScriptIndexingBehavior, List<int> native "*Uint32Array" {
19188 19188
19189 factory Uint32Array(int length) => 19189 factory Uint32Array(int length) =>
19190 _TypedArrayFactoryProvider.createUint32Array(length); 19190 _TypedArrayFactoryProvider.createUint32Array(length);
19191 19191
19192 factory Uint32Array.fromList(List<int> list) => 19192 factory Uint32Array.fromList(List<int> list) =>
19193 _TypedArrayFactoryProvider.createUint32Array_fromList(list); 19193 _TypedArrayFactoryProvider.createUint32Array_fromList(list);
19194 19194
19195 factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => 19195 factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) =>
19196 _TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset, length); 19196 _TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset, length);
19197 19197
19198 static const int BYTES_PER_ELEMENT = 4; 19198 static const int BYTES_PER_ELEMENT = 4;
19199 19199
19200 /// @domName Uint32Array.length; @docsEditable true 19200 /// @domName Uint32Array.length; @docsEditable true
19201 int get length => JS("int", "#.length", this); 19201 int get length => JS("int", "#.length", this);
19202 19202
19203 int operator[](int index) => JS("int", "#[#]", this, index); 19203 int operator[](int index) => JS("int", "#[#]", this, index);
19204 19204
19205 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 19205 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
19356 19356
19357 /// @domName Uint8Array; @docsEditable true 19357 /// @domName Uint8Array; @docsEditable true
19358 class Uint8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, List<int> native "*Uint8Array" { 19358 class Uint8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, List<int> native "*Uint8Array" {
19359 19359
19360 factory Uint8Array(int length) => 19360 factory Uint8Array(int length) =>
19361 _TypedArrayFactoryProvider.createUint8Array(length); 19361 _TypedArrayFactoryProvider.createUint8Array(length);
19362 19362
19363 factory Uint8Array.fromList(List<int> list) => 19363 factory Uint8Array.fromList(List<int> list) =>
19364 _TypedArrayFactoryProvider.createUint8Array_fromList(list); 19364 _TypedArrayFactoryProvider.createUint8Array_fromList(list);
19365 19365
19366 factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => 19366 factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) =>
19367 _TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, l ength); 19367 _TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, l ength);
19368 19368
19369 static const int BYTES_PER_ELEMENT = 1; 19369 static const int BYTES_PER_ELEMENT = 1;
19370 19370
19371 /// @domName Uint8Array.length; @docsEditable true 19371 /// @domName Uint8Array.length; @docsEditable true
19372 int get length => JS("int", "#.length", this); 19372 int get length => JS("int", "#.length", this);
19373 19373
19374 int operator[](int index) => JS("int", "#[#]", this, index); 19374 int operator[](int index) => JS("int", "#[#]", this, index);
19375 19375
19376 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 19376 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
19527 19527
19528 /// @domName Uint8ClampedArray; @docsEditable true 19528 /// @domName Uint8ClampedArray; @docsEditable true
19529 class Uint8ClampedArray extends Uint8Array native "*Uint8ClampedArray" { 19529 class Uint8ClampedArray extends Uint8Array native "*Uint8ClampedArray" {
19530 19530
19531 factory Uint8ClampedArray(int length) => 19531 factory Uint8ClampedArray(int length) =>
19532 _TypedArrayFactoryProvider.createUint8ClampedArray(length); 19532 _TypedArrayFactoryProvider.createUint8ClampedArray(length);
19533 19533
19534 factory Uint8ClampedArray.fromList(List<int> list) => 19534 factory Uint8ClampedArray.fromList(List<int> list) =>
19535 _TypedArrayFactoryProvider.createUint8ClampedArray_fromList(list); 19535 _TypedArrayFactoryProvider.createUint8ClampedArray_fromList(list);
19536 19536
19537 factory Uint8ClampedArray.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) => 19537 factory Uint8ClampedArray.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
19538 _TypedArrayFactoryProvider.createUint8ClampedArray_fromBuffer(buffer, byteOf fset, length); 19538 _TypedArrayFactoryProvider.createUint8ClampedArray_fromBuffer(buffer, byteOf fset, length);
19539 19539
19540 // Use implementation from Uint8Array. 19540 // Use implementation from Uint8Array.
19541 // final int length; 19541 // final int length;
19542 19542
19543 /// @domName Uint8ClampedArray.setElements; @docsEditable true 19543 /// @domName Uint8ClampedArray.setElements; @docsEditable true
19544 @JSName('set') 19544 @JSName('set')
19545 void setElements(Object array, [int offset]) native; 19545 void setElements(Object array, [int offset]) native;
19546 19546
19547 /// @domName Uint8ClampedArray.subarray; @docsEditable true 19547 /// @domName Uint8ClampedArray.subarray; @docsEditable true
(...skipping 5243 matching lines...) Expand 10 before | Expand all | Expand 10 after
24791 } 24791 }
24792 _dispatch(e); 24792 _dispatch(e);
24793 } 24793 }
24794 } 24794 }
24795 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 24795 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
24796 // for details. All rights reserved. Use of this source code is governed by a 24796 // for details. All rights reserved. Use of this source code is governed by a
24797 // BSD-style license that can be found in the LICENSE file. 24797 // BSD-style license that can be found in the LICENSE file.
24798 24798
24799 24799
24800 /** 24800 /**
24801 * Defines the keycode values for keys that are returned by 24801 * Defines the keycode values for keys that are returned by
24802 * KeyboardEvent.keyCode. 24802 * KeyboardEvent.keyCode.
24803 * 24803 *
24804 * Important note: There is substantial divergence in how different browsers 24804 * Important note: There is substantial divergence in how different browsers
24805 * handle keycodes and their variants in different locales/keyboard layouts. We 24805 * handle keycodes and their variants in different locales/keyboard layouts. We
24806 * provide these constants to help make code processing keys more readable. 24806 * provide these constants to help make code processing keys more readable.
24807 */ 24807 */
24808 abstract class KeyCode { 24808 abstract class KeyCode {
24809 // These constant names were borrowed from Closure's Keycode enumeration 24809 // These constant names were borrowed from Closure's Keycode enumeration
24810 // class. 24810 // class.
24811 // http://closure-library.googlecode.com/svn/docs/closure_goog_events_keycodes .js.source.html 24811 // http://closure-library.googlecode.com/svn/docs/closure_goog_events_keycodes .js.source.html
24812 static const int WIN_KEY_FF_LINUX = 0; 24812 static const int WIN_KEY_FF_LINUX = 0;
24813 static const int MAC_ENTER = 3; 24813 static const int MAC_ENTER = 3;
24814 static const int BACKSPACE = 8; 24814 static const int BACKSPACE = 8;
24815 static const int TAB = 9; 24815 static const int TAB = 9;
24816 /** NUM_CENTER is also NUMLOCK for FF and Safari on Mac. */ 24816 /** NUM_CENTER is also NUMLOCK for FF and Safari on Mac. */
24817 static const int NUM_CENTER = 12; 24817 static const int NUM_CENTER = 12;
24818 static const int ENTER = 13; 24818 static const int ENTER = 13;
24819 static const int SHIFT = 16; 24819 static const int SHIFT = 16;
24820 static const int CTRL = 17; 24820 static const int CTRL = 17;
24821 static const int ALT = 18; 24821 static const int ALT = 18;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
24996 * Returns true if the keyCode produces a (US keyboard) character. 24996 * Returns true if the keyCode produces a (US keyboard) character.
24997 * Note: This does not (yet) cover characters on non-US keyboards (Russian, 24997 * Note: This does not (yet) cover characters on non-US keyboards (Russian,
24998 * Hebrew, etc.). 24998 * Hebrew, etc.).
24999 */ 24999 */
25000 static bool isCharacterKey(int keyCode) { 25000 static bool isCharacterKey(int keyCode) {
25001 if ((keyCode >= ZERO && keyCode <= NINE) || 25001 if ((keyCode >= ZERO && keyCode <= NINE) ||
25002 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) || 25002 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) ||
25003 (keyCode >= A && keyCode <= Z)) { 25003 (keyCode >= A && keyCode <= Z)) {
25004 return true; 25004 return true;
25005 } 25005 }
25006 25006
25007 // Safari sends zero key code for non-latin characters. 25007 // Safari sends zero key code for non-latin characters.
25008 if (_Device.isWebKit && keyCode == 0) { 25008 if (_Device.isWebKit && keyCode == 0) {
25009 return true; 25009 return true;
25010 } 25010 }
25011 25011
25012 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS 25012 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS
25013 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD || 25013 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD ||
25014 keyCode == NUM_DIVISION || keyCode == SEMICOLON || 25014 keyCode == NUM_DIVISION || keyCode == SEMICOLON ||
25015 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS || 25015 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS ||
25016 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD || 25016 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD ||
25017 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE || 25017 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE ||
25018 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH || 25018 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH ||
25019 keyCode == CLOSE_SQUARE_BRACKET); 25019 keyCode == CLOSE_SQUARE_BRACKET);
25020 } 25020 }
25021 } 25021 }
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
26870 // for details. All rights reserved. Use of this source code is governed by a 26870 // for details. All rights reserved. Use of this source code is governed by a
26871 // BSD-style license that can be found in the LICENSE file. 26871 // BSD-style license that can be found in the LICENSE file.
26872 26872
26873 26873
26874 // Iterator for arrays with fixed size. 26874 // Iterator for arrays with fixed size.
26875 class FixedSizeListIterator<T> implements Iterator<T> { 26875 class FixedSizeListIterator<T> implements Iterator<T> {
26876 final List<T> _array; 26876 final List<T> _array;
26877 final int _length; // Cache array length for faster access. 26877 final int _length; // Cache array length for faster access.
26878 int _position; 26878 int _position;
26879 T _current; 26879 T _current;
26880 26880
26881 FixedSizeListIterator(List<T> array) 26881 FixedSizeListIterator(List<T> array)
26882 : _array = array, 26882 : _array = array,
26883 _position = -1, 26883 _position = -1,
26884 _length = array.length; 26884 _length = array.length;
26885 26885
26886 bool moveNext() { 26886 bool moveNext() {
26887 int nextPosition = _position + 1; 26887 int nextPosition = _position + 1;
26888 if (nextPosition < _length) { 26888 if (nextPosition < _length) {
26889 _current = _array[nextPosition]; 26889 _current = _array[nextPosition];
26890 _position = nextPosition; 26890 _position = nextPosition;
(...skipping 24 matching lines...) Expand all
26915 _position = nextPosition; 26915 _position = nextPosition;
26916 return true; 26916 return true;
26917 } 26917 }
26918 _current = null; 26918 _current = null;
26919 _position = _array.length; 26919 _position = _array.length;
26920 return false; 26920 return false;
26921 } 26921 }
26922 26922
26923 T get current => _current; 26923 T get current => _current;
26924 } 26924 }
OLDNEW
« no previous file with comments | « no previous file | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698