OLD | NEW |
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 monitored | 10 import monitored |
11 import os | 11 import os |
12 from generator import * | 12 from generator import * |
13 from htmldartgenerator import * | 13 from htmldartgenerator import * |
14 | 14 |
15 HTML_LIBRARY_NAMES = ['chrome', 'html', 'indexed_db', 'svg', 'web_audio', | 15 HTML_LIBRARY_NAMES = ['chrome', 'html', 'indexed_db', 'svg', |
16 'web_gl', 'web_sql'] | 16 'web_audio', 'web_gl', 'web_sql'] |
17 | 17 |
18 _js_custom_members = monitored.Set('systemhtml._js_custom_members', [ | 18 _js_custom_members = monitored.Set('systemhtml._js_custom_members', [ |
19 'ArrayBuffer.slice', | |
20 'AudioBufferSourceNode.start', | 19 'AudioBufferSourceNode.start', |
21 'AudioBufferSourceNode.stop', | 20 'AudioBufferSourceNode.stop', |
22 'AudioContext.createGain', | 21 'AudioContext.createGain', |
23 'AudioContext.createScriptProcessor', | 22 'AudioContext.createScriptProcessor', |
24 'CanvasRenderingContext2D.drawImage', | 23 'CanvasRenderingContext2D.drawImage', |
25 'CanvasRenderingContext2D.lineDashOffset', | 24 'CanvasRenderingContext2D.lineDashOffset', |
26 'Console.memory', | 25 'Console.memory', |
27 'Console.profiles', | 26 'Console.profiles', |
28 'Console.assertCondition', | 27 'Console.assertCondition', |
29 'Console.count', | 28 'Console.count', |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 'SVGTSpanElement': 'tspan', | 256 'SVGTSpanElement': 'tspan', |
258 'SVGUseElement': 'use', | 257 'SVGUseElement': 'use', |
259 'SVGViewElement': 'view', | 258 'SVGViewElement': 'view', |
260 'SVGVKernElement': 'vkern', | 259 'SVGVKernElement': 'vkern', |
261 }) | 260 }) |
262 | 261 |
263 _element_constructors = { | 262 _element_constructors = { |
264 'html': _html_element_constructors, | 263 'html': _html_element_constructors, |
265 'indexed_db': {}, | 264 'indexed_db': {}, |
266 'svg': _svg_element_constructors, | 265 'svg': _svg_element_constructors, |
| 266 'typeddata': {}, |
267 'web_audio': {}, | 267 'web_audio': {}, |
268 'web_gl': {}, | 268 'web_gl': {}, |
269 'web_sql': {}, | 269 'web_sql': {}, |
270 } | 270 } |
271 | 271 |
272 _factory_ctr_strings = { | 272 _factory_ctr_strings = { |
273 'html': { | 273 'html': { |
274 'provider_name': 'document', | 274 'provider_name': 'document', |
275 'constructor_name': '$dom_createElement' | 275 'constructor_name': '$dom_createElement' |
276 }, | 276 }, |
277 'indexed_db': { | 277 'indexed_db': { |
278 'provider_name': 'document', | 278 'provider_name': 'document', |
279 'constructor_name': '$dom_createElement' | 279 'constructor_name': '$dom_createElement' |
280 }, | 280 }, |
281 'svg': { | 281 'svg': { |
282 'provider_name': '_SvgElementFactoryProvider', | 282 'provider_name': '_SvgElementFactoryProvider', |
283 'constructor_name': 'createSvgElement_tag', | 283 'constructor_name': 'createSvgElement_tag', |
284 }, | 284 }, |
| 285 'typeddata': { |
| 286 'provider_name': 'document', |
| 287 'constructor_name': '$dom_createElement' |
| 288 }, |
285 'web_audio': { | 289 'web_audio': { |
286 'provider_name': 'document', | 290 'provider_name': 'document', |
287 'constructor_name': '$dom_createElement' | 291 'constructor_name': '$dom_createElement' |
288 }, | 292 }, |
289 'web_gl': { | 293 'web_gl': { |
290 'provider_name': 'document', | 294 'provider_name': 'document', |
291 'constructor_name': '$dom_createElement' | 295 'constructor_name': '$dom_createElement' |
292 }, | 296 }, |
293 'web_sql': { | 297 'web_sql': { |
294 'provider_name': 'document', | 298 'provider_name': 'document', |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 self._type_registry = options.type_registry | 421 self._type_registry = options.type_registry |
418 self._options = options | 422 self._options = options |
419 self._library_emitter = library_emitter | 423 self._library_emitter = library_emitter |
420 self._event_generator = event_generator | 424 self._event_generator = event_generator |
421 self._interface = interface | 425 self._interface = interface |
422 self._backend = backend | 426 self._backend = backend |
423 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) | 427 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) |
424 self._library_name = self._renamer.GetLibraryName(self._interface) | 428 self._library_name = self._renamer.GetLibraryName(self._interface) |
425 | 429 |
426 def Generate(self): | 430 def Generate(self): |
427 if 'Callback' in self._interface.ext_attrs: | 431 if IsCustomType(self._interface.id): |
| 432 pass |
| 433 elif 'Callback' in self._interface.ext_attrs: |
428 self.GenerateCallback() | 434 self.GenerateCallback() |
429 else: | 435 else: |
430 self.GenerateInterface() | 436 self.GenerateInterface() |
431 | 437 |
432 def GenerateCallback(self): | 438 def GenerateCallback(self): |
433 """Generates a typedef for the callback interface.""" | 439 """Generates a typedef for the callback interface.""" |
434 typedef_name = self._renamer.RenameInterface(self._interface) | 440 typedef_name = self._renamer.RenameInterface(self._interface) |
435 if not typedef_name: | 441 if not typedef_name: |
436 return | 442 return |
437 | 443 |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 for library_name in libraries: | 1159 for library_name in libraries: |
1154 self._libraries[library_name] = DartLibrary( | 1160 self._libraries[library_name] = DartLibrary( |
1155 library_name, template_loader, library_type, output_dir) | 1161 library_name, template_loader, library_type, output_dir) |
1156 | 1162 |
1157 def AddFile(self, basename, library_name, path): | 1163 def AddFile(self, basename, library_name, path): |
1158 self._libraries[library_name].AddFile(path) | 1164 self._libraries[library_name].AddFile(path) |
1159 | 1165 |
1160 def Emit(self, emitter, auxiliary_dir): | 1166 def Emit(self, emitter, auxiliary_dir): |
1161 for lib in self._libraries.values(): | 1167 for lib in self._libraries.values(): |
1162 lib.Emit(emitter, auxiliary_dir) | 1168 lib.Emit(emitter, auxiliary_dir) |
OLD | NEW |