| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro generate_method(method, world_suffix) %} | 2 {% macro generate_method(method, world_suffix) %} |
| 3 {% filter conditional(method.conditional_string) %} | 3 {% filter conditional(method.conditional_string) %} |
| 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| 5 { | 5 { |
| 6 {# Local variables #} | 6 {# Local variables #} |
| 7 {% if method.has_exception_state %} | 7 {% if method.has_exception_state %} |
| 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 9 {% endif %} | 9 {% endif %} |
| 10 {# Overloaded methods have length checked during overload resolution #} | 10 {# Overloaded methods have length checked during overload resolution #} |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 argument instead; see argument.is_variadic_wrapper_type code-path below. #} | 128 argument instead; see argument.is_variadic_wrapper_type code-path below. #} |
| 129 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi
nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI
nstance(info[{{argument.index}}], info.GetIsolate())) { | 129 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi
nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI
nstance(info[{{argument.index}}], info.GetIsolate())) { |
| 130 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % | 130 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
| 131 (argument.index + 1, argument.idl_type)) | indent
}} | 131 (argument.index + 1, argument.idl_type)) | indent
}} |
| 132 return; | 132 return; |
| 133 } | 133 } |
| 134 {% endif %}{# argument.has_type_checking_interface #} | 134 {% endif %}{# argument.has_type_checking_interface #} |
| 135 {% if argument.is_callback_interface %} | 135 {% if argument.is_callback_interface %} |
| 136 {# FIXME: remove EventListener special case #} | 136 {# FIXME: remove EventListener special case #} |
| 137 {% if argument.idl_type == 'EventListener' %} | 137 {% if argument.idl_type == 'EventListener' %} |
| 138 {% if method.name == 'removeEventListener' %} | 138 {% if method.name == 'removeEventListener' or method.name == 'removeListener' %} |
| 139 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i
nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly); | 139 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i
nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly); |
| 140 {% else %}{# method.name == 'addEventListener' #} | 140 {% else %}{# method.name == 'addEventListener' #} |
| 141 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i
nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate); | 141 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i
nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate); |
| 142 {% endif %}{# method.name #} | 142 {% endif %}{# method.name #} |
| 143 {% else %}{# argument.idl_type == 'EventListener' #} | 143 {% else %}{# argument.idl_type == 'EventListener' #} |
| 144 {# Callback functions must be functions: | 144 {# Callback functions must be functions: |
| 145 http://www.w3.org/TR/WebIDL/#es-callback-function #} | 145 http://www.w3.org/TR/WebIDL/#es-callback-function #} |
| 146 {% if argument.is_optional %} | 146 {% if argument.is_optional %} |
| 147 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind
ex}}])) { | 147 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind
ex}}])) { |
| 148 if (!info[{{argument.index}}]->IsFunction()) { | 148 if (!info[{{argument.index}}]->IsFunction()) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 {% if method.is_explicit_nullable %} | 275 {% if method.is_explicit_nullable %} |
| 276 if (result.isNull()) | 276 if (result.isNull()) |
| 277 v8SetReturnValueNull(info); | 277 v8SetReturnValueNull(info); |
| 278 else | 278 else |
| 279 {{v8_set_return_value}}; | 279 {{v8_set_return_value}}; |
| 280 {% else %} | 280 {% else %} |
| 281 {{v8_set_return_value}}; | 281 {{v8_set_return_value}}; |
| 282 {% endif %} | 282 {% endif %} |
| 283 {%- endif %}{# None for void #} | 283 {%- endif %}{# None for void #} |
| 284 {# Post-set #} | 284 {# Post-set #} |
| 285 {% if interface_name == 'EventTarget' and method.name in ('addEventListener', | 285 {% if interface_name in ('EventTarget', 'MediaQueryList') |
| 286 'removeEventListener')
%} | 286 and method.name in ('addEventListener', 'removeEventListener', 'addListener'
, 'removeListener') %} |
| 287 {% set hidden_dependency_action = 'addHiddenValueToArray' | 287 {% set hidden_dependency_action = 'addHiddenValueToArray' |
| 288 if method.name == 'addEventListener' else 'removeHiddenValueFromArray' %} | 288 if method.name in ('addEventListener', 'addListener') else 'removeHiddenV
alueFromArray' %} |
| 289 {% set argument_index = '1' if interface_name == 'EventTarget' else '0' %} |
| 289 {# Length check needed to skip action on legacy calls without enough arguments. | 290 {# Length check needed to skip action on legacy calls without enough arguments. |
| 290 http://crbug.com/353484 #} | 291 http://crbug.com/353484 #} |
| 291 if (info.Length() >= 2 && listener && !impl->toNode()) | 292 if (info.Length() >= 2 && listener && !impl->toNode()) |
| 292 {{hidden_dependency_action}}(info.Holder(), info[1], {{v8_class}}::eventList
enerCacheIndex, info.GetIsolate()); | 293 {{hidden_dependency_action}}(info.Holder(), info[{{argument_index}}], {{v8_c
lass}}::eventListenerCacheIndex, info.GetIsolate()); |
| 293 {% endif %} | 294 {% endif %} |
| 294 {% endmacro %} | 295 {% endmacro %} |
| 295 | 296 |
| 296 | 297 |
| 297 {######################################} | 298 {######################################} |
| 298 {% macro union_type_method_call_and_set_return_value(method) %} | 299 {% macro union_type_method_call_and_set_return_value(method) %} |
| 299 {% for cpp_type in method.cpp_type %} | 300 {% for cpp_type in method.cpp_type %} |
| 300 bool result{{loop.index0}}Enabled = false; | 301 bool result{{loop.index0}}Enabled = false; |
| 301 {{cpp_type}} result{{loop.index0}}; | 302 {{cpp_type}} result{{loop.index0}}; |
| 302 {% endfor %} | 303 {% endfor %} |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate
()); | 633 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate
()); |
| 633 {% else %} | 634 {% else %} |
| 634 {% set constructor_class = v8_class + ('Constructor' | 635 {% set constructor_class = v8_class + ('Constructor' |
| 635 if constructor.is_named_constructor else | 636 if constructor.is_named_constructor else |
| 636 '') %} | 637 '') %} |
| 637 v8::Handle<v8::Object> wrapper = info.Holder(); | 638 v8::Handle<v8::Object> wrapper = info.Holder(); |
| 638 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr
uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat
ion}}); | 639 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr
uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat
ion}}); |
| 639 {% endif %} | 640 {% endif %} |
| 640 v8SetReturnValue(info, wrapper); | 641 v8SetReturnValue(info, wrapper); |
| 641 {% endmacro %} | 642 {% endmacro %} |
| OLD | NEW |