| 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 systems to generate | 6 """This module provides shared functionality for systems to generate |
| 7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
| 8 | 8 |
| 9 import copy | 9 import copy |
| 10 import re | 10 import re |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 602 |
| 603 def interface_name(self): | 603 def interface_name(self): |
| 604 raise NotImplementedError() | 604 raise NotImplementedError() |
| 605 | 605 |
| 606 def implementation_name(self): | 606 def implementation_name(self): |
| 607 raise NotImplementedError() | 607 raise NotImplementedError() |
| 608 | 608 |
| 609 def has_generated_interface(self): | 609 def has_generated_interface(self): |
| 610 raise NotImplementedError() | 610 raise NotImplementedError() |
| 611 | 611 |
| 612 def list_item_type(self): |
| 613 raise NotImplementedError() |
| 614 |
| 612 def merged_interface(self): | 615 def merged_interface(self): |
| 613 return None | 616 return None |
| 614 | 617 |
| 615 def merged_into(self): | 618 def merged_into(self): |
| 616 return None | 619 return None |
| 617 | 620 |
| 618 def native_type(self): | 621 def native_type(self): |
| 619 return self._data.native_type or self._idl_type | 622 return self._data.native_type or self._idl_type |
| 620 | 623 |
| 621 def bindings_class(self): | 624 def bindings_class(self): |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 return ['"Dart%s.h"' % include for include in includes] | 692 return ['"Dart%s.h"' % include for include in includes] |
| 690 | 693 |
| 691 def to_dart_conversion(self, value, interface_name=None, attributes=None): | 694 def to_dart_conversion(self, value, interface_name=None, attributes=None): |
| 692 return 'Dart%s::toDart(%s)' % (self._idl_type, value) | 695 return 'Dart%s::toDart(%s)' % (self._idl_type, value) |
| 693 | 696 |
| 694 def custom_to_dart(self): | 697 def custom_to_dart(self): |
| 695 return self._data.custom_to_dart | 698 return self._data.custom_to_dart |
| 696 | 699 |
| 697 | 700 |
| 698 class InterfaceIDLTypeInfo(IDLTypeInfo): | 701 class InterfaceIDLTypeInfo(IDLTypeInfo): |
| 699 def __init__(self, idl_type, data, dart_interface_name): | 702 def __init__(self, idl_type, data, dart_interface_name, type_registry): |
| 700 super(InterfaceIDLTypeInfo, self).__init__(idl_type, data) | 703 super(InterfaceIDLTypeInfo, self).__init__(idl_type, data) |
| 701 self._dart_interface_name = dart_interface_name | 704 self._dart_interface_name = dart_interface_name |
| 705 self._type_registry = type_registry |
| 702 | 706 |
| 703 def dart_type(self): | 707 def dart_type(self): |
| 708 # TODO(podivilov): why NodeList is special? |
| 709 if self.idl_type() == 'NodeList': |
| 710 return 'List<Node>' |
| 711 if self.list_item_type() and not self.has_generated_interface(): |
| 712 return 'List<%s>' % self._type_registry.TypeInfo(self._data.item_type).dar
t_type() |
| 704 return self._data.dart_type or self._dart_interface_name | 713 return self._data.dart_type or self._dart_interface_name |
| 705 | 714 |
| 706 def narrow_dart_type(self): | 715 def narrow_dart_type(self): |
| 716 # TODO(podivilov): why NodeList is special? |
| 717 if self.idl_type() == 'NodeList': |
| 718 return 'List<Node>' |
| 719 if self.list_item_type(): |
| 720 return ImplementationClassNameForInterfaceName(self.idl_type()) |
| 707 # TODO(podivilov): only primitive and collection types should override | 721 # TODO(podivilov): only primitive and collection types should override |
| 708 # dart_type. | 722 # dart_type. |
| 709 if self._data.dart_type != None: | 723 if self._data.dart_type != None: |
| 710 return self.dart_type() | 724 return self.dart_type() |
| 711 if IsPureInterface(self.idl_type()): | 725 if IsPureInterface(self.idl_type()): |
| 712 return self.idl_type() | 726 return self.idl_type() |
| 713 return ImplementationClassNameForInterfaceName(self.interface_name()) | 727 return ImplementationClassNameForInterfaceName(self.interface_name()) |
| 714 | 728 |
| 715 def interface_name(self): | 729 def interface_name(self): |
| 730 if self.list_item_type() and not self.has_generated_interface(): |
| 731 return self.dart_type() |
| 716 return self._dart_interface_name | 732 return self._dart_interface_name |
| 717 | 733 |
| 718 def implementation_name(self): | 734 def implementation_name(self): |
| 735 if self.list_item_type(): |
| 736 return ImplementationClassNameForInterfaceName(self.idl_type()) |
| 719 implementation_name = ImplementationClassNameForInterfaceName( | 737 implementation_name = ImplementationClassNameForInterfaceName( |
| 720 self.interface_name()) | 738 self.interface_name()) |
| 721 if self.merged_into(): | 739 if self.merged_into(): |
| 722 implementation_name = '%s_Merged' % implementation_name | 740 implementation_name = '%s_Merged' % implementation_name |
| 723 return implementation_name | 741 return implementation_name |
| 724 | 742 |
| 725 def has_generated_interface(self): | 743 def has_generated_interface(self): |
| 726 return True | 744 return not self._data.suppress_interface |
| 745 |
| 746 def list_item_type(self): |
| 747 return self._data.item_type |
| 727 | 748 |
| 728 def merged_interface(self): | 749 def merged_interface(self): |
| 729 # All constants, attributes, and operations of merged interface should be | 750 # All constants, attributes, and operations of merged interface should be |
| 730 # added to this interface. Merged idl interface does not have corresponding | 751 # added to this interface. Merged idl interface does not have corresponding |
| 731 # Dart generated interface, and all references to merged idl interface | 752 # Dart generated interface, and all references to merged idl interface |
| 732 # (e.g. parameter types, return types, parent interfaces) should be replaced | 753 # (e.g. parameter types, return types, parent interfaces) should be replaced |
| 733 # with this interface. There are two important restrictions: | 754 # with this interface. There are two important restrictions: |
| 734 # 1) Merged and target interfaces shouldn't have common members, otherwise | 755 # 1) Merged and target interfaces shouldn't have common members, otherwise |
| 735 # there would be duplicated declarations in generated Dart code. | 756 # there would be duplicated declarations in generated Dart code. |
| 736 # 2) Merged interface should be direct child of target interface, so the | 757 # 2) Merged interface should be direct child of target interface, so the |
| 737 # children of merged interface are not affected by the merge. | 758 # children of merged interface are not affected by the merge. |
| 738 # As a consequence, target interface implementation and its direct children | 759 # As a consequence, target interface implementation and its direct children |
| 739 # interface implementations should implement merged attribute accessors and | 760 # interface implementations should implement merged attribute accessors and |
| 740 # operations. For example, SVGElement and Element implementation classes | 761 # operations. For example, SVGElement and Element implementation classes |
| 741 # should implement HTMLElement.insertAdjacentElement(), | 762 # should implement HTMLElement.insertAdjacentElement(), |
| 742 # HTMLElement.innerHTML, etc. | 763 # HTMLElement.innerHTML, etc. |
| 743 return self._data.merged_interface | 764 return self._data.merged_interface |
| 744 | 765 |
| 745 def merged_into(self): | 766 def merged_into(self): |
| 746 return self._data.merged_into | 767 return self._data.merged_into |
| 747 | 768 |
| 748 | 769 |
| 749 class CallbackIDLTypeInfo(IDLTypeInfo): | 770 class CallbackIDLTypeInfo(IDLTypeInfo): |
| 750 def __init__(self, idl_type, data): | 771 def __init__(self, idl_type, data): |
| 751 super(CallbackIDLTypeInfo, self).__init__(idl_type, data) | 772 super(CallbackIDLTypeInfo, self).__init__(idl_type, data) |
| 752 | 773 |
| 753 | 774 |
| 754 # Type info for DOM types that are converted to dart lists and therefore whose | |
| 755 # actual interface generation should be suppressed. For type information, we | |
| 756 # still generate the implementations though, so these types should not be | |
| 757 # suppressed entirely. | |
| 758 class ListLikeIDLTypeInfo(IDLTypeInfo): | |
| 759 def __init__(self, idl_type, data, item_info): | |
| 760 super(ListLikeIDLTypeInfo, self).__init__(idl_type, data) | |
| 761 self._item_info = item_info | |
| 762 | |
| 763 def dart_type(self): | |
| 764 return 'List<%s>' % self._item_info.dart_type() | |
| 765 | |
| 766 def narrow_dart_type(self): | |
| 767 if self.has_generated_interface(): | |
| 768 return self.dart_type() | |
| 769 return ImplementationClassNameForInterfaceName(self.idl_type()) | |
| 770 | |
| 771 def interface_name(self): | |
| 772 if self.has_generated_interface(): | |
| 773 return self.idl_type() | |
| 774 return self.dart_type() | |
| 775 | |
| 776 def implementation_name(self): | |
| 777 return ImplementationClassNameForInterfaceName(self.idl_type()) | |
| 778 | |
| 779 def has_generated_interface(self): | |
| 780 # Don't generate interfaces for list-like types. | |
| 781 # TODO(podivilov): why NodeList is special? Is it indeed a list-like type | |
| 782 # or should just implement sequence<Node>? | |
| 783 return self.idl_type() == 'NodeList' | |
| 784 | |
| 785 | |
| 786 class SequenceIDLTypeInfo(IDLTypeInfo): | 775 class SequenceIDLTypeInfo(IDLTypeInfo): |
| 787 def __init__(self, idl_type, data, item_info): | 776 def __init__(self, idl_type, data, item_info): |
| 788 super(SequenceIDLTypeInfo, self).__init__(idl_type, data) | 777 super(SequenceIDLTypeInfo, self).__init__(idl_type, data) |
| 789 self._item_info = item_info | 778 self._item_info = item_info |
| 790 | 779 |
| 791 def dart_type(self): | 780 def dart_type(self): |
| 792 return 'List<%s>' % self._item_info.dart_type() | 781 return 'List<%s>' % self._item_info.dart_type() |
| 793 | 782 |
| 794 def interface_name(self): | 783 def interface_name(self): |
| 795 return self.dart_type() | 784 return self.dart_type() |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 return self._data.webcore_getter_name | 850 return self._data.webcore_getter_name |
| 862 | 851 |
| 863 def webcore_setter_name(self): | 852 def webcore_setter_name(self): |
| 864 return self._data.webcore_setter_name | 853 return self._data.webcore_setter_name |
| 865 | 854 |
| 866 def _capitalized_native_type(self): | 855 def _capitalized_native_type(self): |
| 867 return re.sub(r'(^| )([a-z])', lambda x: x.group(2).upper(), self.native_typ
e()) | 856 return re.sub(r'(^| )([a-z])', lambda x: x.group(2).upper(), self.native_typ
e()) |
| 868 | 857 |
| 869 | 858 |
| 870 class SVGTearOffIDLTypeInfo(InterfaceIDLTypeInfo): | 859 class SVGTearOffIDLTypeInfo(InterfaceIDLTypeInfo): |
| 871 def __init__(self, idl_type, data): | 860 def __init__(self, idl_type, data, type_registry): |
| 872 super(SVGTearOffIDLTypeInfo, self).__init__(idl_type, data, idl_type) | 861 super(SVGTearOffIDLTypeInfo, self).__init__( |
| 862 idl_type, data, idl_type, type_registry) |
| 873 | 863 |
| 874 def native_type(self): | 864 def native_type(self): |
| 875 if self._data.native_type: | 865 if self._data.native_type: |
| 876 return self._data.native_type | 866 return self._data.native_type |
| 877 tear_off_type = 'SVGPropertyTearOff' | 867 tear_off_type = 'SVGPropertyTearOff' |
| 878 if self._idl_type.endswith('List'): | 868 if self._idl_type.endswith('List'): |
| 879 tear_off_type = 'SVGListPropertyTearOff' | 869 tear_off_type = 'SVGListPropertyTearOff' |
| 880 return '%s<%s>' % (tear_off_type, self._idl_type) | 870 return '%s<%s>' % (tear_off_type, self._idl_type) |
| 881 | 871 |
| 882 def receiver(self): | 872 def receiver(self): |
| (...skipping 23 matching lines...) Expand all Loading... |
| 906 | 896 |
| 907 | 897 |
| 908 class TypeData(object): | 898 class TypeData(object): |
| 909 def __init__(self, clazz, dart_type=None, native_type=None, | 899 def __init__(self, clazz, dart_type=None, native_type=None, |
| 910 merged_interface=None, merged_into=None, | 900 merged_interface=None, merged_into=None, |
| 911 custom_to_dart=None, custom_to_native=None, | 901 custom_to_dart=None, custom_to_native=None, |
| 912 conversion_includes=None, | 902 conversion_includes=None, |
| 913 webcore_getter_name='getAttribute', | 903 webcore_getter_name='getAttribute', |
| 914 webcore_setter_name='setAttribute', | 904 webcore_setter_name='setAttribute', |
| 915 requires_v8_scope=False, | 905 requires_v8_scope=False, |
| 916 item_type=None): | 906 item_type=None, suppress_interface=False): |
| 917 self.clazz = clazz | 907 self.clazz = clazz |
| 918 self.dart_type = dart_type | 908 self.dart_type = dart_type |
| 919 self.native_type = native_type | 909 self.native_type = native_type |
| 920 self.merged_interface = merged_interface | 910 self.merged_interface = merged_interface |
| 921 self.merged_into = merged_into | 911 self.merged_into = merged_into |
| 922 self.custom_to_dart = custom_to_dart | 912 self.custom_to_dart = custom_to_dart |
| 923 self.custom_to_native = custom_to_native | 913 self.custom_to_native = custom_to_native |
| 924 self.conversion_includes = conversion_includes | 914 self.conversion_includes = conversion_includes |
| 925 self.webcore_getter_name = webcore_getter_name | 915 self.webcore_getter_name = webcore_getter_name |
| 926 self.webcore_setter_name = webcore_setter_name | 916 self.webcore_setter_name = webcore_setter_name |
| 927 self.requires_v8_scope = requires_v8_scope | 917 self.requires_v8_scope = requires_v8_scope |
| 928 self.item_type = item_type | 918 self.item_type = item_type |
| 919 self.suppress_interface = suppress_interface |
| 929 | 920 |
| 930 | 921 |
| 931 _idl_type_registry = { | 922 _idl_type_registry = { |
| 932 'boolean': TypeData(clazz='Primitive', dart_type='bool', native_type='bool', | 923 'boolean': TypeData(clazz='Primitive', dart_type='bool', native_type='bool', |
| 933 webcore_getter_name='hasAttribute', | 924 webcore_getter_name='hasAttribute', |
| 934 webcore_setter_name='setBooleanAttribute'), | 925 webcore_setter_name='setBooleanAttribute'), |
| 935 'byte': TypeData(clazz='Primitive', dart_type='int', native_type='int'), | 926 'byte': TypeData(clazz='Primitive', dart_type='int', native_type='int'), |
| 936 'octet': TypeData(clazz='Primitive', dart_type='int', native_type='int'), | 927 'octet': TypeData(clazz='Primitive', dart_type='int', native_type='int'), |
| 937 'short': TypeData(clazz='Primitive', dart_type='int', native_type='int'), | 928 'short': TypeData(clazz='Primitive', dart_type='int', native_type='int'), |
| 938 'unsigned short': TypeData(clazz='Primitive', dart_type='int', | 929 'unsigned short': TypeData(clazz='Primitive', dart_type='int', |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 'HTMLDocument': TypeData(clazz='Interface', merged_into='Document'), | 982 'HTMLDocument': TypeData(clazz='Interface', merged_into='Document'), |
| 992 'HTMLElement': TypeData(clazz='Interface', merged_into='Element', | 983 'HTMLElement': TypeData(clazz='Interface', merged_into='Element', |
| 993 custom_to_dart=True), | 984 custom_to_dart=True), |
| 994 'IDBAny': TypeData(clazz='Interface', dart_type='Dynamic', custom_to_native=
True), | 985 'IDBAny': TypeData(clazz='Interface', dart_type='Dynamic', custom_to_native=
True), |
| 995 'IDBKey': TypeData(clazz='Interface', dart_type='Dynamic', custom_to_native=
True), | 986 'IDBKey': TypeData(clazz='Interface', dart_type='Dynamic', custom_to_native=
True), |
| 996 'MutationRecordArray': TypeData(clazz='Interface', # C++ pass by pointer. | 987 'MutationRecordArray': TypeData(clazz='Interface', # C++ pass by pointer. |
| 997 native_type='MutationRecordArray', dart_type='List<MutationRecord>'), | 988 native_type='MutationRecordArray', dart_type='List<MutationRecord>'), |
| 998 'StyleSheet': TypeData(clazz='Interface', conversion_includes=['CSSStyleShee
t']), | 989 'StyleSheet': TypeData(clazz='Interface', conversion_includes=['CSSStyleShee
t']), |
| 999 'SVGElement': TypeData(clazz='Interface', custom_to_dart=True), | 990 'SVGElement': TypeData(clazz='Interface', custom_to_dart=True), |
| 1000 | 991 |
| 1001 'ClientRectList': TypeData(clazz='ListLike', item_type='ClientRect'), | 992 'ClientRectList': TypeData(clazz='Interface', |
| 1002 'CSSRuleList': TypeData(clazz='ListLike', item_type='CSSRule'), | 993 item_type='ClientRect', suppress_interface=True), |
| 1003 'CSSValueList': TypeData(clazz='ListLike', item_type='CSSValue'), | 994 'CSSRuleList': TypeData(clazz='Interface', |
| 1004 'DOMStringList': TypeData(clazz='ListLike', item_type='DOMString', | 995 item_type='CSSRule', suppress_interface=True), |
| 1005 custom_to_native=True), | 996 'CSSValueList': TypeData(clazz='Interface', |
| 1006 'EntryArray': TypeData(clazz='ListLike', item_type='Entry'), | 997 item_type='CSSValue', suppress_interface=True), |
| 1007 'EntryArraySync': TypeData(clazz='ListLike', item_type='EntrySync'), | 998 'DOMMimeTypeArray': TypeData(clazz='Interface', item_type='DOMMimeType'), |
| 1008 'FileList': TypeData(clazz='ListLike', item_type='File'), | 999 'DOMPluginArray': TypeData(clazz='Interface', item_type='DOMPlugin'), |
| 1009 'GamepadList': TypeData(clazz='ListLike', item_type='Gamepad'), | 1000 'DOMStringList': TypeData(clazz='Interface', item_type='DOMString', |
| 1010 'MediaStreamList': TypeData(clazz='ListLike', item_type='MediaStream'), | 1001 suppress_interface=True, custom_to_native=True), |
| 1011 'NodeList': TypeData(clazz='ListLike', item_type='Node'), | 1002 'EntryArray': TypeData(clazz='Interface', item_type='Entry', |
| 1012 'SVGElementInstanceList': TypeData(clazz='ListLike', | 1003 suppress_interface=True), |
| 1013 item_type='SVGElementInstance'), | 1004 'EntryArraySync': TypeData(clazz='Interface', item_type='EntrySync', |
| 1014 'SpeechInputResultList': TypeData(clazz='ListLike', | 1005 suppress_interface=True), |
| 1015 item_type='SpeechInputResult'), | 1006 'FileList': TypeData(clazz='Interface', item_type='File', |
| 1016 'SpeechRecognitionResultList': TypeData(clazz='ListLike', | 1007 suppress_interface=True), |
| 1017 item_type='SpeechRecognitionResult'), | 1008 'GamepadList': TypeData(clazz='Interface', item_type='Gamepad', |
| 1018 'StyleSheetList': TypeData(clazz='ListLike', item_type='StyleSheet'), | 1009 suppress_interface=True), |
| 1019 'WebKitAnimationList': TypeData(clazz='ListLike', | 1010 'HTMLAllCollection': TypeData(clazz='Interface', item_type='Node'), |
| 1020 item_type='WebKitAnimation'), | 1011 'HTMLCollection': TypeData(clazz='Interface', item_type='Node'), |
| 1012 'MediaStreamList': TypeData(clazz='Interface', |
| 1013 item_type='MediaStream', suppress_interface=True), |
| 1014 'NamedNodeMap': TypeData(clazz='Interface', item_type='Node'), |
| 1015 'NodeList': TypeData(clazz='Interface', item_type='Node'), |
| 1016 'SVGAnimatedLengthList': TypeData(clazz='Interface', |
| 1017 item_type='SVGAnimatedLength'), |
| 1018 'SVGAnimatedNumberList': TypeData(clazz='Interface', |
| 1019 item_type='SVGAnimatedNumber'), |
| 1020 'SVGAnimatedTransformList': TypeData(clazz='Interface', |
| 1021 item_type='SVGAnimateTransformElement'), |
| 1022 'SVGElementInstanceList': TypeData(clazz='Interface', |
| 1023 item_type='SVGElementInstance', suppress_interface=True), |
| 1024 'SourceBufferList': TypeData(clazz='Interface', item_type='SourceBuffer'), |
| 1025 'SpeechGrammarList': TypeData(clazz='Interface', item_type='SpeechGrammar'), |
| 1026 'SpeechInputResultList': TypeData(clazz='Interface', |
| 1027 item_type='SpeechInputResult', suppress_interface=True), |
| 1028 'SpeechRecognitionResultList': TypeData(clazz='Interface', |
| 1029 item_type='SpeechRecognitionResult', suppress_interface=True), |
| 1030 'SQLResultSetRowList': TypeData(clazz='Interface', item_type='Dictionary'), |
| 1031 'StyleSheetList': TypeData(clazz='Interface', |
| 1032 item_type='StyleSheet', suppress_interface=True), |
| 1033 'TextTrackCueList': TypeData(clazz='Interface', item_type='TextTrackCue'), |
| 1034 'TextTrackList': TypeData(clazz='Interface', item_type='TextTrack'), |
| 1035 'TouchList': TypeData(clazz='Interface', item_type='Touch'), |
| 1036 'WebKitAnimationList': TypeData(clazz='Interface', |
| 1037 item_type='WebKitAnimation', suppress_interface=True), |
| 1038 |
| 1039 'Float32Array': TypeData(clazz='Interface', item_type='double'), |
| 1040 'Float64Array': TypeData(clazz='Interface', item_type='double'), |
| 1041 'Int8Array': TypeData(clazz='Interface', item_type='int'), |
| 1042 'Int16Array': TypeData(clazz='Interface', item_type='int'), |
| 1043 'Int32Array': TypeData(clazz='Interface', item_type='int'), |
| 1044 'Uint8Array': TypeData(clazz='Interface', item_type='int'), |
| 1045 'Uint16Array': TypeData(clazz='Interface', item_type='int'), |
| 1046 'Uint32Array': TypeData(clazz='Interface', item_type='int'), |
| 1021 | 1047 |
| 1022 'SVGAngle': TypeData(clazz='SVGTearOff'), | 1048 'SVGAngle': TypeData(clazz='SVGTearOff'), |
| 1023 'SVGLength': TypeData(clazz='SVGTearOff'), | 1049 'SVGLength': TypeData(clazz='SVGTearOff'), |
| 1024 'SVGLengthList': TypeData(clazz='SVGTearOff'), | 1050 'SVGLengthList': TypeData(clazz='SVGTearOff', item_type='SVGLength'), |
| 1025 'SVGMatrix': TypeData(clazz='SVGTearOff'), | 1051 'SVGMatrix': TypeData(clazz='SVGTearOff'), |
| 1026 'SVGNumber': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<fl
oat>'), | 1052 'SVGNumber': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<fl
oat>'), |
| 1027 'SVGNumberList': TypeData(clazz='SVGTearOff'), | 1053 'SVGNumberList': TypeData(clazz='SVGTearOff', item_type='SVGNumber'), |
| 1028 'SVGPathSegList': TypeData(clazz='SVGTearOff', native_type='SVGPathSegListPr
opertyTearOff'), | 1054 'SVGPathSegList': TypeData(clazz='SVGTearOff', item_type='SVGPathSeg', |
| 1055 native_type='SVGPathSegListPropertyTearOff'), |
| 1029 'SVGPoint': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<Flo
atPoint>'), | 1056 'SVGPoint': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<Flo
atPoint>'), |
| 1030 'SVGPointList': TypeData(clazz='SVGTearOff'), | 1057 'SVGPointList': TypeData(clazz='SVGTearOff'), |
| 1031 'SVGPreserveAspectRatio': TypeData(clazz='SVGTearOff'), | 1058 'SVGPreserveAspectRatio': TypeData(clazz='SVGTearOff'), |
| 1032 'SVGRect': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<Floa
tRect>'), | 1059 'SVGRect': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<Floa
tRect>'), |
| 1033 'SVGStringList': TypeData(clazz='SVGTearOff', native_type='SVGStaticListProp
ertyTearOff<SVGStringList>'), | 1060 'SVGStringList': TypeData(clazz='SVGTearOff', item_type='DOMString', |
| 1061 native_type='SVGStaticListPropertyTearOff<SVGStringList>'), |
| 1034 'SVGTransform': TypeData(clazz='SVGTearOff'), | 1062 'SVGTransform': TypeData(clazz='SVGTearOff'), |
| 1035 'SVGTransformList': TypeData(clazz='SVGTearOff', native_type='SVGTransformLi
stPropertyTearOff'), | 1063 'SVGTransformList': TypeData(clazz='SVGTearOff', item_type='SVGTransform', |
| 1064 native_type='SVGTransformListPropertyTearOff'), |
| 1036 } | 1065 } |
| 1037 | 1066 |
| 1038 _svg_supplemental_includes = [ | 1067 _svg_supplemental_includes = [ |
| 1039 '"SVGAnimatedPropertyTearOff.h"', | 1068 '"SVGAnimatedPropertyTearOff.h"', |
| 1040 '"SVGAnimatedListPropertyTearOff.h"', | 1069 '"SVGAnimatedListPropertyTearOff.h"', |
| 1041 '"SVGStaticListPropertyTearOff.h"', | 1070 '"SVGStaticListPropertyTearOff.h"', |
| 1042 '"SVGAnimatedListPropertyTearOff.h"', | 1071 '"SVGAnimatedListPropertyTearOff.h"', |
| 1043 '"SVGTransformListPropertyTearOff.h"', | 1072 '"SVGTransformListPropertyTearOff.h"', |
| 1044 '"SVGPathSegListPropertyTearOff.h"', | 1073 '"SVGPathSegListPropertyTearOff.h"', |
| 1045 ] | 1074 ] |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1066 item_info = self.TypeInfo(match.group(1) or match.group(2)) | 1095 item_info = self.TypeInfo(match.group(1) or match.group(2)) |
| 1067 return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info) | 1096 return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info) |
| 1068 | 1097 |
| 1069 if not type_name in _idl_type_registry: | 1098 if not type_name in _idl_type_registry: |
| 1070 interface = self._database.GetInterface(type_name) | 1099 interface = self._database.GetInterface(type_name) |
| 1071 if 'Callback' in interface.ext_attrs: | 1100 if 'Callback' in interface.ext_attrs: |
| 1072 return CallbackIDLTypeInfo(type_name, TypeData('Callback')) | 1101 return CallbackIDLTypeInfo(type_name, TypeData('Callback')) |
| 1073 return InterfaceIDLTypeInfo( | 1102 return InterfaceIDLTypeInfo( |
| 1074 type_name, | 1103 type_name, |
| 1075 TypeData('Interface'), | 1104 TypeData('Interface'), |
| 1076 self._renamer.RenameInterface(interface)) | 1105 self._renamer.RenameInterface(interface), |
| 1106 self) |
| 1077 | 1107 |
| 1078 type_data = _idl_type_registry.get(type_name) | 1108 type_data = _idl_type_registry.get(type_name) |
| 1079 | 1109 |
| 1080 if type_data.clazz == 'Interface': | 1110 if type_data.clazz == 'Interface': |
| 1081 if self._database.HasInterface(type_name): | 1111 if self._database.HasInterface(type_name): |
| 1082 dart_interface_name = self._renamer.RenameInterface( | 1112 dart_interface_name = self._renamer.RenameInterface( |
| 1083 self._database.GetInterface(type_name)) | 1113 self._database.GetInterface(type_name)) |
| 1084 else: | 1114 else: |
| 1085 dart_interface_name = type_name | 1115 dart_interface_name = type_name |
| 1086 return InterfaceIDLTypeInfo(type_name, type_data, dart_interface_name) | 1116 return InterfaceIDLTypeInfo(type_name, type_data, dart_interface_name, |
| 1117 self) |
| 1087 | 1118 |
| 1088 if type_data.clazz == 'ListLike': | 1119 if type_data.clazz == 'SVGTearOff': |
| 1089 return ListLikeIDLTypeInfo(type_name, type_data, self.TypeInfo(type_data.i
tem_type)) | 1120 return SVGTearOffIDLTypeInfo(type_name, type_data, self) |
| 1090 | 1121 |
| 1091 class_name = '%sIDLTypeInfo' % type_data.clazz | 1122 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1092 return globals()[class_name](type_name, type_data) | 1123 return globals()[class_name](type_name, type_data) |
| OLD | NEW |