| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 'Element.webkitMatchesSelector', | 45 'Element.webkitMatchesSelector', |
| 46 'Element.remove', | 46 'Element.remove', |
| 47 'ElementEvents.mouseWheel', | 47 'ElementEvents.mouseWheel', |
| 48 'HTMLCanvasElement.getContext', | 48 'HTMLCanvasElement.getContext', |
| 49 'HTMLTableElement.createTBody', | 49 'HTMLTableElement.createTBody', |
| 50 'IDBDatabase.transaction', | 50 'IDBDatabase.transaction', |
| 51 'KeyboardEvent.initKeyboardEvent', | 51 'KeyboardEvent.initKeyboardEvent', |
| 52 'MouseEvent.offsetX', | 52 'MouseEvent.offsetX', |
| 53 'MouseEvent.offsetY', | 53 'MouseEvent.offsetY', |
| 54 'Navigator.language', | 54 'Navigator.language', |
| 55 'Navigator.webkitGetUserMedia', |
| 55 'URL.createObjectURL', | 56 'URL.createObjectURL', |
| 56 'URL.revokeObjectURL', | 57 'URL.revokeObjectURL', |
| 57 'WheelEvent.wheelDeltaX', | 58 'WheelEvent.wheelDeltaX', |
| 58 'WheelEvent.wheelDeltaY', | 59 'WheelEvent.wheelDeltaY', |
| 59 'Window.cancelAnimationFrame', | 60 'Window.cancelAnimationFrame', |
| 60 'Window.console', | 61 'Window.console', |
| 61 'Window.document', | 62 'Window.document', |
| 62 'Window.indexedDB', | 63 'Window.indexedDB', |
| 63 'Window.location', | 64 'Window.location', |
| 64 'Window.open', | 65 'Window.open', |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 return_type = self._NarrowInputType(info.type_name) | 768 return_type = self._NarrowInputType(info.type_name) |
| 768 native_return_type = return_type | 769 native_return_type = return_type |
| 769 | 770 |
| 770 def InputType(type_name): | 771 def InputType(type_name): |
| 771 conversion = self._InputConversion(type_name, info.declared_name) | 772 conversion = self._InputConversion(type_name, info.declared_name) |
| 772 if conversion: | 773 if conversion: |
| 773 return conversion.input_type | 774 return conversion.input_type |
| 774 else: | 775 else: |
| 775 return self._NarrowInputType(type_name) if type_name else 'dynamic' | 776 return self._NarrowInputType(type_name) if type_name else 'dynamic' |
| 776 | 777 |
| 778 annotations = FindCommonAnnotations(self._interface.id, info.declared_name) |
| 779 if annotations: |
| 780 annotation_str = '\n '.join(annotations) + '\n ' |
| 781 else: |
| 782 annotation_str = '' |
| 783 |
| 777 body = self._members_emitter.Emit( | 784 body = self._members_emitter.Emit( |
| 778 '\n' | 785 '\n' |
| 779 ' $MODIFIERS$TYPE $(HTML_NAME)($PARAMS) {\n' | 786 ' $ANNOTATIONS$MODIFIERS$TYPE $(HTML_NAME)($PARAMS) {\n' |
| 780 '$!BODY' | 787 '$!BODY' |
| 781 ' }\n', | 788 ' }\n', |
| 789 ANNOTATIONS=annotation_str, |
| 782 MODIFIERS='static ' if info.IsStatic() else '', | 790 MODIFIERS='static ' if info.IsStatic() else '', |
| 783 TYPE=return_type, | 791 TYPE=return_type, |
| 784 HTML_NAME=html_name, | 792 HTML_NAME=html_name, |
| 785 PARAMS=info.ParametersDeclaration(InputType)) | 793 PARAMS=info.ParametersDeclaration(InputType)) |
| 786 | 794 |
| 787 parameter_names = [param_info.name for param_info in info.param_infos] | 795 parameter_names = [param_info.name for param_info in info.param_infos] |
| 788 parameter_types = [InputType(param_info.type_id) | 796 parameter_types = [InputType(param_info.type_id) |
| 789 for param_info in info.param_infos] | 797 for param_info in info.param_infos] |
| 790 operations = info.operations | 798 operations = info.operations |
| 791 | 799 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 for library_name in libraries: | 1054 for library_name in libraries: |
| 1047 self._libraries[library_name] = DartLibrary( | 1055 self._libraries[library_name] = DartLibrary( |
| 1048 library_name, template_loader, library_type, output_dir) | 1056 library_name, template_loader, library_type, output_dir) |
| 1049 | 1057 |
| 1050 def AddFile(self, basename, library_name, path): | 1058 def AddFile(self, basename, library_name, path): |
| 1051 self._libraries[library_name].AddFile(path) | 1059 self._libraries[library_name].AddFile(path) |
| 1052 | 1060 |
| 1053 def Emit(self, emitter, auxiliary_dir): | 1061 def Emit(self, emitter, auxiliary_dir): |
| 1054 for lib in self._libraries.values(): | 1062 for lib in self._libraries.values(): |
| 1055 lib.Emit(emitter, auxiliary_dir) | 1063 lib.Emit(emitter, auxiliary_dir) |
| OLD | NEW |