Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tools/dom/scripts/systemnative.py

Issue 204033002: Fixes for Chrome 34 merge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/src/native_DOMImplementation.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 systems to generate 6 """This module provides shared functionality for the systems to generate
7 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 ('WorkerGlobalScope', 'openDatabaseSync'): 'WorkerGlobalScopeWebDatabase', 69 ('WorkerGlobalScope', 'openDatabaseSync'): 'WorkerGlobalScopeWebDatabase',
70 ('WorkerGlobalScope', 'performance'): 'WorkerGlobalScopePerformance', 70 ('WorkerGlobalScope', 'performance'): 'WorkerGlobalScopePerformance',
71 ('WorkerGlobalScope', 'webkitRequestFileSystem'): 'WorkerGlobalScopeFileSystem ', 71 ('WorkerGlobalScope', 'webkitRequestFileSystem'): 'WorkerGlobalScopeFileSystem ',
72 ('WorkerGlobalScope', 'webkitRequestFileSystemSync'): 'WorkerGlobalScopeFileSy stem', 72 ('WorkerGlobalScope', 'webkitRequestFileSystemSync'): 'WorkerGlobalScopeFileSy stem',
73 ('WorkerGlobalScope', 'webkitResolveLocalFileSystemURL'): 'WorkerGlobalScopeFi leSystem', 73 ('WorkerGlobalScope', 'webkitResolveLocalFileSystemURL'): 'WorkerGlobalScopeFi leSystem',
74 ('WorkerGlobalScope', 'webkitResolveLocalFileSystemSyncURL'): 'WorkerGlobalSco peFileSystem', 74 ('WorkerGlobalScope', 'webkitResolveLocalFileSystemSyncURL'): 'WorkerGlobalSco peFileSystem',
75 ('WorkerGlobalScope', 'atob'): 'DOMWindowBase64', 75 ('WorkerGlobalScope', 'atob'): 'DOMWindowBase64',
76 ('WorkerGlobalScope', 'btoa'): 'DOMWindowBase64', 76 ('WorkerGlobalScope', 'btoa'): 'DOMWindowBase64',
77 ('WorkerGlobalScope', 'clearTimeout'): 'DOMWindowTimers', 77 ('WorkerGlobalScope', 'clearTimeout'): 'DOMWindowTimers',
78 ('WorkerGlobalScope', 'clearInterval'): 'DOMWindowTimers', 78 ('WorkerGlobalScope', 'clearInterval'): 'DOMWindowTimers',
79 } 79 ('Document', 'rootElement'): 'SVGDocument',
80 ('Document', 'childElementCount'): 'ParentNode',
81 ('Document', 'firstElementChild'): 'ParentNode',
82 ('Document', 'lastElementChild'): 'ParentNode',
83 ('DocumentFragment', 'childElementCount'): 'ParentNode',
84 ('DocumentFragment', 'firstElementChild'): 'ParentNode',
85 ('DocumentFragment', 'lastElementChild'): 'ParentNode',
86 ('CharacterData', 'nextElementSibling'): 'ChildNode',
87 ('CharacterData', 'previousElementSibling'): 'ChildNode',
88 ('Element', 'childElementCount'): 'ParentNode',
89 ('Element', 'firstElementChild'): 'ParentNode',
90 ('Element', 'lastElementChild'): 'ParentNode',
91 ('Element', 'nextElementSibling'): 'ChildNode',
92 ('Element', 'previousElementSibling'): 'ChildNode',
93 ('SVGAnimationElement', 'requiredExtensions'): 'SVGTests',
94 ('SVGAnimationElement', 'requiredFeatures'): 'SVGTests',
95 ('SVGAnimationElement', 'systemLanguage'): 'SVGTests',
96 ('SVGAnimationElement', 'hasExtension'): 'SVGTests',
97 ('SVGGraphicsElement', 'requiredExtensions'): 'SVGTests',
98 ('SVGGraphicsElement', 'requiredFeatures'): 'SVGTests',
99 ('SVGGraphicsElement', 'systemLanguage'): 'SVGTests',
100 ('SVGGraphicsElement', 'hasExtension'): 'SVGTests',
101 ('SVGPatternElement', 'requiredExtensions'): 'SVGTests',
102 ('SVGPatternElement', 'requiredFeatures'): 'SVGTests',
103 ('SVGPatternElement', 'systemLanguage'): 'SVGTests',
104 ('SVGPatternElement', 'hasExtension'): 'SVGTests',
105 ('SVGUseElement', 'requiredExtensions'): 'SVGTests',
106 ('SVGUseElement', 'requiredFeatures'): 'SVGTests',
107 ('SVGUseElement', 'systemLanguage'): 'SVGTests',
108 ('SVGUseElement', 'hasExtension'): 'SVGTests',
109 ('SVGMaskElement', 'requiredExtensions'): 'SVGTests',
110 ('SVGMaskElement', 'requiredFeatures'): 'SVGTests',
111 ('SVGMaskElement', 'systemLanguage'): 'SVGTests',
112 ('SVGMaskElement', 'hasExtension'): 'SVGTests',
113 ('SVGViewSpec', 'zoomAndPan'): 'SVGZoomAndPan',
114 ('SVGViewSpec', 'setZoomAndPan'): 'SVGZoomAndPan',
115 ('SVGViewElement', 'setZoomAndPan'): 'SVGZoomAndPan',
116 ('SVGSVGElement', 'setZoomAndPan'): 'SVGZoomAndPan',
117 ('Screen', 'orientation'): 'ScreenOrientation',
118 ('Screen', 'lockOrientation'): 'ScreenOrientation',
119 ('Screen', 'unlockOrientation'): 'ScreenOrientation',
120 ('Navigator', 'serviceWorker'): 'NavigatorServiceWorker',
121 ('Navigator', 'storageQuota'): 'NavigatorStorageQuota',
122 ('Navigator', 'isProtocolHandlerRegistered'): 'NavigatorContentUtils',
123 ('SharedWorker', 'workerStart'): 'SharedWorkerPerformance',
124 }
80 125
81 _cpp_import_map = { 126 _cpp_import_map = {
82 'ImageBitmapFactories' : 'modules/imagebitmap/ImageBitmapFactories' 127 'ImageBitmapFactories' : 'modules/imagebitmap/ImageBitmapFactories',
128 'ScreenOrientation' : 'modules/screen_orientation/ScreenOrientation'
83 } 129 }
84 130
85 _cpp_overloaded_callback_map = { 131 _cpp_overloaded_callback_map = {
86 ('DOMURL', 'createObjectUrlFromSourceCallback'): 'URLMediaSource', 132 ('DOMURL', 'createObjectUrlFromSourceCallback'): 'URLMediaSource',
87 ('DOMURL', 'createObjectUrlFromStreamCallback'): 'URLMediaStream', 133 ('DOMURL', 'createObjectUrlFromStreamCallback'): 'URLMediaStream',
88 ('DOMURL', '_createObjectUrlFromWebKitSourceCallback'): 'URLMediaSource', 134 ('DOMURL', '_createObjectUrlFromWebKitSourceCallback'): 'URLMediaSource',
89 ('DOMURL', '_createObjectURL_2Callback'): 'URLMediaSource', 135 ('DOMURL', '_createObjectURL_2Callback'): 'URLMediaSource',
90 ('DOMURL', '_createObjectURL_3Callback'): 'URLMediaSource', 136 ('DOMURL', '_createObjectURL_3Callback'): 'URLMediaSource',
91 ('DOMURL', '_createObjectURL_4Callback'): 'URLMediaStream', 137 ('DOMURL', '_createObjectURL_4Callback'): 'URLMediaStream',
92 } 138 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 self._interface.id, 357 self._interface.id,
312 self._renamer.GetLibraryName(self._interface)) 358 self._renamer.GetLibraryName(self._interface))
313 self._cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(sel f._interface.id) 359 self._cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(sel f._interface.id)
314 else: 360 else:
315 self._cpp_header_emitter = emitter.Emitter() 361 self._cpp_header_emitter = emitter.Emitter()
316 self._cpp_impl_emitter = emitter.Emitter() 362 self._cpp_impl_emitter = emitter.Emitter()
317 363
318 self._interface_type_info = self._TypeInfo(self._interface.id) 364 self._interface_type_info = self._TypeInfo(self._interface.id)
319 self._members_emitter = members_emitter 365 self._members_emitter = members_emitter
320 self._cpp_declarations_emitter = emitter.Emitter() 366 self._cpp_declarations_emitter = emitter.Emitter()
367
321 self._cpp_impl_includes = set(['"' + partial + '.h"' 368 self._cpp_impl_includes = set(['"' + partial + '.h"'
322 for partial in _GetCPPPartialNames(self._inte rface)]) 369 for partial in _GetCPPPartialNames(self._inte rface)])
370
371 # This is a hack to work around a strange C++ compile error that we weren't
372 # able to track down the true cause of.
373 if self._interface.id == 'Timing':
374 self._cpp_impl_includes.add('"core/animation/TimedItem.h"')
375
323 self._cpp_definitions_emitter = emitter.Emitter() 376 self._cpp_definitions_emitter = emitter.Emitter()
324 self._cpp_resolver_emitter = emitter.Emitter() 377 self._cpp_resolver_emitter = emitter.Emitter()
325 378
326 # We need to revisit our treatment of typed arrays, right now 379 # We need to revisit our treatment of typed arrays, right now
327 # it is full of hacks. 380 # it is full of hacks.
328 if self._interface.ext_attrs.get('ConstructorTemplate') == 'TypedArray': 381 if self._interface.ext_attrs.get('ConstructorTemplate') == 'TypedArray':
329 self._cpp_resolver_emitter.Emit( 382 self._cpp_resolver_emitter.Emit(
330 ' if (name == "$(INTERFACE_NAME)_constructor_Callback")\n' 383 ' if (name == "$(INTERFACE_NAME)_constructor_Callback")\n'
331 ' return Dart$(INTERFACE_NAME)Internal::constructorCallback;\n' , 384 ' return Dart$(INTERFACE_NAME)Internal::constructorCallback;\n' ,
332 INTERFACE_NAME=self._interface.id) 385 INTERFACE_NAME=self._interface.id)
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 595
543 webcore_includes = self._GenerateCPPIncludes( 596 webcore_includes = self._GenerateCPPIncludes(
544 self._interface_type_info.webcore_includes()) 597 self._interface_type_info.webcore_includes())
545 598
546 is_node_test = lambda interface: interface.id == 'Node' 599 is_node_test = lambda interface: interface.id == 'Node'
547 is_active_test = lambda interface: 'ActiveDOMObject' in interface.ext_attrs 600 is_active_test = lambda interface: 'ActiveDOMObject' in interface.ext_attrs
548 is_event_target_test = lambda interface: 'EventTarget' in interface.ext_attr s 601 is_event_target_test = lambda interface: 'EventTarget' in interface.ext_attr s
549 def TypeCheckHelper(test): 602 def TypeCheckHelper(test):
550 return 'true' if any(map(test, self._database.Hierarchy(self._interface))) else 'false' 603 return 'true' if any(map(test, self._database.Hierarchy(self._interface))) else 'false'
551 604
605 v8_interface_include = ''
606 # V8AbstractWorker.h does not exist so we have to hard code this case.
607 if self._interface.id != 'AbstractWorker':
608 # FIXME: We need this to access the WrapperTypeInfo.
609 v8_interface_include = '#include "V8%s.h"' % (self._interface.id)
610
552 self._cpp_header_emitter.Emit( 611 self._cpp_header_emitter.Emit(
553 self._template_loader.Load('cpp_header.template'), 612 self._template_loader.Load('cpp_header.template'),
554 INTERFACE=self._interface.id, 613 INTERFACE=self._interface.id,
555 WEBCORE_INCLUDES=webcore_includes, 614 WEBCORE_INCLUDES=webcore_includes,
615 V8_INTERFACE_INCLUDE=v8_interface_include,
556 WEBCORE_CLASS_NAME=self._interface_type_info.native_type(), 616 WEBCORE_CLASS_NAME=self._interface_type_info.native_type(),
557 WEBCORE_CLASS_NAME_ESCAPED= 617 WEBCORE_CLASS_NAME_ESCAPED=
558 self._interface_type_info.native_type().replace('<', '_').replace('>', ' _'), 618 self._interface_type_info.native_type().replace('<', '_').replace('>', ' _'),
559 DECLARATIONS=self._cpp_declarations_emitter.Fragments(), 619 DECLARATIONS=self._cpp_declarations_emitter.Fragments(),
560 IS_NODE=TypeCheckHelper(is_node_test), 620 IS_NODE=TypeCheckHelper(is_node_test),
561 IS_ACTIVE=TypeCheckHelper(is_active_test), 621 IS_ACTIVE=TypeCheckHelper(is_active_test),
562 IS_EVENT_TARGET=TypeCheckHelper(is_event_target_test), 622 IS_EVENT_TARGET=TypeCheckHelper(is_event_target_test),
563 TO_NATIVE=to_native_emitter.Fragments(), 623 TO_NATIVE=to_native_emitter.Fragments(),
564 TO_DART=to_dart_emitter.Fragments()) 624 TO_DART=to_dart_emitter.Fragments())
565 625
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 operations, 886 operations,
827 dart_declaration, 887 dart_declaration,
828 GenerateCall, 888 GenerateCall,
829 self._IsArgumentOptionalInWebCore) 889 self._IsArgumentOptionalInWebCore)
830 890
831 def SecondaryContext(self, interface): 891 def SecondaryContext(self, interface):
832 pass 892 pass
833 893
834 def _GenerateOperationNativeCallback(self, operation, arguments, cpp_callback_ name, auto_scope_setup=True): 894 def _GenerateOperationNativeCallback(self, operation, arguments, cpp_callback_ name, auto_scope_setup=True):
835 webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.i d) 895 webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.i d)
896
836 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, operation, cpp_callback_name) 897 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, operation, cpp_callback_name)
837 self._GenerateNativeCallback( 898 self._GenerateNativeCallback(
838 cpp_callback_name, 899 cpp_callback_name,
839 not operation.is_static, 900 not operation.is_static,
840 function_expression, 901 function_expression,
841 operation, 902 operation,
842 arguments, 903 arguments,
843 operation.type.id, 904 operation.type.id,
844 operation.type.nullable, 905 operation.type.nullable,
845 'RaisesException' in operation.ext_attrs, 906 'RaisesException' in operation.ext_attrs,
846 auto_scope_setup, 907 auto_scope_setup,
847 generate_custom_element_scope_if_needed=True) 908 generate_custom_element_scope_if_needed=True)
848 909
849 def _GenerateNativeCallback(self, 910 def _GenerateNativeCallback(self,
850 callback_name, 911 callback_name,
851 needs_receiver, 912 needs_receiver,
852 function_expression, 913 function_expression,
853 node, 914 node,
854 arguments, 915 arguments,
855 return_type, 916 return_type,
856 return_type_is_nullable, 917 return_type_is_nullable,
857 raises_dom_exception, 918 raises_dom_exception,
858 auto_scope_setup=True, 919 auto_scope_setup=True,
859 generate_custom_element_scope_if_needed=False): 920 generate_custom_element_scope_if_needed=False):
860 921
861 ext_attrs = node.ext_attrs 922 ext_attrs = node.ext_attrs
923
862 if self._IsStatic(node.id): 924 if self._IsStatic(node.id):
863 needs_receiver = True 925 needs_receiver = True
864 926
865 cpp_arguments = [] 927 cpp_arguments = []
866 runtime_check = None 928 runtime_check = None
867 raises_exceptions = raises_dom_exception or arguments 929 raises_exceptions = raises_dom_exception or arguments
868 needs_custom_element_callbacks = False 930 needs_custom_element_callbacks = False
869 931
870 # TODO(antonm): unify with ScriptState below. 932 # TODO(antonm): unify with ScriptState below.
871 requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptS tate' or 933 requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptS tate' or
(...skipping 13 matching lines...) Expand all
885 if requires_script_arguments: 947 if requires_script_arguments:
886 raises_exceptions = True 948 raises_exceptions = True
887 cpp_arguments = ['scriptArguments.release()'] 949 cpp_arguments = ['scriptArguments.release()']
888 # WebKit uses scriptArguments to reconstruct last argument, so 950 # WebKit uses scriptArguments to reconstruct last argument, so
889 # it's not needed and should be just removed. 951 # it's not needed and should be just removed.
890 arguments = arguments[:-1] 952 arguments = arguments[:-1]
891 953
892 requires_script_execution_context = (ext_attrs.get('CallWith') == 'Execution Context' or 954 requires_script_execution_context = (ext_attrs.get('CallWith') == 'Execution Context' or
893 ext_attrs.get('ConstructorCallWith') == 'ExecutionContext') 955 ext_attrs.get('ConstructorCallWith') == 'ExecutionContext')
894 956
957 # Hack because our parser misses that these IDL members require an execution
958 # context.
959
960 if (self._interface.id == 'FontFace'
961 and callback_name in ['familySetter', 'featureSettingsSetter', 'stretchS etter',
962 'styleSetter', 'unicodeRangeSetter', 'variantSette r', 'weightSetter']):
963 requires_script_execution_context = True
964
895 requires_document = ext_attrs.get('ConstructorCallWith') == 'Document' 965 requires_document = ext_attrs.get('ConstructorCallWith') == 'Document'
896 966
897 if requires_script_execution_context: 967 if requires_script_execution_context:
898 raises_exceptions = True 968 raises_exceptions = True
899 cpp_arguments = ['context'] 969 cpp_arguments = ['context']
900 970
901 requires_script_state = (ext_attrs.get('CallWith') == 'ScriptState' or 971 requires_script_state = (ext_attrs.get('CallWith') == 'ScriptState' or
902 ext_attrs.get('ConstructorCallWith') == 'ScriptStat e') 972 ext_attrs.get('ConstructorCallWith') == 'ScriptStat e')
903 if requires_script_state: 973 if requires_script_state:
904 raises_exceptions = True 974 raises_exceptions = True
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 body_emitter.Emit( 1059 body_emitter.Emit(
990 ' ScriptState* currentState = DartUtilities::currentScriptState ();\n' 1060 ' ScriptState* currentState = DartUtilities::currentScriptState ();\n'
991 ' if (!currentState) {\n' 1061 ' if (!currentState) {\n'
992 ' exception = Dart_NewStringFromCString("Failed to retrieve a script state");\n' 1062 ' exception = Dart_NewStringFromCString("Failed to retrieve a script state");\n'
993 ' goto fail;\n' 1063 ' goto fail;\n'
994 ' }\n' 1064 ' }\n'
995 ' ScriptState& state = *currentState;\n\n') 1065 ' ScriptState& state = *currentState;\n\n')
996 1066
997 if requires_dom_window or requires_document: 1067 if requires_dom_window or requires_document:
998 self._cpp_impl_includes.add('"DOMWindow.h"') 1068 self._cpp_impl_includes.add('"DOMWindow.h"')
1069
999 body_emitter.Emit( 1070 body_emitter.Emit(
1000 ' DOMWindow* domWindow = DartUtilities::domWindowForCurrentIsol ate();\n' 1071 ' DOMWindow* domWindow = DartUtilities::domWindowForCurrentIsol ate();\n'
1001 ' if (!domWindow) {\n' 1072 ' if (!domWindow) {\n'
1002 ' exception = Dart_NewStringFromCString("Failed to fetch do mWindow");\n' 1073 ' exception = Dart_NewStringFromCString("Failed to fetch do mWindow");\n'
1003 ' goto fail;\n' 1074 ' goto fail;\n'
1004 ' }\n' 1075 ' }\n'
1005 ' Document& document = *domWindow->document();\n') 1076 ' Document& document = *domWindow->document();\n')
1006 1077
1007 if needs_receiver: 1078 if needs_receiver:
1008 body_emitter.Emit( 1079 body_emitter.Emit(
(...skipping 29 matching lines...) Expand all
1038 1109
1039 if needs_custom_element_callbacks: 1110 if needs_custom_element_callbacks:
1040 body_emitter.Emit(' CustomElementCallbackDispatcher::CallbackDelive ryScope deliveryScope;\n'); 1111 body_emitter.Emit(' CustomElementCallbackDispatcher::CallbackDelive ryScope deliveryScope;\n');
1041 1112
1042 # Emit arguments. 1113 # Emit arguments.
1043 start_index = 1 if needs_receiver else 0 1114 start_index = 1 if needs_receiver else 0
1044 for i, argument in enumerate(arguments): 1115 for i, argument in enumerate(arguments):
1045 type_info = self._TypeInfo(argument.type.id) 1116 type_info = self._TypeInfo(argument.type.id)
1046 self._cpp_impl_includes |= set(type_info.conversion_includes()) 1117 self._cpp_impl_includes |= set(type_info.conversion_includes())
1047 argument_expression_template, type, cls, function = \ 1118 argument_expression_template, type, cls, function = \
1048 type_info.to_native_info(argument, self._interface.id) 1119 type_info.to_native_info(argument, self._interface.id, callback_name)
1049 1120
1050 def AllowsNull(): 1121 def AllowsNull():
1051 # TODO(vsm): HTMLSelectElement's indexed setter treats a null as a remov e. 1122 # TODO(vsm): HTMLSelectElement's indexed setter treats a null as a remov e.
1052 # We need to handle that. 1123 # We need to handle that.
1053 # assert argument.ext_attrs.get('TreatNullAs', 'NullString') == 'NullStr ing' 1124 # assert argument.ext_attrs.get('TreatNullAs', 'NullString') == 'NullStr ing'
1054 if argument.ext_attrs.get('TreatNullAs') == 'NullString': 1125 if argument.ext_attrs.get('TreatNullAs') == 'NullString':
1055 return True 1126 return True
1056 1127
1057 if argument.type.nullable: 1128 if argument.type.nullable:
1058 return True 1129 return True
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 cpp_arguments.append('es') 1180 cpp_arguments.append('es')
1110 invocation_emitter = body_emitter.Emit( 1181 invocation_emitter = body_emitter.Emit(
1111 ' DartExceptionState es;\n' 1182 ' DartExceptionState es;\n'
1112 '$!INVOCATION' 1183 '$!INVOCATION'
1113 ' if (es.hadException()) {\n' 1184 ' if (es.hadException()) {\n'
1114 ' exception = DartDOMWrapper::exceptionCodeToDartException(es );\n' 1185 ' exception = DartDOMWrapper::exceptionCodeToDartException(es );\n'
1115 ' goto fail;\n' 1186 ' goto fail;\n'
1116 ' }\n') 1187 ' }\n')
1117 1188
1118 1189
1190 interface_name = self._interface_type_info.native_type()
1191
1119 if needs_receiver: 1192 if needs_receiver:
1120 interface_name = self._interface_type_info.native_type()
1121 # Hack to determine if this came from the _cpp_callback_map. 1193 # Hack to determine if this came from the _cpp_callback_map.
1122 # In this case, the getter is mapped to a static method. 1194 # In this case, the getter is mapped to a static method.
1123 if (not function_expression.startswith('receiver->') and 1195 if function_expression.startswith('SVGTests::'):
1196 cpp_arguments.insert(0, 'receiver')
1197 elif (not function_expression.startswith('receiver->') and
1124 not function_expression.startswith(interface_name + '::')): 1198 not function_expression.startswith(interface_name + '::')):
1125 if interface_name in ['DOMWindow', 'Element', 'Navigator', 'WorkerGlobal Scope']: 1199 if (interface_name in ['DOMWindow', 'Element', 'Navigator', 'WorkerGloba lScope']
1200 or (interface_name in ['SVGViewSpec', 'SVGViewElement', 'SVGSVGEleme nt']
1201 and callback_name in ['setZoomAndPan', 'zoomAndPanSetter', 'zoomAn dPan'])
1202 or (interface_name == 'Screen'
1203 and callback_name in ['_lockOrientation_1Callback', '_lockOrientat ion_2Callback', 'unlockOrientation', 'orientation'])):
1126 cpp_arguments.insert(0, 'receiver') 1204 cpp_arguments.insert(0, 'receiver')
1127 else: 1205 else:
1128 cpp_arguments.append('receiver') 1206 cpp_arguments.append('receiver')
1129 elif self._IsStatic(node.id): 1207 elif self._IsStatic(node.id):
1130 cpp_arguments.insert(0, 'receiver') 1208 cpp_arguments.insert(0, 'receiver')
1131 1209
1210 if interface_name in ['SVGPropertyTearOff<SVGTransform>', 'SVGPropertyTearOf f<SVGAngle>', 'SVGMatrixTearOff'] and function_expression.startswith('receiver-> '):
1211 # This is a horrible hack. I don't know why this one case has to be
1212 # special cased.
1213 if not (self._interface.id == 'SVGTransformList' and callback_name == 'cre ateSVGTransformFromMatrixCallback'):
1214 function_expression = 'receiver->propertyReference().%s' % (function_exp ression[len('receiver->'):])
1215
1132 function_call = '%s(%s)' % (function_expression, ', '.join(cpp_arguments)) 1216 function_call = '%s(%s)' % (function_expression, ', '.join(cpp_arguments))
1133 if return_type == 'void': 1217 if return_type == 'void':
1134 invocation_emitter.Emit( 1218 invocation_emitter.Emit(
1135 ' $FUNCTION_CALL;\n', 1219 ' $FUNCTION_CALL;\n',
1136 FUNCTION_CALL=function_call) 1220 FUNCTION_CALL=function_call)
1137 else: 1221 else:
1138 return_type_info = self._TypeInfo(return_type) 1222 return_type_info = self._TypeInfo(return_type)
1139 self._cpp_impl_includes |= set(return_type_info.conversion_includes()) 1223 self._cpp_impl_includes |= set(return_type_info.conversion_includes())
1140 1224
1141 if return_type_is_nullable: 1225 if return_type_is_nullable:
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 e.Emit("};\n"); 1497 e.Emit("};\n");
1414 e.Emit('\n'); 1498 e.Emit('\n');
1415 e.Emit('} // namespace WebCore\n'); 1499 e.Emit('} // namespace WebCore\n');
1416 1500
1417 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 1501 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
1418 return ( 1502 return (
1419 interface.id.endswith('Event') and 1503 interface.id.endswith('Event') and
1420 operation.id.startswith('init') and 1504 operation.id.startswith('init') and
1421 argument.ext_attrs.get('Default') == 'Undefined' and 1505 argument.ext_attrs.get('Default') == 'Undefined' and
1422 argument.type.id == 'DOMString') 1506 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/src/native_DOMImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698