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

Side by Side Diff: tool/input_sdk/lib/html/ddc/html_ddc.dart

Issue 1633003002: Add --modules=node support (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: regen sdk and expectations Created 4 years, 10 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
OLDNEW
1 /** 1 /**
2 * HTML elements and other resources for web-based applications that need to 2 * HTML elements and other resources for web-based applications that need to
3 * interact with the browser and the DOM (Document Object Model). 3 * interact with the browser and the DOM (Document Object Model).
4 * 4 *
5 * This library includes DOM element types, CSS styling, local storage, 5 * This library includes DOM element types, CSS styling, local storage,
6 * media, speech, events, and more. 6 * media, speech, events, and more.
7 * To get started, 7 * To get started,
8 * check out the [Element] class, the base class for many of the HTML 8 * check out the [Element] class, the base class for many of the HTML
9 * DOM types. 9 * DOM types.
10 * 10 *
11 * ## Other resources 11 * ## Other resources
12 * 12 *
13 * * If you've never written a web app before, try our 13 * * If you've never written a web app before, try our
14 * tutorials—[A Game of Darts](http://dartlang.org/docs/tutorials). 14 * tutorials—[A Game of Darts](http://dartlang.org/docs/tutorials).
15 * 15 *
16 * * To see some web-based Dart apps in action and to play with the code, 16 * * To see some web-based Dart apps in action and to play with the code,
17 * download 17 * download
18 * [Dart Editor](http://www.dartlang.org/#get-started) 18 * [Dart Editor](http://www.dartlang.org/#get-started)
19 * and run its built-in examples. 19 * and run its built-in examples.
20 * 20 *
21 * * For even more examples, see 21 * * For even more examples, see
22 * [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples) 22 * [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
23 * on Github. 23 * on Github.
24 */ 24 */
25 library dart.dom.html; 25 library dart.dom.html;
26 26
vsm 2016/01/26 14:09:40 Note, I'm auto-generating this file right now. Sh
ochafik 2016/01/26 16:27:37 Platform.supportsTypedData will return true in nod
27 import 'dart:_runtime' show global_;
27 import 'dart:async'; 28 import 'dart:async';
28 import 'dart:collection'; 29 import 'dart:collection';
29 import 'dart:_internal' hide Symbol; 30 import 'dart:_internal' hide Symbol;
30 import 'dart:html_common'; 31 import 'dart:html_common';
31 import 'dart:isolate'; 32 import 'dart:isolate';
32 import "dart:convert"; 33 import "dart:convert";
33 import 'dart:math'; 34 import 'dart:math';
34 import 'dart:_native_typed_data'; 35 import 'dart:_native_typed_data';
35 import 'dart:typed_data'; 36 import 'dart:typed_data';
36 import 'dart:_isolate_helper' show IsolateNatives; 37 import 'dart:_isolate_helper' show IsolateNatives;
(...skipping 4806 matching lines...) Expand 10 before | Expand all | Expand 10 after
4843 /** 4844 /**
4844 * Parses the specified text as HTML and adds the resulting node after the 4845 * Parses the specified text as HTML and adds the resulting node after the
4845 * last child of this document fragment. 4846 * last child of this document fragment.
4846 */ 4847 */
4847 void appendHtml(String text, {NodeValidator validator, 4848 void appendHtml(String text, {NodeValidator validator,
4848 NodeTreeSanitizer, treeSanitizer}) { 4849 NodeTreeSanitizer, treeSanitizer}) {
4849 this.append(new DocumentFragment.html(text, validator: validator, 4850 this.append(new DocumentFragment.html(text, validator: validator,
4850 treeSanitizer: treeSanitizer)); 4851 treeSanitizer: treeSanitizer));
4851 } 4852 }
4852 4853
4853 /** 4854 /**
4854 * Alias for [querySelector]. Note this function is deprecated because its 4855 * Alias for [querySelector]. Note this function is deprecated because its
4855 * semantics will be changing in the future. 4856 * semantics will be changing in the future.
4856 */ 4857 */
4857 @deprecated 4858 @deprecated
4858 @Experimental() 4859 @Experimental()
4859 @DomName('DocumentFragment.querySelector') 4860 @DomName('DocumentFragment.querySelector')
4860 Element query(String relativeSelectors) { 4861 Element query(String relativeSelectors) {
4861 return querySelector(relativeSelectors); 4862 return querySelector(relativeSelectors);
4862 } 4863 }
4863 4864
4864 /** 4865 /**
4865 * Alias for [querySelectorAll]. Note this function is deprecated because its 4866 * Alias for [querySelectorAll]. Note this function is deprecated because its
4866 * semantics will be changing in the future. 4867 * semantics will be changing in the future.
4867 */ 4868 */
4868 @deprecated 4869 @deprecated
4869 @Experimental() 4870 @Experimental()
4870 @DomName('DocumentFragment.querySelectorAll') 4871 @DomName('DocumentFragment.querySelectorAll')
4871 ElementList<Element> queryAll(String relativeSelectors) { 4872 ElementList<Element> queryAll(String relativeSelectors) {
4872 return querySelectorAll(relativeSelectors); 4873 return querySelectorAll(relativeSelectors);
4873 } 4874 }
4874 // To suppress missing implicit constructor warnings. 4875 // To suppress missing implicit constructor warnings.
(...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after
7521 * Normally events should be created via their constructors, if available. 7522 * Normally events should be created via their constructors, if available.
7522 * 7523 *
7523 * var e = new Event.type('MouseEvent', 'mousedown', true, true); 7524 * var e = new Event.type('MouseEvent', 'mousedown', true, true);
7524 */ 7525 */
7525 factory Event.eventType(String type, String name, {bool canBubble: true, 7526 factory Event.eventType(String type, String name, {bool canBubble: true,
7526 bool cancelable: true}) { 7527 bool cancelable: true}) {
7527 final Event e = document._createEvent(type); 7528 final Event e = document._createEvent(type);
7528 e._initEvent(name, canBubble, cancelable); 7529 e._initEvent(name, canBubble, cancelable);
7529 return e; 7530 return e;
7530 } 7531 }
7531 7532
7532 /** The CSS selector involved with event delegation. */ 7533 /** The CSS selector involved with event delegation. */
7533 String _selector; 7534 String _selector;
7534 7535
7535 /** 7536 /**
7536 * A pointer to the element whose CSS selector matched within which an event 7537 * A pointer to the element whose CSS selector matched within which an event
7537 * was fired. If this Event was not associated with any Event delegation, 7538 * was fired. If this Event was not associated with any Event delegation,
7538 * accessing this value will throw an [UnsupportedError]. 7539 * accessing this value will throw an [UnsupportedError].
7539 */ 7540 */
7540 Element get matchingTarget { 7541 Element get matchingTarget {
7541 if (_selector == null) { 7542 if (_selector == null) {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
7756 Events(this._ptr); 7757 Events(this._ptr);
7757 7758
7758 Stream operator [](String type) { 7759 Stream operator [](String type) {
7759 return new _EventStream(_ptr, type, false); 7760 return new _EventStream(_ptr, type, false);
7760 } 7761 }
7761 } 7762 }
7762 7763
7763 class ElementEvents extends Events { 7764 class ElementEvents extends Events {
7764 /* Raw event target. */ 7765 /* Raw event target. */
7765 static final webkitEvents = { 7766 static final webkitEvents = {
7766 'animationend' : 'webkitAnimationEnd', 7767 'animationend' : 'webkitAnimationEnd',
7767 'animationiteration' : 'webkitAnimationIteration', 7768 'animationiteration' : 'webkitAnimationIteration',
7768 'animationstart' : 'webkitAnimationStart', 7769 'animationstart' : 'webkitAnimationStart',
7769 'fullscreenchange' : 'webkitfullscreenchange', 7770 'fullscreenchange' : 'webkitfullscreenchange',
7770 'fullscreenerror' : 'webkitfullscreenerror', 7771 'fullscreenerror' : 'webkitfullscreenerror',
7771 'keyadded' : 'webkitkeyadded', 7772 'keyadded' : 'webkitkeyadded',
7772 'keyerror' : 'webkitkeyerror', 7773 'keyerror' : 'webkitkeyerror',
7773 'keymessage' : 'webkitkeymessage', 7774 'keymessage' : 'webkitkeymessage',
7774 'needkey' : 'webkitneedkey', 7775 'needkey' : 'webkitneedkey',
7775 'pointerlockchange' : 'webkitpointerlockchange', 7776 'pointerlockchange' : 'webkitpointerlockchange',
7776 'pointerlockerror' : 'webkitpointerlockerror', 7777 'pointerlockerror' : 'webkitpointerlockerror',
7777 'resourcetimingbufferfull' : 'webkitresourcetimingbufferfull', 7778 'resourcetimingbufferfull' : 'webkitresourcetimingbufferfull',
7778 'transitionend': 'webkitTransitionEnd', 7779 'transitionend': 'webkitTransitionEnd',
7779 'speechchange' : 'webkitSpeechChange' 7780 'speechchange' : 'webkitSpeechChange'
7780 }; 7781 };
7781 7782
7782 ElementEvents(Element ptr) : super(ptr); 7783 ElementEvents(Element ptr) : super(ptr);
7783 7784
7784 Stream operator [](String type) { 7785 Stream operator [](String type) {
7785 if (webkitEvents.keys.contains(type.toLowerCase())) { 7786 if (webkitEvents.keys.contains(type.toLowerCase())) {
7786 if (Device.isWebKit) { 7787 if (Device.isWebKit) {
7787 return new _ElementEventStreamImpl( 7788 return new _ElementEventStreamImpl(
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
8597 responseType: responseType, 8598 responseType: responseType,
8598 requestHeaders: requestHeaders, sendData: formData, 8599 requestHeaders: requestHeaders, sendData: formData,
8599 onProgress: onProgress); 8600 onProgress: onProgress);
8600 } 8601 }
8601 8602
8602 /** 8603 /**
8603 * Creates and sends a URL request for the specified [url]. 8604 * Creates and sends a URL request for the specified [url].
8604 * 8605 *
8605 * By default `request` will perform an HTTP GET request, but a different 8606 * By default `request` will perform an HTTP GET request, but a different
8606 * method (`POST`, `PUT`, `DELETE`, etc) can be used by specifying the 8607 * method (`POST`, `PUT`, `DELETE`, etc) can be used by specifying the
8607 * [method] parameter. (See also [HttpRequest.postFormData] for `POST` 8608 * [method] parameter. (See also [HttpRequest.postFormData] for `POST`
8608 * requests only. 8609 * requests only.
8609 * 8610 *
8610 * The Future is completed when the response is available. 8611 * The Future is completed when the response is available.
8611 * 8612 *
8612 * If specified, `sendData` will send data in the form of a [ByteBuffer], 8613 * If specified, `sendData` will send data in the form of a [ByteBuffer],
8613 * [Blob], [Document], [String], or [FormData] along with the HttpRequest. 8614 * [Blob], [Document], [String], or [FormData] along with the HttpRequest.
8614 * 8615 *
8615 * If specified, [responseType] sets the desired response format for the 8616 * If specified, [responseType] sets the desired response format for the
8616 * request. By default it is [String], but can also be 'arraybuffer', 'blob', 8617 * request. By default it is [String], but can also be 'arraybuffer', 'blob',
8617 * 'document', 'json', or 'text'. See also [HttpRequest.responseType] 8618 * 'document', 'json', or 'text'. See also [HttpRequest.responseType]
8618 * for more information. 8619 * for more information.
8619 * 8620 *
8620 * The [withCredentials] parameter specified that credentials such as a cookie 8621 * The [withCredentials] parameter specified that credentials such as a cookie
8621 * (already) set in the header or 8622 * (already) set in the header or
8622 * [authorization headers](http://tools.ietf.org/html/rfc1945#section-10.2) 8623 * [authorization headers](http://tools.ietf.org/html/rfc1945#section-10.2)
8623 * should be specified for the request. Details to keep in mind when using 8624 * should be specified for the request. Details to keep in mind when using
8624 * credentials: 8625 * credentials:
8625 * 8626 *
8626 * * Using credentials is only useful for cross-origin requests. 8627 * * Using credentials is only useful for cross-origin requests.
8627 * * The `Access-Control-Allow-Origin` header of `url` cannot contain a wildca rd (*). 8628 * * The `Access-Control-Allow-Origin` header of `url` cannot contain a wildca rd (*).
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
8690 xhr.onLoad.listen((e) { 8691 xhr.onLoad.listen((e) {
8691 var accepted = xhr.status >= 200 && xhr.status < 300; 8692 var accepted = xhr.status >= 200 && xhr.status < 300;
8692 var fileUri = xhr.status == 0; // file:// URIs have status of 0. 8693 var fileUri = xhr.status == 0; // file:// URIs have status of 0.
8693 var notModified = xhr.status == 304; 8694 var notModified = xhr.status == 304;
8694 // Redirect status is specified up to 307, but others have been used in 8695 // Redirect status is specified up to 307, but others have been used in
8695 // practice. Notably Google Drive uses 308 Resume Incomplete for 8696 // practice. Notably Google Drive uses 308 Resume Incomplete for
8696 // resumable uploads, and it's also been used as a redirect. The 8697 // resumable uploads, and it's also been used as a redirect. The
8697 // redirect case will be handled by the browser before it gets to us, 8698 // redirect case will be handled by the browser before it gets to us,
8698 // so if we see it we should pass it through to the user. 8699 // so if we see it we should pass it through to the user.
8699 var unknownRedirect = xhr.status > 307 && xhr.status < 400; 8700 var unknownRedirect = xhr.status > 307 && xhr.status < 400;
8700 8701
8701 if (accepted || fileUri || notModified || unknownRedirect) { 8702 if (accepted || fileUri || notModified || unknownRedirect) {
8702 completer.complete(xhr); 8703 completer.complete(xhr);
8703 } else { 8704 } else {
8704 completer.completeError(e); 8705 completer.completeError(e);
8705 } 8706 }
8706 }); 8707 });
8707 8708
8708 xhr.onError.listen(completer.completeError); 8709 xhr.onError.listen(completer.completeError);
8709 8710
8710 if (sendData != null) { 8711 if (sendData != null) {
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
10550 * The [type] of the event identifies what kind of interaction occurred. 10551 * The [type] of the event identifies what kind of interaction occurred.
10551 * 10552 *
10552 * See also: 10553 * See also:
10553 * 10554 *
10554 * * [KeyboardEvent](https://developer.mozilla.org/en/DOM/KeyboardEvent) at MDN. 10555 * * [KeyboardEvent](https://developer.mozilla.org/en/DOM/KeyboardEvent) at MDN.
10555 */ 10556 */
10556 @DomName('KeyboardEvent') 10557 @DomName('KeyboardEvent')
10557 @Native("KeyboardEvent") 10558 @Native("KeyboardEvent")
10558 class KeyboardEvent extends UIEvent { 10559 class KeyboardEvent extends UIEvent {
10559 10560
10560 /** 10561 /**
10561 * Programmatically create a KeyboardEvent. 10562 * Programmatically create a KeyboardEvent.
10562 * 10563 *
10563 * Due to browser differences, keyCode, charCode, or keyIdentifier values 10564 * Due to browser differences, keyCode, charCode, or keyIdentifier values
10564 * cannot be specified in this base level constructor. This constructor 10565 * cannot be specified in this base level constructor. This constructor
10565 * enables the user to programmatically create and dispatch a [KeyboardEvent], 10566 * enables the user to programmatically create and dispatch a [KeyboardEvent],
10566 * but it will not contain any particular key content. For programmatically 10567 * but it will not contain any particular key content. For programmatically
10567 * creating keyboard events with specific key value contents, see the custom 10568 * creating keyboard events with specific key value contents, see the custom
10568 * Event [KeyEvent]. 10569 * Event [KeyEvent].
10569 */ 10570 */
10570 factory KeyboardEvent(String type, 10571 factory KeyboardEvent(String type,
10571 {Window view, bool canBubble: true, bool cancelable: true, 10572 {Window view, bool canBubble: true, bool cancelable: true,
10572 int keyLocation: 1, bool ctrlKey: false, 10573 int keyLocation: 1, bool ctrlKey: false,
10573 bool altKey: false, bool shiftKey: false, bool metaKey: false}) { 10574 bool altKey: false, bool shiftKey: false, bool metaKey: false}) {
10574 if (view == null) { 10575 if (view == null) {
10575 view = window; 10576 view = window;
10576 } 10577 }
10577 KeyboardEvent e = document._createEvent("KeyboardEvent"); 10578 KeyboardEvent e = document._createEvent("KeyboardEvent");
10578 e._initKeyboardEvent(type, canBubble, cancelable, view, "", 10579 e._initKeyboardEvent(type, canBubble, cancelable, view, "",
(...skipping 7914 matching lines...) Expand 10 before | Expand all | Expand 10 after
18493 // for details. All rights reserved. Use of this source code is governed by a 18494 // for details. All rights reserved. Use of this source code is governed by a
18494 // BSD-style license that can be found in the LICENSE file. 18495 // BSD-style license that can be found in the LICENSE file.
18495 18496
18496 18497
18497 // Iterator for arrays with fixed size. 18498 // Iterator for arrays with fixed size.
18498 class FixedSizeListIterator<T> implements Iterator<T> { 18499 class FixedSizeListIterator<T> implements Iterator<T> {
18499 final List<T> _array; 18500 final List<T> _array;
18500 final int _length; // Cache array length for faster access. 18501 final int _length; // Cache array length for faster access.
18501 int _position; 18502 int _position;
18502 T _current; 18503 T _current;
18503 18504
18504 FixedSizeListIterator(List<T> array) 18505 FixedSizeListIterator(List<T> array)
18505 : _array = array, 18506 : _array = array,
18506 _position = -1, 18507 _position = -1,
18507 _length = array.length; 18508 _length = array.length;
18508 18509
18509 bool moveNext() { 18510 bool moveNext() {
18510 int nextPosition = _position + 1; 18511 int nextPosition = _position + 1;
18511 if (nextPosition < _length) { 18512 if (nextPosition < _length) {
18512 _current = _array[nextPosition]; 18513 _current = _array[nextPosition];
18513 _position = nextPosition; 18514 _position = nextPosition;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
18952 @Experimental() // untriaged 18953 @Experimental() // untriaged
18953 int get location => throw new UnimplementedError(); 18954 int get location => throw new UnimplementedError();
18954 @Experimental() // untriaged 18955 @Experimental() // untriaged
18955 bool get repeat => throw new UnimplementedError(); 18956 bool get repeat => throw new UnimplementedError();
18956 dynamic get _get_view => throw new UnimplementedError(); 18957 dynamic get _get_view => throw new UnimplementedError();
18957 } 18958 }
18958 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 18959 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
18959 // for details. All rights reserved. Use of this source code is governed by a 18960 // for details. All rights reserved. Use of this source code is governed by a
18960 // BSD-style license that can be found in the LICENSE file. 18961 // BSD-style license that can be found in the LICENSE file.
18961 18962
18962
18963 class Platform { 18963 class Platform {
18964 /** 18964 /**
18965 * Returns true if dart:typed_data types are supported on this 18965 * Returns true if dart:typed_data types are supported on this
18966 * browser. If false, using these types will generate a runtime 18966 * browser. If false, using these types will generate a runtime
18967 * error. 18967 * error.
18968 */ 18968 */
18969 static final supportsTypedData = JS('bool', '!!(window.ArrayBuffer)'); 18969 static final supportsTypedData = JS('bool', '!!($global_.ArrayBuffer)');
18970 18970
18971 /** 18971 /**
18972 * Returns true if SIMD types in dart:typed_data types are supported 18972 * Returns true if SIMD types in dart:typed_data types are supported
18973 * on this browser. If false, using these types will generate a runtime 18973 * on this browser. If false, using these types will generate a runtime
18974 * error. 18974 * error.
18975 */ 18975 */
18976 static final supportsSimd = false; 18976 static final supportsSimd = false;
18977 } 18977 }
18978 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 18978 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
18979 // for details. All rights reserved. Use of this source code is governed by a 18979 // for details. All rights reserved. Use of this source code is governed by a
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
19471 * Each web page loaded in the browser has its own [Window], which is a 19471 * Each web page loaded in the browser has its own [Window], which is a
19472 * container for the web page. 19472 * container for the web page.
19473 * 19473 *
19474 * If the web page has any `<iframe>` elements, then each `<iframe>` has its own 19474 * If the web page has any `<iframe>` elements, then each `<iframe>` has its own
19475 * [Window] object, which is accessible only to that `<iframe>`. 19475 * [Window] object, which is accessible only to that `<iframe>`.
19476 * 19476 *
19477 * See also: 19477 * See also:
19478 * 19478 *
19479 * * [Window](https://developer.mozilla.org/en-US/docs/Web/API/window) from MD N. 19479 * * [Window](https://developer.mozilla.org/en-US/docs/Web/API/window) from MD N.
19480 */ 19480 */
19481 Window get window => wrap_jso(JS('', 'window')); 19481
19482 final Window window = wrap_jso(JS('', '$global_'));
19482 19483
19483 /** 19484 /**
19484 * Root node for all content in a web page. 19485 * Root node for all content in a web page.
19485 */ 19486 */
19486 HtmlDocument get document => wrap_jso(JS('HtmlDocument', 'document')); 19487 HtmlDocument get document => wrap_jso(JS('HtmlDocument', 'document'));
19487 19488
19488 // Workaround for tags like <cite> that lack their own Element subclass -- 19489 // Workaround for tags like <cite> that lack their own Element subclass --
19489 // Dart issue 1990. 19490 // Dart issue 1990.
19490 @Native("HTMLElement") 19491 @Native("HTMLElement")
19491 class HtmlElement extends Element { 19492 class HtmlElement extends Element {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
19711 } 19712 }
19712 return null; 19713 return null;
19713 } 19714 }
19714 19715
19715 Function _getHtmlFunction(String key) { 19716 Function _getHtmlFunction(String key) {
19716 if (htmlBlinkFunctionMap.containsKey(key)) { 19717 if (htmlBlinkFunctionMap.containsKey(key)) {
19717 return htmlBlinkFunctionMap[key](); 19718 return htmlBlinkFunctionMap[key]();
19718 } 19719 }
19719 return null; 19720 return null;
19720 } 19721 }
19721
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698