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

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

Issue 1832713002: Optimize dartium dart:html bindings so real world application performance is acceptable. Improves d… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: update cached patches Created 4 years, 8 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 // 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 return (typeExtension == null) 67 return (typeExtension == null)
68 ? _createElement_2(tagName) 68 ? _createElement_2(tagName)
69 : _createElement(tagName, typeExtension); 69 : _createElement(tagName, typeExtension);
70 $else 70 $else
71 var newElement = (typeExtension == null) ? 71 return (typeExtension == null) ?
72 _blink.BlinkDocument.instance.createElement_Callback_1_(unwrap_jso(this), tagName) : 72 _blink.BlinkDocument.instance.createElement_Callback_1_(this, tagName) :
73 _blink.BlinkDocument.instance.createElement_Callback_2_(unwrap_jso(this), tagName, typeExtension); 73 _blink.BlinkDocument.instance.createElement_Callback_2_(this, tagName, typ eExtension);
74
75 var wrapped = js.getDartHtmlWrapperFor(newElement); // Here's our Dart clas s.
76 if (wrapped != null) {
77 wrapped.blink_jsObject = newElement;
78 } else {
79 wrapped = wrap_jso(newElement);
80 if (wrapped == null) {
81 wrapped = wrap_jso_custom_element(newElement);
82 } else {
83 js.setDartHtmlWrapperFor(wrapped.blink_jsObject, wrapped);
84 }
85 }
86
87 return wrapped;
88 $endif 74 $endif
89 } 75 }
90 76
91 $if DART2JS 77 $if DART2JS
92 // The two-argument version of this is automatically generated, but we need to 78 // The two-argument version of this is automatically generated, but we need to
93 // omit the typeExtension if it's null on Firefox or we get an is="null" attri bute. 79 // omit the typeExtension if it's null on Firefox or we get an is="null" attri bute.
94 @DomName('Document.createElement') 80 @DomName('Document.createElement')
95 _createElement_2(String tagName) => 81 _createElement_2(String tagName) =>
96 JS('Element', '#.createElement(#)', this, tagName); 82 JS('Element', '#.createElement(#)', this, tagName);
97 83
98 // The three-argument version of this is automatically generated, but we need to 84 // The three-argument version of this is automatically generated, but we need to
99 // omit the typeExtension if it's null on Firefox or we get an is="null" attri bute. 85 // omit the typeExtension if it's null on Firefox or we get an is="null" attri bute.
100 @DomName('Document.createElementNS') 86 @DomName('Document.createElementNS')
101 _createElementNS_2(String namespaceURI, String qualifiedName) => 87 _createElementNS_2(String namespaceURI, String qualifiedName) =>
102 JS('Element', '#.createElementNS(#, #)', this, namespaceURI, qualifiedName ); 88 JS('Element', '#.createElementNS(#, #)', this, namespaceURI, qualifiedName );
103 89
104 $endif 90 $endif
105 @DomName('Document.createElementNS') 91 @DomName('Document.createElementNS')
106 @DocsEditable() 92 @DocsEditable()
107 Element createElementNS(String namespaceURI, String qualifiedName, [String typ eExtension]) { 93 Element createElementNS(String namespaceURI, String qualifiedName, [String typ eExtension]) {
108 $if DART2JS 94 $if DART2JS
109 return (typeExtension == null) 95 return (typeExtension == null)
110 ? _createElementNS_2(namespaceURI, qualifiedName) 96 ? _createElementNS_2(namespaceURI, qualifiedName)
111 : _createElementNS(namespaceURI, qualifiedName, typeExtension); 97 : _createElementNS(namespaceURI, qualifiedName, typeExtension);
112 $else 98 $else
113 var newElement = (typeExtension == null) ? 99 return (typeExtension == null) ?
114 _blink.BlinkDocument.instance.createElementNS_Callback_2_(unwrap_jso(this) , namespaceURI, qualifiedName) : 100 _blink.BlinkDocument.instance.createElementNS_Callback_2_(this, namespaceU RI, qualifiedName) :
115 _blink.BlinkDocument.instance.createElementNS_Callback_3_(unwrap_jso(this) , namespaceURI, qualifiedName, typeExtension); 101 _blink.BlinkDocument.instance.createElementNS_Callback_3_(this, namespaceU RI, qualifiedName, typeExtension);
116
117 var wrapped;
118
119 wrapped = js.getDartHtmlWrapperFor(newElement); // Here's our Dart class.
120 if (wrapped != null) {
121 wrapped.blink_jsObject = newElement;
122 } else {
123 wrapped = wrap_jso(newElement);
124 if (wrapped == null) {
125 wrapped = wrap_jso_custom_element(newElement);
126 } else {
127 js.setDartHtmlWrapperFor(wrapped.blink_jsObject, wrapped); // Here's ou r Dart class.
128 }
129 }
130
131 return wrapped;
132 $endif 102 $endif
133 } 103 }
134 104
135 $if DART2JS 105 $if DART2JS
136 @DomName('Document.createNodeIterator') 106 @DomName('Document.createNodeIterator')
137 NodeIterator _createNodeIterator(Node root, 107 NodeIterator _createNodeIterator(Node root,
138 [int whatToShow, NodeFilter filter]) 108 [int whatToShow, NodeFilter filter])
139 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)', 109 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)',
140 this, root, whatToShow, filter); 110 this, root, whatToShow, filter);
141 111
142 @DomName('Document.createTreeWalker') 112 @DomName('Document.createTreeWalker')
143 TreeWalker _createTreeWalker(Node root, 113 TreeWalker _createTreeWalker(Node root,
144 [int whatToShow, NodeFilter filter]) 114 [int whatToShow, NodeFilter filter])
145 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)', 115 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)',
146 this, root, whatToShow, filter); 116 this, root, whatToShow, filter);
147 $endif 117 $endif
148 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698