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

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

Issue 16335012: Fixing some of the tests disabled from the chrome IDL roll. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /// The Dart HTML library. 1 /// The Dart HTML library.
2 library dart.dom.html; 2 library dart.dom.html;
3 3
4 import 'dart:async'; 4 import 'dart:async';
5 import 'dart:collection'; 5 import 'dart:collection';
6 import 'dart:_collection-dev' hide Symbol; 6 import 'dart:_collection-dev' hide Symbol;
7 import 'dart:html_common'; 7 import 'dart:html_common';
8 import 'dart:indexed_db'; 8 import 'dart:indexed_db';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:json' as json; 10 import 'dart:json' as json;
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 @DocsEditable 2233 @DocsEditable
2234 final int type; 2234 final int type;
2235 } 2235 }
2236 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2236 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2237 // for details. All rights reserved. Use of this source code is governed by a 2237 // for details. All rights reserved. Use of this source code is governed by a
2238 // BSD-style license that can be found in the LICENSE file. 2238 // BSD-style license that can be found in the LICENSE file.
2239 2239
2240 2240
2241 @DomName('CSSStyleDeclaration') 2241 @DomName('CSSStyleDeclaration')
2242 class CssStyleDeclaration native "CSSStyleDeclaration" { 2242 class CssStyleDeclaration native "CSSStyleDeclaration" {
2243 factory CssStyleDeclaration() => _CssStyleDeclarationFactoryProvider.createCss StyleDeclaration(); 2243 factory CssStyleDeclaration() => new CssStyleDeclaration.css('');
2244 factory CssStyleDeclaration.css(String css) => 2244
2245 _CssStyleDeclarationFactoryProvider.createCssStyleDeclaration_css(css); 2245 factory CssStyleDeclaration.css(String css) {
2246 final style = new Element.tag('div').style;
2247 style.cssText = css;
2248 return style;
2249 }
2246 2250
2247 2251
2248 @DomName('CSSStyleDeclaration.cssText') 2252 @DomName('CSSStyleDeclaration.cssText')
2249 @DocsEditable 2253 @DocsEditable
2250 String cssText; 2254 String cssText;
2251 2255
2252 @DomName('CSSStyleDeclaration.length') 2256 @DomName('CSSStyleDeclaration.length')
2253 @DocsEditable 2257 @DocsEditable
2254 final int length; 2258 final int length;
2255 2259
(...skipping 4628 matching lines...) Expand 10 before | Expand all | Expand 10 after
6884 return new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); 6888 return new _FrozenElementList._wrap($dom_querySelectorAll(selectors));
6885 } 6889 }
6886 } 6890 }
6887 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 6891 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
6888 // for details. All rights reserved. Use of this source code is governed by a 6892 // for details. All rights reserved. Use of this source code is governed by a
6889 // BSD-style license that can be found in the LICENSE file. 6893 // BSD-style license that can be found in the LICENSE file.
6890 6894
6891 6895
6892 @DomName('DocumentFragment') 6896 @DomName('DocumentFragment')
6893 class DocumentFragment extends Node native "DocumentFragment" { 6897 class DocumentFragment extends Node native "DocumentFragment" {
6894 factory DocumentFragment.html(String html) => 6898 factory DocumentFragment() => document.createDocumentFragment();
6895 _DocumentFragmentFactoryProvider.createDocumentFragment_html(html);
6896 6899
6897 factory DocumentFragment.svg(String svgContent) => 6900 factory DocumentFragment.html(String html) {
6898 _DocumentFragmentFactoryProvider.createDocumentFragment_svg(svgContent); 6901 final fragment = new DocumentFragment();
6902 fragment.innerHtml = html;
6903 return fragment;
6904 }
6905
6906 factory DocumentFragment.svg(String svgContent) {
6907 final fragment = new DocumentFragment();
6908 final e = new svg.SvgSvgElement();
6909 e.innerHtml = svgContent;
6910
6911 // Copy list first since we don't want liveness during iteration.
6912 final List nodes = new List.from(e.nodes);
6913 fragment.nodes.addAll(nodes);
6914 return fragment;
6915 }
6899 6916
6900 // Native field is used only by Dart code so does not lead to instantiation 6917 // Native field is used only by Dart code so does not lead to instantiation
6901 // of native classes 6918 // of native classes
6902 @Creates('Null') 6919 @Creates('Null')
6903 List<Element> _children; 6920 List<Element> _children;
6904 6921
6905 List<Element> get children { 6922 List<Element> get children {
6906 if (_children == null) { 6923 if (_children == null) {
6907 _children = new FilteredElementList(this); 6924 _children = new FilteredElementList(this);
6908 } 6925 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
6952 6969
6953 /** 6970 /**
6954 * Parses the specified text as HTML and adds the resulting node after the 6971 * Parses the specified text as HTML and adds the resulting node after the
6955 * last child of this document fragment. 6972 * last child of this document fragment.
6956 */ 6973 */
6957 void appendHtml(String text) { 6974 void appendHtml(String text) {
6958 this.append(new DocumentFragment.html(text)); 6975 this.append(new DocumentFragment.html(text));
6959 } 6976 }
6960 6977
6961 6978
6962 @DomName('DocumentFragment.DocumentFragment')
6963 @DocsEditable
6964 factory DocumentFragment() {
6965 return DocumentFragment._create_1();
6966 }
6967 static DocumentFragment _create_1() => JS('DocumentFragment', 'new DocumentFra gment()');
6968
6969 @DomName('DocumentFragment.childElementCount') 6979 @DomName('DocumentFragment.childElementCount')
6970 @DocsEditable 6980 @DocsEditable
6971 @Experimental // untriaged 6981 @Experimental // untriaged
6972 final int childElementCount; 6982 final int childElementCount;
6973 6983
6974 @DomName('DocumentFragment.firstElementChild') 6984 @DomName('DocumentFragment.firstElementChild')
6975 @DocsEditable 6985 @DocsEditable
6976 @Experimental // untriaged 6986 @Experimental // untriaged
6977 final Element firstElementChild; 6987 final Element firstElementChild;
6978 6988
(...skipping 10809 matching lines...) Expand 10 before | Expand all | Expand 10 after
17788 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 17798 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
17789 // for details. All rights reserved. Use of this source code is governed by a 17799 // for details. All rights reserved. Use of this source code is governed by a
17790 // BSD-style license that can be found in the LICENSE file. 17800 // BSD-style license that can be found in the LICENSE file.
17791 17801
17792 // WARNING: Do not edit - generated code. 17802 // WARNING: Do not edit - generated code.
17793 17803
17794 17804
17795 @DomName('Range') 17805 @DomName('Range')
17796 @Unstable 17806 @Unstable
17797 class Range native "Range" { 17807 class Range native "Range" {
17808 factory Range() => document.$dom_createRange();
17798 17809
17799 @DomName('Range.Range')
17800 @DocsEditable
17801 factory Range() {
17802 return Range._create_1();
17803 }
17804 static Range _create_1() => JS('Range', 'new Range()');
17805 17810
17806 @DomName('Range.END_TO_END') 17811 @DomName('Range.END_TO_END')
17807 @DocsEditable 17812 @DocsEditable
17808 static const int END_TO_END = 2; 17813 static const int END_TO_END = 2;
17809 17814
17810 @DomName('Range.END_TO_START') 17815 @DomName('Range.END_TO_START')
17811 @DocsEditable 17816 @DocsEditable
17812 static const int END_TO_START = 3; 17817 static const int END_TO_START = 3;
17813 17818
17814 @DomName('Range.NODE_AFTER') 17819 @DomName('Range.NODE_AFTER')
(...skipping 2940 matching lines...) Expand 10 before | Expand all | Expand 10 after
20755 } 20760 }
20756 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 20761 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
20757 // for details. All rights reserved. Use of this source code is governed by a 20762 // for details. All rights reserved. Use of this source code is governed by a
20758 // BSD-style license that can be found in the LICENSE file. 20763 // BSD-style license that can be found in the LICENSE file.
20759 20764
20760 // WARNING: Do not edit - generated code. 20765 // WARNING: Do not edit - generated code.
20761 20766
20762 20767
20763 @DomName('Text') 20768 @DomName('Text')
20764 class Text extends CharacterData native "Text" { 20769 class Text extends CharacterData native "Text" {
20765 20770 factory Text(String data) => document.$dom_createTextNode(data);
20766 @DomName('Text.Text')
20767 @DocsEditable
20768 factory Text([String data]) {
20769 if (?data) {
20770 return Text._create_1(data);
20771 }
20772 return Text._create_2();
20773 }
20774 static Text _create_1(data) => JS('Text', 'new Text(#)', data);
20775 static Text _create_2() => JS('Text', 'new Text()');
20776 20771
20777 @JSName('webkitInsertionParent') 20772 @JSName('webkitInsertionParent')
20778 @DomName('Text.webkitInsertionParent') 20773 @DomName('Text.webkitInsertionParent')
20779 @DocsEditable 20774 @DocsEditable
20780 @SupportedBrowser(SupportedBrowser.CHROME) 20775 @SupportedBrowser(SupportedBrowser.CHROME)
20781 @SupportedBrowser(SupportedBrowser.SAFARI) 20776 @SupportedBrowser(SupportedBrowser.SAFARI)
20782 @Experimental 20777 @Experimental
20783 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=21067 20778 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=21067
20784 final Node insertionParent; 20779 final Node insertionParent;
20785 20780
(...skipping 8308 matching lines...) Expand 10 before | Expand all | Expand 10 after
29094 return _iterator.moveNext(); 29089 return _iterator.moveNext();
29095 } 29090 }
29096 29091
29097 E get current => _iterator.current; 29092 E get current => _iterator.current;
29098 } 29093 }
29099 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 29094 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
29100 // for details. All rights reserved. Use of this source code is governed by a 29095 // for details. All rights reserved. Use of this source code is governed by a
29101 // BSD-style license that can be found in the LICENSE file. 29096 // BSD-style license that can be found in the LICENSE file.
29102 29097
29103 29098
29104 class _CssStyleDeclarationFactoryProvider {
29105 static CssStyleDeclaration createCssStyleDeclaration_css(String css) {
29106 final style = new Element.tag('div').style;
29107 style.cssText = css;
29108 return style;
29109 }
29110
29111 static CssStyleDeclaration createCssStyleDeclaration() {
29112 return new CssStyleDeclaration.css('');
29113 }
29114 }
29115
29116 class _DocumentFragmentFactoryProvider {
29117 @DomName('Document.createDocumentFragment')
29118 static DocumentFragment createDocumentFragment() =>
29119 document.createDocumentFragment();
29120
29121 static DocumentFragment createDocumentFragment_html(String html) {
29122 final fragment = new DocumentFragment();
29123 fragment.innerHtml = html;
29124 return fragment;
29125 }
29126
29127 // TODO(nweiz): enable this when XML is ported.
29128 // factory DocumentFragment.xml(String xml) {
29129 // final fragment = new DocumentFragment();
29130 // final e = new XMLElement.tag("xml");
29131 // e.innerHtml = xml;
29132 //
29133 // // Copy list first since we don't want liveness during iteration.
29134 // final List nodes = new List.from(e.nodes);
29135 // fragment.nodes.addAll(nodes);
29136 // return fragment;
29137 // }
29138
29139 static DocumentFragment createDocumentFragment_svg(String svgContent) {
29140 final fragment = new DocumentFragment();
29141 final e = new svg.SvgSvgElement();
29142 e.innerHtml = svgContent;
29143
29144 // Copy list first since we don't want liveness during iteration.
29145 final List nodes = new List.from(e.nodes);
29146 fragment.nodes.addAll(nodes);
29147 return fragment;
29148 }
29149 }
29150 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
29151 // for details. All rights reserved. Use of this source code is governed by a
29152 // BSD-style license that can be found in the LICENSE file.
29153
29154
29155 // Conversions for Window. These check if the window is the local 29099 // Conversions for Window. These check if the window is the local
29156 // window, and if it's not, wraps or unwraps it with a secure wrapper. 29100 // window, and if it's not, wraps or unwraps it with a secure wrapper.
29157 // We need to test for EventTarget here as well as it's a base type. 29101 // We need to test for EventTarget here as well as it's a base type.
29158 // We omit an unwrapper for Window as no methods take a non-local 29102 // We omit an unwrapper for Window as no methods take a non-local
29159 // window as a parameter. 29103 // window as a parameter.
29160 29104
29161 29105
29162 DateTime _convertNativeToDart_DateTime(date) { 29106 DateTime _convertNativeToDart_DateTime(date) {
29163 var millisSinceEpoch = JS('int', '#.getTime()', date); 29107 var millisSinceEpoch = JS('int', '#.getTime()', date);
29164 return new DateTime.fromMillisecondsSinceEpoch(millisSinceEpoch, isUtc: true); 29108 return new DateTime.fromMillisecondsSinceEpoch(millisSinceEpoch, isUtc: true);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
29440 throw new UnsupportedError("keyIdentifier is unsupported."); 29384 throw new UnsupportedError("keyIdentifier is unsupported.");
29441 } 29385 }
29442 void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable, 29386 void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable,
29443 Window view, String keyIdentifier, int keyLocation, bool ctrlKey, 29387 Window view, String keyIdentifier, int keyLocation, bool ctrlKey,
29444 bool altKey, bool shiftKey, bool metaKey, 29388 bool altKey, bool shiftKey, bool metaKey,
29445 bool altGraphKey) { 29389 bool altGraphKey) {
29446 throw new UnsupportedError( 29390 throw new UnsupportedError(
29447 "Cannot initialize a KeyboardEvent from a KeyEvent."); 29391 "Cannot initialize a KeyboardEvent from a KeyEvent.");
29448 } 29392 }
29449 } 29393 }
29450 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
29451 // for details. All rights reserved. Use of this source code is governed by a
29452 // BSD-style license that can be found in the LICENSE file.
29453
29454
29455 class _TextFactoryProvider {
29456 static Text createText(String data) =>
29457 JS('Text', 'document.createTextNode(#)', data);
29458 }
29459 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 29394 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
29460 // for details. All rights reserved. Use of this source code is governed by a 29395 // for details. All rights reserved. Use of this source code is governed by a
29461 // BSD-style license that can be found in the LICENSE file. 29396 // BSD-style license that can be found in the LICENSE file.
29462 29397
29463 29398
29464 // On Firefox 11, the object obtained from 'window.location' is very strange. 29399 // On Firefox 11, the object obtained from 'window.location' is very strange.
29465 // It can't be monkey-patched and seems immune to putting methods on 29400 // It can't be monkey-patched and seems immune to putting methods on
29466 // Object.prototype. We are forced to wrap the object. 29401 // Object.prototype. We are forced to wrap the object.
29467 29402
29468 class _LocationWrapper implements Location { 29403 class _LocationWrapper implements Location {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
29613 _position = nextPosition; 29548 _position = nextPosition;
29614 return true; 29549 return true;
29615 } 29550 }
29616 _current = null; 29551 _current = null;
29617 _position = _array.length; 29552 _position = _array.length;
29618 return false; 29553 return false;
29619 } 29554 }
29620 29555
29621 T get current => _current; 29556 T get current => _current;
29622 } 29557 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698