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 logging | 10 import logging |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 586 |
587 self._backend.EmitHelpers(base_class) | 587 self._backend.EmitHelpers(base_class) |
588 self._event_generator.EmitStreamProviders( | 588 self._event_generator.EmitStreamProviders( |
589 self._interface, | 589 self._interface, |
590 self._backend.CustomJSMembers(), | 590 self._backend.CustomJSMembers(), |
591 self._implementation_members_emitter, | 591 self._implementation_members_emitter, |
592 self._library_name) | 592 self._library_name) |
593 self._backend.AddConstructors( | 593 self._backend.AddConstructors( |
594 constructors, factory_provider, factory_constructor_name) | 594 constructors, factory_provider, factory_constructor_name) |
595 | 595 |
| 596 isElement = False |
| 597 for parent in self._database.Hierarchy(self._interface): |
| 598 if parent.id == 'Element': |
| 599 isElement = True |
| 600 if isElement and self._interface.id != 'Element': |
| 601 self._implementation_members_emitter.Emit( |
| 602 ' /**\n' |
| 603 ' * Constructor instantiated by the DOM when a custom element has be
en created.\n' |
| 604 ' *\n' |
| 605 ' * This can only be called by subclasses from their created constru
ctor.\n' |
| 606 ' */\n' |
| 607 ' $CLASSNAME.created() : super.created();\n', |
| 608 CLASSNAME=self._interface_type_info.implementation_name()) |
| 609 |
596 self._backend.EmitSupportCheck() | 610 self._backend.EmitSupportCheck() |
597 | 611 |
598 merged_interface = self._interface_type_info.merged_interface() | 612 merged_interface = self._interface_type_info.merged_interface() |
599 if merged_interface: | 613 if merged_interface: |
600 self._backend.AddMembers(self._database.GetInterface(merged_interface), | 614 self._backend.AddMembers(self._database.GetInterface(merged_interface), |
601 not self._backend.ImplementsMergedMembers()) | 615 not self._backend.ImplementsMergedMembers()) |
602 | 616 |
603 self._backend.AddMembers(self._interface) | 617 self._backend.AddMembers(self._interface) |
604 self._backend.AddSecondaryMembers(self._interface) | 618 self._backend.AddSecondaryMembers(self._interface) |
605 self._event_generator.EmitStreamGetters( | 619 self._event_generator.EmitStreamGetters( |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 for library_name in libraries: | 1239 for library_name in libraries: |
1226 self._libraries[library_name] = DartLibrary( | 1240 self._libraries[library_name] = DartLibrary( |
1227 library_name, template_loader, library_type, output_dir) | 1241 library_name, template_loader, library_type, output_dir) |
1228 | 1242 |
1229 def AddFile(self, basename, library_name, path): | 1243 def AddFile(self, basename, library_name, path): |
1230 self._libraries[library_name].AddFile(path) | 1244 self._libraries[library_name].AddFile(path) |
1231 | 1245 |
1232 def Emit(self, emitter, auxiliary_dir): | 1246 def Emit(self, emitter, auxiliary_dir): |
1233 for lib in self._libraries.values(): | 1247 for lib in self._libraries.values(): |
1234 lib.Emit(emitter, auxiliary_dir) | 1248 lib.Emit(emitter, auxiliary_dir) |
OLD | NEW |