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

Side by Side Diff: tools/dom/scripts/systemhtml.py

Issue 12095088: "Reverting 17940" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/dom/scripts/monitored.py ('k') | tools/dom/scripts/systemnative.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides shared functionality for the system to generate 6 """This module provides shared functionality for the system to generate
7 Dart:html APIs from the IDL database.""" 7 Dart:html APIs from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 'Window.document', 62 'Window.document',
63 'Window.indexedDB', 63 'Window.indexedDB',
64 'Window.location', 64 'Window.location',
65 'Window.open', 65 'Window.open',
66 'Window.requestAnimationFrame', 66 'Window.requestAnimationFrame',
67 'Window.webkitCancelAnimationFrame', 67 'Window.webkitCancelAnimationFrame',
68 'Window.webkitRequestAnimationFrame', 68 'Window.webkitRequestAnimationFrame',
69 'WorkerContext.indexedDB', 69 'WorkerContext.indexedDB',
70 ]) 70 ])
71 71
72 js_support_checks = {
73 'ArrayBuffer': "JS('bool', 'typeof window.ArrayBuffer != \"undefined\"')",
74 'Database': "JS('bool', '!!(window.openDatabase)')",
75 'DOMApplicationCache': "JS('bool', '!!(window.applicationCache)')",
76 'DOMFileSystem': "JS('bool', '!!(window.webkitRequestFileSystem)')",
77 'HashChangeEvent': "Event._isTypeSupported('HashChangeEvent')",
78 'HTMLContentElement': "Element.isTagSupported('content')",
79 'HTMLDataListElement': "Element.isTagSupported('datalist')",
80 'HTMLDetailsElement': "Element.isTagSupported('details')",
81 'HTMLEmbedElement': "Element.isTagSupported('embed')",
82 # IE creates keygen as Block elements
83 'HTMLKeygenElement': "Element.isTagSupported('keygen') "
84 "&& (new Element.tag('keygen') is KeygenElement)",
85 'HTMLMeterElement': "Element.isTagSupported('meter')",
86 'HTMLObjectElement': "Element.isTagSupported('object')",
87 'HTMLOutputElement': "Element.isTagSupported('output')",
88 'HTMLProgressElement': "Element.isTagSupported('progress')",
89 'HTMLShadowElement': "Element.isTagSupported('shadow')",
90 'HTMLTrackElement': "Element.isTagSupported('track')",
91 'MediaStreamEvent': "Event._isTypeSupported('MediaStreamEvent')",
92 'MediaStreamTrackEvent': "Event._isTypeSupported('MediaStreamTrackEvent')",
93 'NotificationCenter': "JS('bool', '!!(window.webkitNotifications)')",
94 'Performance': "JS('bool', '!!(window.performance)')",
95 'SpeechRecognition': "JS('bool', '!!(window.SpeechRecognition || "
96 "window.webkitSpeechRecognition)')",
97 'XMLHttpRequestProgressEvent':
98 "Event._isTypeSupported('XMLHttpRequestProgressEvent')",
99 'WebGLRenderingContext': "JS('bool', '!!(window.WebGLRenderingContext)')",
100 'WebKitCSSMatrix': "JS('bool', '!!(window.WebKitCSSMatrix)')",
101 'WebKitPoint': "JS('bool', '!!(window.WebKitPoint)')",
102 'WebSocket': "JS('bool', 'typeof window.WebSocket != \"undefined\"')",
103 'XSLTProcessor': "JS('bool', '!!(window.XSLTProcessor)')",
104 }
105
72 # Classes that offer only static methods, and therefore we should suppress 106 # Classes that offer only static methods, and therefore we should suppress
73 # constructor creation. 107 # constructor creation.
74 _static_classes = set(['Url']) 108 _static_classes = set(['Url'])
75 109
76 # Information for generating element constructors. 110 # Information for generating element constructors.
77 # 111 #
78 # TODO(sra): maybe remove all the argument complexity and use cascades. 112 # TODO(sra): maybe remove all the argument complexity and use cascades.
79 # 113 #
80 # var c = new CanvasElement(width: 100, height: 70); 114 # var c = new CanvasElement(width: 100, height: 70);
81 # var c = new CanvasElement()..width = 100..height = 70; 115 # var c = new CanvasElement()..width = 100..height = 70;
(...skipping 17 matching lines...) Expand all
99 info.js_name = None 133 info.js_name = None
100 info.type_name = interface_name 134 info.type_name = interface_name
101 info.param_infos = map(lambda tXn: ParamInfo(tXn[1], tXn[0], True), 135 info.param_infos = map(lambda tXn: ParamInfo(tXn[1], tXn[0], True),
102 self.opt_params) 136 self.opt_params)
103 info.requires_named_arguments = True 137 info.requires_named_arguments = True
104 info.factory_parameters = ['"%s"' % self.tag] 138 info.factory_parameters = ['"%s"' % self.tag]
105 info.pure_dart_constructor = True 139 info.pure_dart_constructor = True
106 return info 140 return info
107 141
108 _html_element_constructors = { 142 _html_element_constructors = {
109 'HTMLAnchorElement' : 143 'AnchorElement' :
110 ElementConstructorInfo(tag='a', opt_params=[('DOMString', 'href')]), 144 ElementConstructorInfo(tag='a', opt_params=[('DOMString', 'href')]),
111 'HTMLAreaElement': 'area', 145 'AreaElement': 'area',
112 'HTMLButtonElement': 'button', 146 'ButtonElement': 'button',
113 'HTMLBRElement': 'br', 147 'BRElement': 'br',
114 'HTMLBaseElement': 'base', 148 'BaseElement': 'base',
115 'HTMLBodyElement': 'body', 149 'BodyElement': 'body',
116 'HTMLButtonElement': 'button', 150 'ButtonElement': 'button',
117 'HTMLCanvasElement': 151 'CanvasElement':
118 ElementConstructorInfo(tag='canvas', 152 ElementConstructorInfo(tag='canvas',
119 opt_params=[('int', 'width'), ('int', 'height')]), 153 opt_params=[('int', 'width'), ('int', 'height')]),
120 'HTMLContentElement': 'content', 154 'ContentElement': 'content',
121 'HTMLDataListElement': 'datalist', 155 'DataListElement': 'datalist',
122 'HTMLDListElement': 'dl', 156 'DListElement': 'dl',
123 'HTMLDetailsElement': 'details', 157 'DetailsElement': 'details',
124 'HTMLDivElement': 'div', 158 'DivElement': 'div',
125 'HTMLEmbedElement': 'embed', 159 'EmbedElement': 'embed',
126 'HTMLFieldSetElement': 'fieldset', 160 'FieldSetElement': 'fieldset',
127 'HTMLFormElement': 'form', 161 'FormElement': 'form',
128 'HTMLHRElement': 'hr', 162 'HRElement': 'hr',
129 'HTMLHeadElement': 'head', 163 'HeadElement': 'head',
130 'HTMLHeadingElement': [ElementConstructorInfo('h1'), 164 'HeadingElement': [ElementConstructorInfo('h1'),
131 ElementConstructorInfo('h2'), 165 ElementConstructorInfo('h2'),
132 ElementConstructorInfo('h3'), 166 ElementConstructorInfo('h3'),
133 ElementConstructorInfo('h4'), 167 ElementConstructorInfo('h4'),
134 ElementConstructorInfo('h5'), 168 ElementConstructorInfo('h5'),
135 ElementConstructorInfo('h6')], 169 ElementConstructorInfo('h6')],
136 'HTMLHtmlElement': 'html', 170 'HtmlElement': 'html',
137 'HTMLIFrameElement': 'iframe', 171 'IFrameElement': 'iframe',
138 'HTMLImageElement': 172 'ImageElement':
139 ElementConstructorInfo(tag='img', 173 ElementConstructorInfo(tag='img',
140 opt_params=[('DOMString', 'src'), 174 opt_params=[('DOMString', 'src'),
141 ('int', 'width'), ('int', 'height')]), 175 ('int', 'width'), ('int', 'height')]),
142 'HTMLKeygenElement': 'keygen', 176 'KeygenElement': 'keygen',
143 'HTMLLIElement': 'li', 177 'LIElement': 'li',
144 'HTMLLabelElement': 'label', 178 'LabelElement': 'label',
145 'HTMLLegendElement': 'legend', 179 'LegendElement': 'legend',
146 'HTMLLinkElement': 'link', 180 'LinkElement': 'link',
147 'HTMLMapElement': 'map', 181 'MapElement': 'map',
148 'HTMLMenuElement': 'menu', 182 'MenuElement': 'menu',
149 'HTMLMeterElement': 'meter', 183 'MeterElement': 'meter',
150 'HTMLOListElement': 'ol', 184 'OListElement': 'ol',
151 'HTMLObjectElement': 'object', 185 'ObjectElement': 'object',
152 'HTMLOptGroupElement': 'optgroup', 186 'OptGroupElement': 'optgroup',
153 'HTMLOutputElement': 'output', 187 'OutputElement': 'output',
154 'HTMLParagraphElement': 'p', 188 'ParagraphElement': 'p',
155 'HTMLParamElement': 'param', 189 'ParamElement': 'param',
156 'HTMLPreElement': 'pre', 190 'PreElement': 'pre',
157 'HTMLProgressElement': 'progress', 191 'ProgressElement': 'progress',
158 'HTMLScriptElement': 'script', 192 'ScriptElement': 'script',
159 'HTMLSelectElement': 'select', 193 'SelectElement': 'select',
160 'HTMLSourceElement': 'source', 194 'SourceElement': 'source',
161 'HTMLSpanElement': 'span', 195 'SpanElement': 'span',
162 'HTMLStyleElement': 'style', 196 'StyleElement': 'style',
163 'HTMLTableCaptionElement': 'caption', 197 'TableCaptionElement': 'caption',
164 'HTMLTableCellElement': 'td', 198 'TableCellElement': 'td',
165 'HTMLTableColElement': 'col', 199 'TableColElement': 'col',
166 'HTMLTableElement': 'table', 200 'TableElement': 'table',
167 'HTMLTableRowElement': 'tr', 201 'TableRowElement': 'tr',
168 #'HTMLTableSectionElement' <thead> <tbody> <tfoot> 202 #'TableSectionElement' <thead> <tbody> <tfoot>
169 'HTMLTextAreaElement': 'textarea', 203 'TextAreaElement': 'textarea',
170 'HTMLTitleElement': 'title', 204 'TitleElement': 'title',
171 'HTMLTrackElement': 'track', 205 'TrackElement': 'track',
172 'HTMLUListElement': 'ul', 206 'UListElement': 'ul',
173 'HTMLVideoElement': 'video' 207 'VideoElement': 'video'
174 } 208 }
175 209
176 _svg_element_constructors = { 210 _svg_element_constructors = {
177 'SVGAElement': 'a', 211 'AElement': 'a',
178 'SVGAltGlyphElement': 'altGlyph', 212 'AnimateColorElement': 'animateColor',
179 'SVGAnimateElement': 'animate', 213 'AnimateElement': 'animate',
180 'SVGAnimateMotionElement': 'animateMotion', 214 'AnimateMotionElement': 'animateMotion',
181 'SVGAnimateTransformElement': 'animateTransform', 215 'AnimateTransformElement': 'animateTransform',
182 'SVGAnimationElement': 'animation', 216 'AnimationElement': 'animation',
183 'SVGCircleElement': 'circle', 217 'CircleElement': 'circle',
184 'SVGClipPathElement': 'clipPath', 218 'ClipPathElement': 'clipPath',
185 'SVGCursorElement': 'cursor', 219 'CursorElement': 'cursor',
186 'SVGDefsElement': 'defs', 220 'DefsElement': 'defs',
187 'SVGDescElement': 'desc', 221 'DescElement': 'desc',
188 'SVGEllipseElement': 'ellipse', 222 'EllipseElement': 'ellipse',
189 'SVGFEBlendElement': 'feBlend', 223 'FilterElement': 'filter',
190 'SVGFEColorMatrixElement': 'feColorMatrix', 224 'FontElement': 'font',
191 'SVGFEComponentTransferElement': 'feComponentTransfer', 225 'FontFaceElement': 'font-face',
192 'SVGFEConvolveMatrixElement': 'feConvolveMatrix', 226 'FontFaceFormatElement': 'font-face-format',
193 'SVGFEDiffuseLightingElement': 'feDiffuseLighting', 227 'FontFaceNameElement': 'font-face-name',
194 'SVGFEDisplacementMapElement': 'feDisplacementMap', 228 'FontFaceSrcElement': 'font-face-src',
195 'SVGFEDistantLightElement': 'feDistantLight', 229 'FontFaceUriElement': 'font-face-uri',
196 'SVGFEFloodElement': 'feFlood', 230 'ForeignObjectElement': 'foreignObject',
197 'SVGFEFuncAElement': 'feFuncA', 231 'GlyphElement': 'glyph',
198 'SVGFEFuncBElement': 'feFuncB', 232 'GElement': 'g',
199 'SVGFEFuncGElement': 'feFuncG', 233 'HKernElement': 'hkern',
200 'SVGFEFuncRElement': 'feFuncR', 234 'ImageElement': 'image',
201 'SVGFEGaussianBlurElement': 'feGaussianBlur', 235 'LinearGradientElement': 'linearGradient',
202 'SVGFEImageElement': 'feImage', 236 'LineElement': 'line',
203 'SVGFEMergeElement': 'feMerge', 237 'MarkerElement': 'marker',
204 'SVGFEMergeNodeElement': 'feMergeNode', 238 'MaskElement': 'mask',
205 'SVGFEMorphology': 'feMorphology', 239 'MPathElement': 'mpath',
206 'SVGFEOffsetElement': 'feOffset', 240 'PathElement': 'path',
207 'SVGFEPointLightElement': 'fePointLight', 241 'PatternElement': 'pattern',
208 'SVGFESpecularLightingElement': 'feSpecularLighting', 242 'PolygonElement': 'polygon',
209 'SVGFESpotLightElement': 'feSpotLight', 243 'PolylineElement': 'polyline',
210 'SVGFETileElement': 'feTile', 244 'RadialGradientElement': 'radialGradient',
211 'SVGFETurbulenceElement': 'feTurbulence', 245 'RectElement': 'rect',
212 'SVGFilterElement': 'filter', 246 'ScriptElement': 'script',
213 'SVGForeignObjectElement': 'foreignObject', 247 'SetElement': 'set',
214 'SVGGlyphElement': 'glyph', 248 'StopElement': 'stop',
215 'SVGGElement': 'g', 249 'StyleElement': 'style',
216 'SVGHKernElement': 'hkern', 250 'SwitchElement': 'switch',
217 'SVGImageElement': 'image', 251 'SymbolElement': 'symbol',
218 'SVGLinearGradientElement': 'linearGradient', 252 'TextElement': 'text',
219 'SVGLineElement': 'line', 253 'TitleElement': 'title',
220 'SVGMarkerElement': 'marker', 254 'TRefElement': 'tref',
221 'SVGMaskElement': 'mask', 255 'TSpanElement': 'tspan',
222 'SVGMPathElement': 'mpath', 256 'UseElement': 'use',
223 'SVGPathElement': 'path', 257 'ViewElement': 'view',
224 'SVGPatternElement': 'pattern', 258 'VKernElement': 'vkern',
225 'SVGPolygonElement': 'polygon',
226 'SVGPolylineElement': 'polyline',
227 'SVGRadialGradientElement': 'radialGradient',
228 'SVGRectElement': 'rect',
229 'SVGScriptElement': 'script',
230 'SVGSetElement': 'set',
231 'SVGStopElement': 'stop',
232 'SVGStyleElement': 'style',
233 'SVGSwitchElement': 'switch',
234 'SVGSymbolElement': 'symbol',
235 'SVGTextElement': 'text',
236 'SVGTitleElement': 'title',
237 'SVGTRefElement': 'tref',
238 'SVGTSpanElement': 'tspan',
239 'SVGUseElement': 'use',
240 'SVGViewElement': 'view',
241 'SVGVKernElement': 'vkern',
242 } 259 }
243 260
244 _element_constructors = { 261 _element_constructors = {
245 'html': _html_element_constructors, 262 'html': _html_element_constructors,
246 'indexed_db': {}, 263 'indexed_db': {},
247 'svg': _svg_element_constructors, 264 'svg': _svg_element_constructors,
248 'web_audio': {}, 265 'web_audio': {},
249 } 266 }
250 267
251 _factory_ctr_strings = { 268 _factory_ctr_strings = {
(...skipping 24 matching lines...) Expand all
276 return [] 293 return []
277 infos = element_constructors[typename] 294 infos = element_constructors[typename]
278 if isinstance(infos, str): 295 if isinstance(infos, str):
279 infos = ElementConstructorInfo(tag=infos, 296 infos = ElementConstructorInfo(tag=infos,
280 factory_provider_name=factory_provider_name) 297 factory_provider_name=factory_provider_name)
281 if not isinstance(infos, list): 298 if not isinstance(infos, list):
282 infos = [infos] 299 infos = [infos]
283 return infos 300 return infos
284 301
285 # ------------------------------------------------------------------------------ 302 # ------------------------------------------------------------------------------
286 def SvgSupportStr(tagName):
287 return 'Svg%s' % ElemSupportStr(tagName)
288
289 def ElemSupportStr(tagName):
290 return "Element.isTagSupported('%s')" % tagName
291
292 _js_support_checks_basic_element = [
293 'HTMLContentElement',
294 'HTMLDataListElement',
295 'HTMLDetailsElement',
296 'HTMLEmbedElement',
297 'HTMLMeterElement',
298 'HTMLObjectElement',
299 'HTMLOutputElement',
300 'HTMLProgressElement',
301 'HTMLTrackElement',
302 ]
303
304 _js_support_checks_additional_element = [
305 # IE creates keygen as Block elements
306 'HTMLKeygenElement',
307 'SVGAltGlyphElement',
308 'SVGAnimateElement',
309 'SVGAnimateMotionElement',
310 'SVGAnimateTransformElement',
311 'SVGCursorElement',
312 'SVGFEBlendElement',
313 'SVGFEColorMatrixElement',
314 'SVGFEComponentTransferElement',
315 'SVGFEConvolveMatrixElement',
316 'SVGFEDiffuseLightingElement',
317 'SVGFEDisplacementMapElement',
318 'SVGFEDistantLightElement',
319 'SVGFEFloodElement',
320 'SVGFEFuncAElement',
321 'SVGFEFuncBElement',
322 'SVGFEFuncGElement',
323 'SVGFEFuncRElement',
324 'SVGFEGaussianBlurElement',
325 'SVGFEImageElement',
326 'SVGFEMergeElement',
327 'SVGFEMergeNodeElement',
328 'SVGFEMorphology',
329 'SVGFEOffsetElement',
330 'SVGFEPointLightElement',
331 'SVGFESpecularLightingElement',
332 'SVGFESpotLightElement',
333 'SVGFETileElement',
334 'SVGFETurbulenceElement',
335 'SVGFilterElement',
336 'SVGForeignObjectElement',
337 'SVGSetElement',
338 ]
339
340 js_support_checks = dict({
341 'ArrayBuffer': "JS('bool', 'typeof window.ArrayBuffer != \"undefined\"')",
342 'Database': "JS('bool', '!!(window.openDatabase)')",
343 'DOMApplicationCache': "JS('bool', '!!(window.applicationCache)')",
344 'DOMFileSystem': "JS('bool', '!!(window.webkitRequestFileSystem)')",
345 'HashChangeEvent': "Event._isTypeSupported('HashChangeEvent')",
346 'HTMLShadowElement': ElemSupportStr('shadow'),
347 'MediaStreamEvent': "Event._isTypeSupported('MediaStreamEvent')",
348 'MediaStreamTrackEvent': "Event._isTypeSupported('MediaStreamTrackEvent')",
349 'NotificationCenter': "JS('bool', '!!(window.webkitNotifications)')",
350 'Performance': "JS('bool', '!!(window.performance)')",
351 'SpeechRecognition': "JS('bool', '!!(window.SpeechRecognition || "
352 "window.webkitSpeechRecognition)')",
353 'SVGExternalResourcesRequired': ('supported(SvgElement element)',
354 "JS('bool', '#.externalResourcesRequired !== undefined && "
355 "#.externalResourcesRequired.animVal !== undefined', "
356 "element, element)"),
357 'SVGLangSpace': ('supported(SvgElement element)',
358 "JS('bool', '#.xmlspace !== undefined && #.xmllang !== undefined', "
359 "element, element)"),
360 'XMLHttpRequestProgressEvent':
361 "Event._isTypeSupported('XMLHttpRequestProgressEvent')",
362 'WebGLRenderingContext': "JS('bool', '!!(window.WebGLRenderingContext)')",
363 'WebKitCSSMatrix': "JS('bool', '!!(window.WebKitCSSMatrix)')",
364 'WebKitPoint': "JS('bool', '!!(window.WebKitPoint)')",
365 'WebSocket': "JS('bool', 'typeof window.WebSocket != \"undefined\"')",
366 'XSLTProcessor': "JS('bool', '!!(window.XSLTProcessor)')",
367 }.items() +
368 dict((key,
369 SvgSupportStr(_svg_element_constructors[key]) if key.startswith('SVG')
370 else ElemSupportStr(_html_element_constructors[key])) for key in
371 _js_support_checks_basic_element +
372 _js_support_checks_additional_element).items())
373 # ------------------------------------------------------------------------------
374 303
375 class HtmlDartInterfaceGenerator(object): 304 class HtmlDartInterfaceGenerator(object):
376 """Generates dart interface and implementation for the DOM IDL interface.""" 305 """Generates dart interface and implementation for the DOM IDL interface."""
377 306
378 def __init__(self, options, library_emitter, event_generator, interface, 307 def __init__(self, options, library_emitter, event_generator, interface,
379 backend): 308 backend):
380 self._renamer = options.renamer 309 self._renamer = options.renamer
381 self._database = options.database 310 self._database = options.database
382 self._template_loader = options.templates 311 self._template_loader = options.templates
383 self._type_registry = options.type_registry 312 self._type_registry = options.type_registry
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 if interface_name in _static_classes: 352 if interface_name in _static_classes:
424 constructor_info = None 353 constructor_info = None
425 else: 354 else:
426 constructor_info = AnalyzeConstructor(self._interface) 355 constructor_info = AnalyzeConstructor(self._interface)
427 if constructor_info: 356 if constructor_info:
428 constructors.append(constructor_info) 357 constructors.append(constructor_info)
429 # TODO(antonm): consider removing it later. 358 # TODO(antonm): consider removing it later.
430 factory_provider = interface_name 359 factory_provider = interface_name
431 360
432 # HTML Elements and SVG Elements have convenience constructors. 361 # HTML Elements and SVG Elements have convenience constructors.
433 infos = ElementConstructorInfos(self._interface.id, 362 infos = ElementConstructorInfos(interface_name,
434 _element_constructors[self._library_name], factory_provider_name= 363 _element_constructors[self._library_name], factory_provider_name=
435 _factory_ctr_strings[self._library_name]['provider_name']) 364 _factory_ctr_strings[self._library_name]['provider_name'])
436 365
437 if infos: 366 if infos:
438 factory_constructor_name = _factory_ctr_strings[ 367 factory_constructor_name = _factory_ctr_strings[
439 self._library_name]['constructor_name'] 368 self._library_name]['constructor_name']
440 369
441 for info in infos: 370 for info in infos:
442 constructors.append(info.ConstructorInfo(self._interface.id)) 371 constructors.append(info.ConstructorInfo(self._interface.id))
443 if factory_provider: 372 if factory_provider:
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 def StartInterface(self, members_emitter): 514 def StartInterface(self, members_emitter):
586 self._members_emitter = members_emitter 515 self._members_emitter = members_emitter
587 516
588 def FinishInterface(self): 517 def FinishInterface(self):
589 pass 518 pass
590 519
591 def HasSupportCheck(self): 520 def HasSupportCheck(self):
592 return self._interface.doc_js_name in js_support_checks 521 return self._interface.doc_js_name in js_support_checks
593 522
594 def GetSupportCheck(self): 523 def GetSupportCheck(self):
595 """Return a tuple of the support check function signature and the support
596 test itself. If no parameters are supplied, we assume the default."""
597 if self._interface.doc_js_name in _js_support_checks_additional_element:
598 if self._interface.doc_js_name in _svg_element_constructors:
599 lib_prefix = 'Svg'
600 constructors = _svg_element_constructors
601 else:
602 lib_prefix = ''
603 constructors = _html_element_constructors
604 return (js_support_checks.get(self._interface.doc_js_name) +
605 " && (new %sElement.tag('%s') is %s)" % (lib_prefix,
606 constructors[self._interface.doc_js_name],
607 self._renamer.RenameInterface(self._interface)))
608 return js_support_checks.get(self._interface.doc_js_name) 524 return js_support_checks.get(self._interface.doc_js_name)
609 525
610 def GenerateCustomFactory(self, constructor_info): 526 def GenerateCustomFactory(self, constructor_info):
611 # Custom factory will be taken from the template. 527 # Custom factory will be taken from the template.
612 return self._interface.doc_js_name in [ 528 return self._interface.doc_js_name in [
613 'AudioContext', 529 'AudioContext',
614 'Blob', 530 'Blob',
615 'MutationObserver', 531 'MutationObserver',
616 'SpeechRecognition', 532 'SpeechRecognition',
617 ] 533 ]
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 for library_name in libraries: 1020 for library_name in libraries:
1105 self._libraries[library_name] = DartLibrary( 1021 self._libraries[library_name] = DartLibrary(
1106 library_name, template_loader, library_type, output_dir) 1022 library_name, template_loader, library_type, output_dir)
1107 1023
1108 def AddFile(self, basename, library_name, path): 1024 def AddFile(self, basename, library_name, path):
1109 self._libraries[library_name].AddFile(path) 1025 self._libraries[library_name].AddFile(path)
1110 1026
1111 def Emit(self, emitter, auxiliary_dir): 1027 def Emit(self, emitter, auxiliary_dir):
1112 for lib in self._libraries.values(): 1028 for lib in self._libraries.values():
1113 lib.Emit(emitter, auxiliary_dir) 1029 lib.Emit(emitter, auxiliary_dir)
OLDNEW
« no previous file with comments | « tools/dom/scripts/monitored.py ('k') | tools/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698