OLD | NEW |
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 9143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9154 // for details. All rights reserved. Use of this source code is governed by a | 9154 // for details. All rights reserved. Use of this source code is governed by a |
9155 // BSD-style license that can be found in the LICENSE file. | 9155 // BSD-style license that can be found in the LICENSE file. |
9156 | 9156 |
9157 | 9157 |
9158 /** | 9158 /** |
9159 * Base class that supports listening for and dispatching browser events. | 9159 * Base class that supports listening for and dispatching browser events. |
9160 * | 9160 * |
9161 * Events can either be accessed by string name (using the indexed getter) or by | 9161 * Events can either be accessed by string name (using the indexed getter) or by |
9162 * getters exposed by subclasses. Use the getters exposed by subclasses when | 9162 * getters exposed by subclasses. Use the getters exposed by subclasses when |
9163 * possible for better compile-time type checks. | 9163 * possible for better compile-time type checks. |
9164 * | 9164 * |
9165 * Using an indexed getter: | 9165 * Using an indexed getter: |
9166 * events['mouseover'].add((e) => print("Mouse over!")); | 9166 * events['mouseover'].add((e) => print("Mouse over!")); |
9167 * | 9167 * |
9168 * Using a getter provided by a subclass: | 9168 * Using a getter provided by a subclass: |
9169 * elementEvents.mouseOver.add((e) => print("Mouse over!")); | 9169 * elementEvents.mouseOver.add((e) => print("Mouse over!")); |
9170 */ | 9170 */ |
9171 class Events { | 9171 class Events { |
9172 /* Raw event target. */ | 9172 /* Raw event target. */ |
9173 final EventTarget _ptr; | 9173 final EventTarget _ptr; |
9174 | 9174 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9217 } | 9217 } |
9218 | 9218 |
9219 /// @domName EventTarget | 9219 /// @domName EventTarget |
9220 /** | 9220 /** |
9221 * Base class for all browser objects that support events. | 9221 * Base class for all browser objects that support events. |
9222 * | 9222 * |
9223 * Use the [on] property to add, remove, and dispatch events (rather than | 9223 * Use the [on] property to add, remove, and dispatch events (rather than |
9224 * [$dom_addEventListener], [$dom_dispatchEvent], and | 9224 * [$dom_addEventListener], [$dom_dispatchEvent], and |
9225 * [$dom_removeEventListener]) for compile-time type checks and a more concise | 9225 * [$dom_removeEventListener]) for compile-time type checks and a more concise |
9226 * API. | 9226 * API. |
9227 */ | 9227 */ |
9228 class EventTarget native "*EventTarget" { | 9228 class EventTarget native "*EventTarget" { |
9229 | 9229 |
9230 /** @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev
entTarget.dispatchEvent */ | 9230 /** @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev
entTarget.dispatchEvent */ |
9231 Events get on => new Events(this); | 9231 Events get on => new Events(this); |
9232 | 9232 |
9233 /// @domName EventTarget.addEventListener; @docsEditable true | 9233 /// @domName EventTarget.addEventListener; @docsEditable true |
9234 @JSName('addEventListener') | 9234 @JSName('addEventListener') |
9235 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu
re]) native; | 9235 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu
re]) native; |
9236 | 9236 |
9237 /// @domName EventTarget.dispatchEvent; @docsEditable true | 9237 /// @domName EventTarget.dispatchEvent; @docsEditable true |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9902 | 9902 |
9903 /// @domName Float32Array; @docsEditable true | 9903 /// @domName Float32Array; @docsEditable true |
9904 class Float32Array extends ArrayBufferView implements JavaScriptIndexingBehavior
, List<num> native "*Float32Array" { | 9904 class Float32Array extends ArrayBufferView implements JavaScriptIndexingBehavior
, List<num> native "*Float32Array" { |
9905 | 9905 |
9906 factory Float32Array(int length) => | 9906 factory Float32Array(int length) => |
9907 _TypedArrayFactoryProvider.createFloat32Array(length); | 9907 _TypedArrayFactoryProvider.createFloat32Array(length); |
9908 | 9908 |
9909 factory Float32Array.fromList(List<num> list) => | 9909 factory Float32Array.fromList(List<num> list) => |
9910 _TypedArrayFactoryProvider.createFloat32Array_fromList(list); | 9910 _TypedArrayFactoryProvider.createFloat32Array_fromList(list); |
9911 | 9911 |
9912 factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt
h]) => | 9912 factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt
h]) => |
9913 _TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset,
length); | 9913 _TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset,
length); |
9914 | 9914 |
9915 static const int BYTES_PER_ELEMENT = 4; | 9915 static const int BYTES_PER_ELEMENT = 4; |
9916 | 9916 |
9917 /// @domName Float32Array.length; @docsEditable true | 9917 /// @domName Float32Array.length; @docsEditable true |
9918 int get length => JS("int", "#.length", this); | 9918 int get length => JS("int", "#.length", this); |
9919 | 9919 |
9920 num operator[](int index) => JS("num", "#[#]", this, index); | 9920 num operator[](int index) => JS("num", "#[#]", this, index); |
9921 | 9921 |
9922 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<num> mixins. | 9922 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<num> mixins. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10076 | 10076 |
10077 /// @domName Float64Array; @docsEditable true | 10077 /// @domName Float64Array; @docsEditable true |
10078 class Float64Array extends ArrayBufferView implements JavaScriptIndexingBehavior
, List<num> native "*Float64Array" { | 10078 class Float64Array extends ArrayBufferView implements JavaScriptIndexingBehavior
, List<num> native "*Float64Array" { |
10079 | 10079 |
10080 factory Float64Array(int length) => | 10080 factory Float64Array(int length) => |
10081 _TypedArrayFactoryProvider.createFloat64Array(length); | 10081 _TypedArrayFactoryProvider.createFloat64Array(length); |
10082 | 10082 |
10083 factory Float64Array.fromList(List<num> list) => | 10083 factory Float64Array.fromList(List<num> list) => |
10084 _TypedArrayFactoryProvider.createFloat64Array_fromList(list); | 10084 _TypedArrayFactoryProvider.createFloat64Array_fromList(list); |
10085 | 10085 |
10086 factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt
h]) => | 10086 factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt
h]) => |
10087 _TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset,
length); | 10087 _TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset,
length); |
10088 | 10088 |
10089 static const int BYTES_PER_ELEMENT = 8; | 10089 static const int BYTES_PER_ELEMENT = 8; |
10090 | 10090 |
10091 /// @domName Float64Array.length; @docsEditable true | 10091 /// @domName Float64Array.length; @docsEditable true |
10092 int get length => JS("int", "#.length", this); | 10092 int get length => JS("int", "#.length", this); |
10093 | 10093 |
10094 num operator[](int index) => JS("num", "#[#]", this, index); | 10094 num operator[](int index) => JS("num", "#[#]", this, index); |
10095 | 10095 |
10096 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<num> mixins. | 10096 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<num> mixins. |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11115 /// @domName HTMLOptionsCollection; @docsEditable true | 11115 /// @domName HTMLOptionsCollection; @docsEditable true |
11116 class HtmlOptionsCollection extends HtmlCollection native "*HTMLOptionsCollectio
n" { | 11116 class HtmlOptionsCollection extends HtmlCollection native "*HTMLOptionsCollectio
n" { |
11117 } | 11117 } |
11118 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 11118 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
11119 // for details. All rights reserved. Use of this source code is governed by a | 11119 // for details. All rights reserved. Use of this source code is governed by a |
11120 // BSD-style license that can be found in the LICENSE file. | 11120 // BSD-style license that can be found in the LICENSE file. |
11121 | 11121 |
11122 | 11122 |
11123 /** | 11123 /** |
11124 * A utility for retrieving data from a URL. | 11124 * A utility for retrieving data from a URL. |
11125 * | 11125 * |
11126 * HttpRequest can be used to obtain data from http, ftp, and file | 11126 * HttpRequest can be used to obtain data from http, ftp, and file |
11127 * protocols. | 11127 * protocols. |
11128 * | 11128 * |
11129 * For example, suppose we're developing these API docs, and we | 11129 * For example, suppose we're developing these API docs, and we |
11130 * wish to retrieve the HTML of the top-level page and print it out. | 11130 * wish to retrieve the HTML of the top-level page and print it out. |
11131 * The easiest way to do that would be: | 11131 * The easiest way to do that would be: |
11132 * | 11132 * |
11133 * var httpRequest = HttpRequest.get('http://api.dartlang.org', | 11133 * var httpRequest = HttpRequest.get('http://api.dartlang.org', |
11134 * (request) => print(request.responseText)); | 11134 * (request) => print(request.responseText)); |
11135 * | 11135 * |
11136 * **Important**: With the default behavior of this class, your | 11136 * **Important**: With the default behavior of this class, your |
11137 * code making the request should be served from the same origin (domain name, | 11137 * code making the request should be served from the same origin (domain name, |
11138 * port, and application layer protocol) as the URL you are trying to access | 11138 * port, and application layer protocol) as the URL you are trying to access |
11139 * with HttpRequest. However, there are ways to | 11139 * with HttpRequest. However, there are ways to |
11140 * [get around this restriction](http://www.dartlang.org/articles/json-web-servi
ce/#note-on-jsonp). | 11140 * [get around this restriction](http://www.dartlang.org/articles/json-web-servi
ce/#note-on-jsonp). |
11141 * | 11141 * |
11142 * See also: | 11142 * See also: |
11143 * | 11143 * |
11144 * * [Dart article on using HttpRequests](http://www.dartlang.org/articles/json-
web-service/#getting-data) | 11144 * * [Dart article on using HttpRequests](http://www.dartlang.org/articles/json-
web-service/#getting-data) |
11145 * * [JS XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpReq
uest) | 11145 * * [JS XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpReq
uest) |
11146 * * [Using XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttp
Request/Using_XMLHttpRequest) | 11146 * * [Using XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttp
Request/Using_XMLHttpRequest) |
11147 */ | 11147 */ |
11148 /// @domName XMLHttpRequest | 11148 /// @domName XMLHttpRequest |
11149 class HttpRequest extends EventTarget native "*XMLHttpRequest" { | 11149 class HttpRequest extends EventTarget native "*XMLHttpRequest" { |
11150 /** | 11150 /** |
11151 * Creates a URL get request for the specified `url`. | 11151 * Creates a URL get request for the specified `url`. |
11152 * | 11152 * |
11153 * After completing the request, the object will call the user-provided | 11153 * After completing the request, the object will call the user-provided |
11154 * [onComplete] callback. | 11154 * [onComplete] callback. |
11155 */ | 11155 */ |
11156 factory HttpRequest.get(String url, onComplete(HttpRequest request)) => | 11156 factory HttpRequest.get(String url, onComplete(HttpRequest request)) => |
11157 _HttpRequestUtils.get(url, onComplete, false); | 11157 _HttpRequestUtils.get(url, onComplete, false); |
11158 | 11158 |
11159 // 80 char issue for comments in lists: dartbug.com/7588. | 11159 // 80 char issue for comments in lists: dartbug.com/7588. |
11160 /** | 11160 /** |
11161 * Creates a URL GET request for the specified `url` with | 11161 * Creates a URL GET request for the specified `url` with |
11162 * credentials such a cookie (already) set in the header or | 11162 * credentials such a cookie (already) set in the header or |
11163 * [authorization headers](http://tools.ietf.org/html/rfc1945#section-10.2). | 11163 * [authorization headers](http://tools.ietf.org/html/rfc1945#section-10.2). |
11164 * | 11164 * |
11165 * After completing the request, the object will call the user-provided | 11165 * After completing the request, the object will call the user-provided |
11166 * [onComplete] callback. | 11166 * [onComplete] callback. |
11167 * | 11167 * |
11168 * A few other details to keep in mind when using credentials: | 11168 * A few other details to keep in mind when using credentials: |
11169 * | 11169 * |
11170 * * Using credentials is only useful for cross-origin requests. | 11170 * * Using credentials is only useful for cross-origin requests. |
11171 * * The `Access-Control-Allow-Origin` header of `url` cannot contain a wildca
rd (*). | 11171 * * The `Access-Control-Allow-Origin` header of `url` cannot contain a wildca
rd (*). |
11172 * * The `Access-Control-Allow-Credentials` header of `url` must be set to tru
e. | 11172 * * The `Access-Control-Allow-Credentials` header of `url` must be set to tru
e. |
11173 * * 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]. | 11173 * * 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]. |
11174 * | 11174 * |
11175 * See also: [authorization headers](http://en.wikipedia.org/wiki/Basic_access
_authentication). | 11175 * See also: [authorization headers](http://en.wikipedia.org/wiki/Basic_access
_authentication). |
11176 */ | 11176 */ |
11177 factory HttpRequest.getWithCredentials(String url, | 11177 factory HttpRequest.getWithCredentials(String url, |
11178 onComplete(HttpRequest request)) => | 11178 onComplete(HttpRequest request)) => |
11179 _HttpRequestUtils.get(url, onComplete, true); | 11179 _HttpRequestUtils.get(url, onComplete, true); |
11180 | 11180 |
11181 | 11181 |
11182 static const EventStreamProvider<ProgressEvent> abortEvent = const EventStream
Provider<ProgressEvent>('abort'); | 11182 static const EventStreamProvider<ProgressEvent> abortEvent = const EventStream
Provider<ProgressEvent>('abort'); |
11183 | 11183 |
11184 static const EventStreamProvider<ProgressEvent> errorEvent = const EventStream
Provider<ProgressEvent>('error'); | 11184 static const EventStreamProvider<ProgressEvent> errorEvent = const EventStream
Provider<ProgressEvent>('error'); |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12357 | 12357 |
12358 /// @domName Int16Array; @docsEditable true | 12358 /// @domName Int16Array; @docsEditable true |
12359 class Int16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
List<int> native "*Int16Array" { | 12359 class Int16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
List<int> native "*Int16Array" { |
12360 | 12360 |
12361 factory Int16Array(int length) => | 12361 factory Int16Array(int length) => |
12362 _TypedArrayFactoryProvider.createInt16Array(length); | 12362 _TypedArrayFactoryProvider.createInt16Array(length); |
12363 | 12363 |
12364 factory Int16Array.fromList(List<int> list) => | 12364 factory Int16Array.fromList(List<int> list) => |
12365 _TypedArrayFactoryProvider.createInt16Array_fromList(list); | 12365 _TypedArrayFactoryProvider.createInt16Array_fromList(list); |
12366 | 12366 |
12367 factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]
) => | 12367 factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]
) => |
12368 _TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, l
ength); | 12368 _TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, l
ength); |
12369 | 12369 |
12370 static const int BYTES_PER_ELEMENT = 2; | 12370 static const int BYTES_PER_ELEMENT = 2; |
12371 | 12371 |
12372 /// @domName Int16Array.length; @docsEditable true | 12372 /// @domName Int16Array.length; @docsEditable true |
12373 int get length => JS("int", "#.length", this); | 12373 int get length => JS("int", "#.length", this); |
12374 | 12374 |
12375 int operator[](int index) => JS("int", "#[#]", this, index); | 12375 int operator[](int index) => JS("int", "#[#]", this, index); |
12376 | 12376 |
12377 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. | 12377 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12531 | 12531 |
12532 /// @domName Int32Array; @docsEditable true | 12532 /// @domName Int32Array; @docsEditable true |
12533 class Int32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
List<int> native "*Int32Array" { | 12533 class Int32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
List<int> native "*Int32Array" { |
12534 | 12534 |
12535 factory Int32Array(int length) => | 12535 factory Int32Array(int length) => |
12536 _TypedArrayFactoryProvider.createInt32Array(length); | 12536 _TypedArrayFactoryProvider.createInt32Array(length); |
12537 | 12537 |
12538 factory Int32Array.fromList(List<int> list) => | 12538 factory Int32Array.fromList(List<int> list) => |
12539 _TypedArrayFactoryProvider.createInt32Array_fromList(list); | 12539 _TypedArrayFactoryProvider.createInt32Array_fromList(list); |
12540 | 12540 |
12541 factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]
) => | 12541 factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]
) => |
12542 _TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, l
ength); | 12542 _TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, l
ength); |
12543 | 12543 |
12544 static const int BYTES_PER_ELEMENT = 4; | 12544 static const int BYTES_PER_ELEMENT = 4; |
12545 | 12545 |
12546 /// @domName Int32Array.length; @docsEditable true | 12546 /// @domName Int32Array.length; @docsEditable true |
12547 int get length => JS("int", "#.length", this); | 12547 int get length => JS("int", "#.length", this); |
12548 | 12548 |
12549 int operator[](int index) => JS("int", "#[#]", this, index); | 12549 int operator[](int index) => JS("int", "#[#]", this, index); |
12550 | 12550 |
12551 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. | 12551 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12705 | 12705 |
12706 /// @domName Int8Array; @docsEditable true | 12706 /// @domName Int8Array; @docsEditable true |
12707 class Int8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, L
ist<int> native "*Int8Array" { | 12707 class Int8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, L
ist<int> native "*Int8Array" { |
12708 | 12708 |
12709 factory Int8Array(int length) => | 12709 factory Int8Array(int length) => |
12710 _TypedArrayFactoryProvider.createInt8Array(length); | 12710 _TypedArrayFactoryProvider.createInt8Array(length); |
12711 | 12711 |
12712 factory Int8Array.fromList(List<int> list) => | 12712 factory Int8Array.fromList(List<int> list) => |
12713 _TypedArrayFactoryProvider.createInt8Array_fromList(list); | 12713 _TypedArrayFactoryProvider.createInt8Array_fromList(list); |
12714 | 12714 |
12715 factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length])
=> | 12715 factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length])
=> |
12716 _TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, le
ngth); | 12716 _TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, le
ngth); |
12717 | 12717 |
12718 static const int BYTES_PER_ELEMENT = 1; | 12718 static const int BYTES_PER_ELEMENT = 1; |
12719 | 12719 |
12720 /// @domName Int8Array.length; @docsEditable true | 12720 /// @domName Int8Array.length; @docsEditable true |
12721 int get length => JS("int", "#.length", this); | 12721 int get length => JS("int", "#.length", this); |
12722 | 12722 |
12723 int operator[](int index) => JS("int", "#[#]", this, index); | 12723 int operator[](int index) => JS("int", "#[#]", this, index); |
12724 | 12724 |
12725 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. | 12725 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. |
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14752 // for details. All rights reserved. Use of this source code is governed by a | 14752 // for details. All rights reserved. Use of this source code is governed by a |
14753 // BSD-style license that can be found in the LICENSE file. | 14753 // BSD-style license that can be found in the LICENSE file. |
14754 | 14754 |
14755 | 14755 |
14756 /// @domName Navigator; @docsEditable true | 14756 /// @domName Navigator; @docsEditable true |
14757 class Navigator native "*Navigator" { | 14757 class Navigator native "*Navigator" { |
14758 | 14758 |
14759 /// @domName Navigator.language; @docsEditable true | 14759 /// @domName Navigator.language; @docsEditable true |
14760 String get language => JS('String', '#.language || #.userLanguage', this, | 14760 String get language => JS('String', '#.language || #.userLanguage', this, |
14761 this); | 14761 this); |
14762 | 14762 |
14763 /// @domName Navigator.appCodeName; @docsEditable true | 14763 /// @domName Navigator.appCodeName; @docsEditable true |
14764 final String appCodeName; | 14764 final String appCodeName; |
14765 | 14765 |
14766 /// @domName Navigator.appName; @docsEditable true | 14766 /// @domName Navigator.appName; @docsEditable true |
14767 final String appName; | 14767 final String appName; |
14768 | 14768 |
14769 /// @domName Navigator.appVersion; @docsEditable true | 14769 /// @domName Navigator.appVersion; @docsEditable true |
14770 final String appVersion; | 14770 final String appVersion; |
14771 | 14771 |
14772 /// @domName Navigator.cookieEnabled; @docsEditable true | 14772 /// @domName Navigator.cookieEnabled; @docsEditable true |
(...skipping 4828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19601 | 19601 |
19602 /// @domName Uint16Array; @docsEditable true | 19602 /// @domName Uint16Array; @docsEditable true |
19603 class Uint16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
List<int> native "*Uint16Array" { | 19603 class Uint16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
List<int> native "*Uint16Array" { |
19604 | 19604 |
19605 factory Uint16Array(int length) => | 19605 factory Uint16Array(int length) => |
19606 _TypedArrayFactoryProvider.createUint16Array(length); | 19606 _TypedArrayFactoryProvider.createUint16Array(length); |
19607 | 19607 |
19608 factory Uint16Array.fromList(List<int> list) => | 19608 factory Uint16Array.fromList(List<int> list) => |
19609 _TypedArrayFactoryProvider.createUint16Array_fromList(list); | 19609 _TypedArrayFactoryProvider.createUint16Array_fromList(list); |
19610 | 19610 |
19611 factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length
]) => | 19611 factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length
]) => |
19612 _TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset,
length); | 19612 _TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset,
length); |
19613 | 19613 |
19614 static const int BYTES_PER_ELEMENT = 2; | 19614 static const int BYTES_PER_ELEMENT = 2; |
19615 | 19615 |
19616 /// @domName Uint16Array.length; @docsEditable true | 19616 /// @domName Uint16Array.length; @docsEditable true |
19617 int get length => JS("int", "#.length", this); | 19617 int get length => JS("int", "#.length", this); |
19618 | 19618 |
19619 int operator[](int index) => JS("int", "#[#]", this, index); | 19619 int operator[](int index) => JS("int", "#[#]", this, index); |
19620 | 19620 |
19621 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. | 19621 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19775 | 19775 |
19776 /// @domName Uint32Array; @docsEditable true | 19776 /// @domName Uint32Array; @docsEditable true |
19777 class Uint32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
List<int> native "*Uint32Array" { | 19777 class Uint32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
List<int> native "*Uint32Array" { |
19778 | 19778 |
19779 factory Uint32Array(int length) => | 19779 factory Uint32Array(int length) => |
19780 _TypedArrayFactoryProvider.createUint32Array(length); | 19780 _TypedArrayFactoryProvider.createUint32Array(length); |
19781 | 19781 |
19782 factory Uint32Array.fromList(List<int> list) => | 19782 factory Uint32Array.fromList(List<int> list) => |
19783 _TypedArrayFactoryProvider.createUint32Array_fromList(list); | 19783 _TypedArrayFactoryProvider.createUint32Array_fromList(list); |
19784 | 19784 |
19785 factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length
]) => | 19785 factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length
]) => |
19786 _TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset,
length); | 19786 _TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset,
length); |
19787 | 19787 |
19788 static const int BYTES_PER_ELEMENT = 4; | 19788 static const int BYTES_PER_ELEMENT = 4; |
19789 | 19789 |
19790 /// @domName Uint32Array.length; @docsEditable true | 19790 /// @domName Uint32Array.length; @docsEditable true |
19791 int get length => JS("int", "#.length", this); | 19791 int get length => JS("int", "#.length", this); |
19792 | 19792 |
19793 int operator[](int index) => JS("int", "#[#]", this, index); | 19793 int operator[](int index) => JS("int", "#[#]", this, index); |
19794 | 19794 |
19795 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. | 19795 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19949 | 19949 |
19950 /// @domName Uint8Array; @docsEditable true | 19950 /// @domName Uint8Array; @docsEditable true |
19951 class Uint8Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
List<int> native "*Uint8Array" { | 19951 class Uint8Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
List<int> native "*Uint8Array" { |
19952 | 19952 |
19953 factory Uint8Array(int length) => | 19953 factory Uint8Array(int length) => |
19954 _TypedArrayFactoryProvider.createUint8Array(length); | 19954 _TypedArrayFactoryProvider.createUint8Array(length); |
19955 | 19955 |
19956 factory Uint8Array.fromList(List<int> list) => | 19956 factory Uint8Array.fromList(List<int> list) => |
19957 _TypedArrayFactoryProvider.createUint8Array_fromList(list); | 19957 _TypedArrayFactoryProvider.createUint8Array_fromList(list); |
19958 | 19958 |
19959 factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]
) => | 19959 factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]
) => |
19960 _TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, l
ength); | 19960 _TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, l
ength); |
19961 | 19961 |
19962 static const int BYTES_PER_ELEMENT = 1; | 19962 static const int BYTES_PER_ELEMENT = 1; |
19963 | 19963 |
19964 /// @domName Uint8Array.length; @docsEditable true | 19964 /// @domName Uint8Array.length; @docsEditable true |
19965 int get length => JS("int", "#.length", this); | 19965 int get length => JS("int", "#.length", this); |
19966 | 19966 |
19967 int operator[](int index) => JS("int", "#[#]", this, index); | 19967 int operator[](int index) => JS("int", "#[#]", this, index); |
19968 | 19968 |
19969 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. | 19969 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v
alue); } // -- start List<int> mixins. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20123 | 20123 |
20124 /// @domName Uint8ClampedArray; @docsEditable true | 20124 /// @domName Uint8ClampedArray; @docsEditable true |
20125 class Uint8ClampedArray extends Uint8Array native "*Uint8ClampedArray" { | 20125 class Uint8ClampedArray extends Uint8Array native "*Uint8ClampedArray" { |
20126 | 20126 |
20127 factory Uint8ClampedArray(int length) => | 20127 factory Uint8ClampedArray(int length) => |
20128 _TypedArrayFactoryProvider.createUint8ClampedArray(length); | 20128 _TypedArrayFactoryProvider.createUint8ClampedArray(length); |
20129 | 20129 |
20130 factory Uint8ClampedArray.fromList(List<int> list) => | 20130 factory Uint8ClampedArray.fromList(List<int> list) => |
20131 _TypedArrayFactoryProvider.createUint8ClampedArray_fromList(list); | 20131 _TypedArrayFactoryProvider.createUint8ClampedArray_fromList(list); |
20132 | 20132 |
20133 factory Uint8ClampedArray.fromBuffer(ArrayBuffer buffer, [int byteOffset, int
length]) => | 20133 factory Uint8ClampedArray.fromBuffer(ArrayBuffer buffer, [int byteOffset, int
length]) => |
20134 _TypedArrayFactoryProvider.createUint8ClampedArray_fromBuffer(buffer, byteOf
fset, length); | 20134 _TypedArrayFactoryProvider.createUint8ClampedArray_fromBuffer(buffer, byteOf
fset, length); |
20135 | 20135 |
20136 // Use implementation from Uint8Array. | 20136 // Use implementation from Uint8Array. |
20137 // final int length; | 20137 // final int length; |
20138 | 20138 |
20139 /// @domName Uint8ClampedArray.setElements; @docsEditable true | 20139 /// @domName Uint8ClampedArray.setElements; @docsEditable true |
20140 @JSName('set') | 20140 @JSName('set') |
20141 void setElements(Object array, [int offset]) native; | 20141 void setElements(Object array, [int offset]) native; |
20142 | 20142 |
20143 /// @domName Uint8ClampedArray.subarray; @docsEditable true | 20143 /// @domName Uint8ClampedArray.subarray; @docsEditable true |
(...skipping 5108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25252 | 25252 |
25253 // interface Set - BEGIN | 25253 // interface Set - BEGIN |
25254 bool contains(String value) => readClasses().contains(value); | 25254 bool contains(String value) => readClasses().contains(value); |
25255 | 25255 |
25256 void add(String value) { | 25256 void add(String value) { |
25257 // TODO - figure out if we need to do any validation here | 25257 // TODO - figure out if we need to do any validation here |
25258 // or if the browser natively does enough | 25258 // or if the browser natively does enough |
25259 _modify((s) => s.add(value)); | 25259 _modify((s) => s.add(value)); |
25260 } | 25260 } |
25261 | 25261 |
25262 bool remove(String value) { | 25262 bool remove(Object value) { |
25263 Set<String> s = readClasses(); | 25263 Set<String> s = readClasses(); |
25264 bool result = s.remove(value); | 25264 bool result = s.remove(value); |
25265 writeClasses(s); | 25265 writeClasses(s); |
25266 return result; | 25266 return result; |
25267 } | 25267 } |
25268 | 25268 |
25269 void addAll(Iterable<String> iterable) { | 25269 void addAll(Iterable<String> iterable) { |
25270 // TODO - see comment above about validation | 25270 // TODO - see comment above about validation |
25271 _modify((s) => s.addAll(iterable)); | 25271 _modify((s) => s.addAll(iterable)); |
25272 } | 25272 } |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25923 } | 25923 } |
25924 _dispatch(e); | 25924 _dispatch(e); |
25925 } | 25925 } |
25926 } | 25926 } |
25927 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 25927 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
25928 // for details. All rights reserved. Use of this source code is governed by a | 25928 // for details. All rights reserved. Use of this source code is governed by a |
25929 // BSD-style license that can be found in the LICENSE file. | 25929 // BSD-style license that can be found in the LICENSE file. |
25930 | 25930 |
25931 | 25931 |
25932 /** | 25932 /** |
25933 * Defines the keycode values for keys that are returned by | 25933 * Defines the keycode values for keys that are returned by |
25934 * KeyboardEvent.keyCode. | 25934 * KeyboardEvent.keyCode. |
25935 * | 25935 * |
25936 * Important note: There is substantial divergence in how different browsers | 25936 * Important note: There is substantial divergence in how different browsers |
25937 * handle keycodes and their variants in different locales/keyboard layouts. We | 25937 * handle keycodes and their variants in different locales/keyboard layouts. We |
25938 * provide these constants to help make code processing keys more readable. | 25938 * provide these constants to help make code processing keys more readable. |
25939 */ | 25939 */ |
25940 abstract class KeyCode { | 25940 abstract class KeyCode { |
25941 // These constant names were borrowed from Closure's Keycode enumeration | 25941 // These constant names were borrowed from Closure's Keycode enumeration |
25942 // class. | 25942 // class. |
25943 // http://closure-library.googlecode.com/svn/docs/closure_goog_events_keycodes
.js.source.html | 25943 // http://closure-library.googlecode.com/svn/docs/closure_goog_events_keycodes
.js.source.html |
25944 static const int WIN_KEY_FF_LINUX = 0; | 25944 static const int WIN_KEY_FF_LINUX = 0; |
25945 static const int MAC_ENTER = 3; | 25945 static const int MAC_ENTER = 3; |
25946 static const int BACKSPACE = 8; | 25946 static const int BACKSPACE = 8; |
25947 static const int TAB = 9; | 25947 static const int TAB = 9; |
25948 /** NUM_CENTER is also NUMLOCK for FF and Safari on Mac. */ | 25948 /** NUM_CENTER is also NUMLOCK for FF and Safari on Mac. */ |
25949 static const int NUM_CENTER = 12; | 25949 static const int NUM_CENTER = 12; |
25950 static const int ENTER = 13; | 25950 static const int ENTER = 13; |
25951 static const int SHIFT = 16; | 25951 static const int SHIFT = 16; |
25952 static const int CTRL = 17; | 25952 static const int CTRL = 17; |
25953 static const int ALT = 18; | 25953 static const int ALT = 18; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
26128 * Returns true if the keyCode produces a (US keyboard) character. | 26128 * Returns true if the keyCode produces a (US keyboard) character. |
26129 * Note: This does not (yet) cover characters on non-US keyboards (Russian, | 26129 * Note: This does not (yet) cover characters on non-US keyboards (Russian, |
26130 * Hebrew, etc.). | 26130 * Hebrew, etc.). |
26131 */ | 26131 */ |
26132 static bool isCharacterKey(int keyCode) { | 26132 static bool isCharacterKey(int keyCode) { |
26133 if ((keyCode >= ZERO && keyCode <= NINE) || | 26133 if ((keyCode >= ZERO && keyCode <= NINE) || |
26134 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) || | 26134 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) || |
26135 (keyCode >= A && keyCode <= Z)) { | 26135 (keyCode >= A && keyCode <= Z)) { |
26136 return true; | 26136 return true; |
26137 } | 26137 } |
26138 | 26138 |
26139 // Safari sends zero key code for non-latin characters. | 26139 // Safari sends zero key code for non-latin characters. |
26140 if (_Device.isWebKit && keyCode == 0) { | 26140 if (_Device.isWebKit && keyCode == 0) { |
26141 return true; | 26141 return true; |
26142 } | 26142 } |
26143 | 26143 |
26144 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS | 26144 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS |
26145 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD || | 26145 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD || |
26146 keyCode == NUM_DIVISION || keyCode == SEMICOLON || | 26146 keyCode == NUM_DIVISION || keyCode == SEMICOLON || |
26147 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS || | 26147 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS || |
26148 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD || | 26148 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD || |
26149 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE || | 26149 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE || |
26150 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH || | 26150 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH || |
26151 keyCode == CLOSE_SQUARE_BRACKET); | 26151 keyCode == CLOSE_SQUARE_BRACKET); |
26152 } | 26152 } |
26153 } | 26153 } |
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
28019 // for details. All rights reserved. Use of this source code is governed by a | 28019 // for details. All rights reserved. Use of this source code is governed by a |
28020 // BSD-style license that can be found in the LICENSE file. | 28020 // BSD-style license that can be found in the LICENSE file. |
28021 | 28021 |
28022 | 28022 |
28023 // Iterator for arrays with fixed size. | 28023 // Iterator for arrays with fixed size. |
28024 class FixedSizeListIterator<T> implements Iterator<T> { | 28024 class FixedSizeListIterator<T> implements Iterator<T> { |
28025 final List<T> _array; | 28025 final List<T> _array; |
28026 final int _length; // Cache array length for faster access. | 28026 final int _length; // Cache array length for faster access. |
28027 int _position; | 28027 int _position; |
28028 T _current; | 28028 T _current; |
28029 | 28029 |
28030 FixedSizeListIterator(List<T> array) | 28030 FixedSizeListIterator(List<T> array) |
28031 : _array = array, | 28031 : _array = array, |
28032 _position = -1, | 28032 _position = -1, |
28033 _length = array.length; | 28033 _length = array.length; |
28034 | 28034 |
28035 bool moveNext() { | 28035 bool moveNext() { |
28036 int nextPosition = _position + 1; | 28036 int nextPosition = _position + 1; |
28037 if (nextPosition < _length) { | 28037 if (nextPosition < _length) { |
28038 _current = _array[nextPosition]; | 28038 _current = _array[nextPosition]; |
28039 _position = nextPosition; | 28039 _position = nextPosition; |
(...skipping 24 matching lines...) Expand all Loading... |
28064 _position = nextPosition; | 28064 _position = nextPosition; |
28065 return true; | 28065 return true; |
28066 } | 28066 } |
28067 _current = null; | 28067 _current = null; |
28068 _position = _array.length; | 28068 _position = _array.length; |
28069 return false; | 28069 return false; |
28070 } | 28070 } |
28071 | 28071 |
28072 T get current => _current; | 28072 T get current => _current; |
28073 } | 28073 } |
OLD | NEW |