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 os | 10 import os |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 'TitleElement': 'title', | 195 'TitleElement': 'title', |
196 'TRefElement': 'tref', | 196 'TRefElement': 'tref', |
197 'TSpanElement': 'tspan', | 197 'TSpanElement': 'tspan', |
198 'UseElement': 'use', | 198 'UseElement': 'use', |
199 'ViewElement': 'view', | 199 'ViewElement': 'view', |
200 'VKernElement': 'vkern', | 200 'VKernElement': 'vkern', |
201 } | 201 } |
202 | 202 |
203 _element_constructors = { | 203 _element_constructors = { |
204 'html': _html_element_constructors, | 204 'html': _html_element_constructors, |
205 'svg': _svg_element_constructors | 205 'svg': _svg_element_constructors, |
| 206 'web_audio': {}, |
206 } | 207 } |
207 | 208 |
208 _factory_ctr_strings = { | 209 _factory_ctr_strings = { |
209 'html': { | 210 'html': { |
210 'provider_name': 'document', | 211 'provider_name': 'document', |
211 'constructor_name': '$dom_createElement' | 212 'constructor_name': '$dom_createElement' |
212 }, | 213 }, |
213 'svg': { | 214 'svg': { |
214 'provider_name': '_SvgElementFactoryProvider', | 215 'provider_name': '_SvgElementFactoryProvider', |
215 'constructor_name': 'createSvgElement_tag', | 216 'constructor_name': 'createSvgElement_tag', |
216 }, | 217 }, |
| 218 'web_audio': { |
| 219 'provider_name': 'document', |
| 220 'constructor_name': '$dom_createElement' |
| 221 }, |
217 } | 222 } |
218 | 223 |
219 def ElementConstructorInfos(typename, element_constructors, | 224 def ElementConstructorInfos(typename, element_constructors, |
220 factory_provider_name='_Elements'): | 225 factory_provider_name='_Elements'): |
221 """Returns list of ElementConstructorInfos about the convenience constructors | 226 """Returns list of ElementConstructorInfos about the convenience constructors |
222 for an Element or SvgElement.""" | 227 for an Element or SvgElement.""" |
223 # TODO(sra): Handle multiple and named constructors. | 228 # TODO(sra): Handle multiple and named constructors. |
224 if typename not in element_constructors: | 229 if typename not in element_constructors: |
225 return [] | 230 return [] |
226 infos = element_constructors[typename] | 231 infos = element_constructors[typename] |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) | 983 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) |
979 | 984 |
980 for path in sorted(self._paths): | 985 for path in sorted(self._paths): |
981 relpath = os.path.relpath(path, library_file_dir) | 986 relpath = os.path.relpath(path, library_file_dir) |
982 imports_emitter.Emit( | 987 imports_emitter.Emit( |
983 "part '$PATH';\n", PATH=massage_path(relpath)) | 988 "part '$PATH';\n", PATH=massage_path(relpath)) |
984 | 989 |
985 # ------------------------------------------------------------------------------ | 990 # ------------------------------------------------------------------------------ |
986 | 991 |
987 class DartLibraries(): | 992 class DartLibraries(): |
988 def __init__(self, template_loader, library_type, output_dir): | 993 def __init__(self, libraries, template_loader, library_type, output_dir): |
989 self._libraries = { | 994 self._libraries = {} |
990 'svg': DartLibrary('svg', template_loader, library_type, output_dir), | 995 for library_name in libraries: |
991 'html': DartLibrary('html', template_loader, library_type, output_dir), | 996 self._libraries[library_name] = DartLibrary( |
992 } | 997 library_name, template_loader, library_type, output_dir) |
993 | 998 |
994 def AddFile(self, basename, library_name, path): | 999 def AddFile(self, basename, library_name, path): |
995 self._libraries[library_name].AddFile(path) | 1000 self._libraries[library_name].AddFile(path) |
996 | 1001 |
997 def Emit(self, emitter, auxiliary_dir): | 1002 def Emit(self, emitter, auxiliary_dir): |
998 for lib in self._libraries.values(): | 1003 for lib in self._libraries.values(): |
999 lib.Emit(emitter, auxiliary_dir) | 1004 lib.Emit(emitter, auxiliary_dir) |
OLD | NEW |