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

Side by Side Diff: tools/dom/templates/html/impl/impl_Document.darttemplate

Issue 1488793002: Tweak Document.createElement for better inlining (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 @DocsEditable() 7 @DocsEditable()
8 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME extends Node 8 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME extends Node
9 { 9 {
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 $endif 57 $endif
58 } 58 }
59 59
60 /// *Deprecated*: use [supportsRegisterElement] instead. 60 /// *Deprecated*: use [supportsRegisterElement] instead.
61 @deprecated 61 @deprecated
62 bool get supportsRegister => supportsRegisterElement; 62 bool get supportsRegister => supportsRegisterElement;
63 63
64 @DomName('Document.createElement') 64 @DomName('Document.createElement')
65 Element createElement(String tagName, [String typeExtension]) { 65 Element createElement(String tagName, [String typeExtension]) {
66 $if DART2JS 66 $if DART2JS
67 if (typeExtension == null) { 67 return (typeExtension == null)
68 return _createElement_2(tagName); 68 ? _createElement_2(tagName)
69 } else { 69 : _createElement(tagName, typeExtension);
70 return _createElement(tagName, typeExtension);
71 }
72 $else 70 $else
73 var newElement = (typeExtension == null) ? 71 var newElement = (typeExtension == null) ?
74 _blink.BlinkDocument.instance.createElement_Callback_1_(unwrap_jso(this), tagName) : 72 _blink.BlinkDocument.instance.createElement_Callback_1_(unwrap_jso(this), tagName) :
75 _blink.BlinkDocument.instance.createElement_Callback_2_(unwrap_jso(this), tagName, typeExtension); 73 _blink.BlinkDocument.instance.createElement_Callback_2_(unwrap_jso(this), tagName, typeExtension);
76 74
77 var wrapped = js.getDartHtmlWrapperFor(newElement); // Here's our Dart clas s. 75 var wrapped = js.getDartHtmlWrapperFor(newElement); // Here's our Dart clas s.
78 if (wrapped != null) { 76 if (wrapped != null) {
79 wrapped.blink_jsObject = newElement; 77 wrapped.blink_jsObject = newElement;
80 } else { 78 } else {
81 wrapped = wrap_jso(newElement); 79 wrapped = wrap_jso(newElement);
(...skipping 18 matching lines...) Expand all
100 // omit the typeExtension if it's null on Firefox or we get an is="null" attri bute. 98 // omit the typeExtension if it's null on Firefox or we get an is="null" attri bute.
101 @DomName('Document.createElementNS') 99 @DomName('Document.createElementNS')
102 _createElementNS_2(String namespaceURI, String qualifiedName) => 100 _createElementNS_2(String namespaceURI, String qualifiedName) =>
103 JS('', '#.createElementNS(#, #)', this, namespaceURI, qualifiedName); 101 JS('', '#.createElementNS(#, #)', this, namespaceURI, qualifiedName);
104 102
105 $endif 103 $endif
106 @DomName('Document.createElementNS') 104 @DomName('Document.createElementNS')
107 @DocsEditable() 105 @DocsEditable()
108 Element createElementNS(String namespaceURI, String qualifiedName, [String typ eExtension]) { 106 Element createElementNS(String namespaceURI, String qualifiedName, [String typ eExtension]) {
109 $if DART2JS 107 $if DART2JS
110 if (typeExtension == null) { 108 return (typeExtension == null)
111 return _createElementNS_2(namespaceURI, qualifiedName); 109 ? _createElementNS_2(namespaceURI, qualifiedName)
112 } else { 110 : _createElementNS(namespaceURI, qualifiedName, typeExtension);
113 return _createElementNS(namespaceURI, qualifiedName, typeExtension);
114 }
115 $else 111 $else
116 var newElement = (typeExtension == null) ? 112 var newElement = (typeExtension == null) ?
117 _blink.BlinkDocument.instance.createElementNS_Callback_2_(unwrap_jso(this) , namespaceURI, qualifiedName) : 113 _blink.BlinkDocument.instance.createElementNS_Callback_2_(unwrap_jso(this) , namespaceURI, qualifiedName) :
118 _blink.BlinkDocument.instance.createElementNS_Callback_3_(unwrap_jso(this) , namespaceURI, qualifiedName, typeExtension); 114 _blink.BlinkDocument.instance.createElementNS_Callback_3_(unwrap_jso(this) , namespaceURI, qualifiedName, typeExtension);
119 115
120 var wrapped; 116 var wrapped;
121 117
122 wrapped = js.getDartHtmlWrapperFor(newElement); // Here's our Dart class. 118 wrapped = js.getDartHtmlWrapperFor(newElement); // Here's our Dart class.
123 if (wrapped != null) { 119 if (wrapped != null) {
124 wrapped.blink_jsObject = newElement; 120 wrapped.blink_jsObject = newElement;
(...skipping 17 matching lines...) Expand all
142 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)', 138 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)',
143 this, root, whatToShow, filter); 139 this, root, whatToShow, filter);
144 140
145 @DomName('Document.createTreeWalker') 141 @DomName('Document.createTreeWalker')
146 TreeWalker _createTreeWalker(Node root, 142 TreeWalker _createTreeWalker(Node root,
147 [int whatToShow, NodeFilter filter]) 143 [int whatToShow, NodeFilter filter])
148 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)', 144 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)',
149 this, root, whatToShow, filter); 145 this, root, whatToShow, filter);
150 $endif 146 $endif
151 } 147 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698