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 17 matching lines...) Expand all Loading... |
28 'SelectElement.selectedOptions', | 28 'SelectElement.selectedOptions', |
29 'TableElement.createTBody', | 29 'TableElement.createTBody', |
30 'LocalWindow.cancelAnimationFrame', | 30 'LocalWindow.cancelAnimationFrame', |
31 'LocalWindow.document', | 31 'LocalWindow.document', |
32 'LocalWindow.indexedDB', | 32 'LocalWindow.indexedDB', |
33 'LocalWindow.location', | 33 'LocalWindow.location', |
34 'LocalWindow.open', | 34 'LocalWindow.open', |
35 'LocalWindow.requestAnimationFrame', | 35 'LocalWindow.requestAnimationFrame', |
36 'LocalWindow.webkitCancelAnimationFrame', | 36 'LocalWindow.webkitCancelAnimationFrame', |
37 'LocalWindow.webkitRequestAnimationFrame', | 37 'LocalWindow.webkitRequestAnimationFrame', |
| 38 'Url.createObjectURL', |
| 39 'Url.revokeObjectURL', |
38 'WheelEvent.wheelDeltaX', | 40 'WheelEvent.wheelDeltaX', |
39 'WheelEvent.wheelDeltaY', | 41 'WheelEvent.wheelDeltaY', |
40 ]) | 42 ]) |
41 | 43 |
42 | 44 |
| 45 # Classes that offer only static methods, and therefore we should suppress |
| 46 # constructor creation. |
| 47 _static_classes = set(['Url']) |
| 48 |
43 # Types that are accessible cross-frame in a limited fashion. | 49 # Types that are accessible cross-frame in a limited fashion. |
44 # In these cases, the base type (e.g., Window) provides restricted access | 50 # In these cases, the base type (e.g., Window) provides restricted access |
45 # while the subtype (e.g., LocalWindow) provides full access to the | 51 # while the subtype (e.g., LocalWindow) provides full access to the |
46 # corresponding objects if there are from the same frame. | 52 # corresponding objects if there are from the same frame. |
47 _secure_base_types = { | 53 _secure_base_types = { |
48 'LocalWindow': 'Window', | 54 'LocalWindow': 'Window', |
49 'LocalLocation': 'Location', | 55 'LocalLocation': 'Location', |
50 'LocalHistory': 'History', | 56 'LocalHistory': 'History', |
51 } | 57 } |
52 | 58 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 implements_str = '' | 266 implements_str = '' |
261 if implements: | 267 if implements: |
262 implements_str += ' implements ' + ', '.join(implements) | 268 implements_str += ' implements ' + ', '.join(implements) |
263 comment = ',' | 269 comment = ',' |
264 | 270 |
265 factory_provider = None | 271 factory_provider = None |
266 if interface_name in interface_factories: | 272 if interface_name in interface_factories: |
267 factory_provider = interface_factories[interface_name] | 273 factory_provider = interface_factories[interface_name] |
268 | 274 |
269 constructors = [] | 275 constructors = [] |
270 constructor_info = AnalyzeConstructor(self._interface) | 276 if interface_name in _static_classes: |
| 277 constructor_info = None |
| 278 else: |
| 279 constructor_info = AnalyzeConstructor(self._interface) |
271 if constructor_info: | 280 if constructor_info: |
272 constructors.append(constructor_info) | 281 constructors.append(constructor_info) |
273 factory_provider = '_' + interface_name + 'FactoryProvider' | 282 factory_provider = '_' + interface_name + 'FactoryProvider' |
274 factory_provider_emitter = self._library_emitter.FileEmitter( | 283 factory_provider_emitter = self._library_emitter.FileEmitter( |
275 '_%sFactoryProvider' % interface_name) | 284 '_%sFactoryProvider' % interface_name) |
276 self._backend.EmitFactoryProvider( | 285 self._backend.EmitFactoryProvider( |
277 constructor_info, factory_provider, factory_provider_emitter) | 286 constructor_info, factory_provider, factory_provider_emitter) |
278 | 287 |
279 infos = HtmlElementConstructorInfos(interface_name) | 288 infos = HtmlElementConstructorInfos(interface_name) |
280 if infos: | 289 if infos: |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 | 1130 |
1122 library_emitter = self._multiemitter.FileEmitter(library_file_path) | 1131 library_emitter = self._multiemitter.FileEmitter(library_file_path) |
1123 library_file_dir = os.path.dirname(library_file_path) | 1132 library_file_dir = os.path.dirname(library_file_path) |
1124 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir) | 1133 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir) |
1125 imports_emitter = library_emitter.Emit( | 1134 imports_emitter = library_emitter.Emit( |
1126 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) | 1135 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) |
1127 for path in sorted(self._path_to_emitter.keys()): | 1136 for path in sorted(self._path_to_emitter.keys()): |
1128 relpath = os.path.relpath(path, library_file_dir) | 1137 relpath = os.path.relpath(path, library_file_dir) |
1129 imports_emitter.Emit( | 1138 imports_emitter.Emit( |
1130 "part '$PATH';\n", PATH=massage_path(relpath)) | 1139 "part '$PATH';\n", PATH=massage_path(relpath)) |
OLD | NEW |