| OLD | NEW |
| 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value, check_origin_trial %} | 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value, check_origin_trial %} |
| 2 | 2 |
| 3 {##############################################################################} | 3 {##############################################################################} |
| 4 {% macro attribute_getter(attribute, world_suffix) %} | 4 {% macro attribute_getter(attribute, world_suffix) %} |
| 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
| 6 {%- if attribute.is_data_type_property %} | 6 {%- if attribute.is_data_type_property %} |
| 7 const v8::PropertyCallbackInfo<v8::Value>& info | 7 const v8::PropertyCallbackInfo<v8::Value>& info |
| 8 {%- else %} | 8 {%- else %} |
| 9 const v8::FunctionCallbackInfo<v8::Value>& info | 9 const v8::FunctionCallbackInfo<v8::Value>& info |
| 10 {%- endif %}) | 10 {%- endif %}) |
| 11 { | 11 { |
| 12 {% if attribute.origin_trial_enabled_function %} | 12 {% if attribute.origin_trial_enabled_function %} |
| 13 {{check_origin_trial(attribute) | indent}} | 13 {{check_origin_trial(attribute) | indent}} |
| 14 {% endif %} | 14 {% endif %} |
| 15 {% if attribute.is_reflect and not attribute.is_url | 15 {% if attribute.is_reflect and not attribute.is_url |
| 16 and attribute.idl_type == 'DOMString' and is_node | 16 and attribute.idl_type == 'DOMString' and is_node |
| 17 and not attribute.is_implemented_in_private_script %} | 17 and not attribute.is_implemented_in_private_script %} |
| 18 {% set cpp_class, v8_class = 'Element', 'V8Element' %} | 18 {% set cpp_class, v8_class = 'Element', 'V8Element' %} |
| 19 {% endif %} | 19 {% endif %} |
| 20 {# holder #} | 20 {# holder #} |
| 21 {% if not attribute.is_static %} | 21 {% if not attribute.is_static %} |
| 22 {% if attribute.is_lenient_this %} | 22 {% if attribute.is_lenient_this %} |
| 23 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} | 23 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} |
| 24 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) | 24 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
| 25 return; // Return silently because of [LenientThis]. | 25 return; // Return silently because of [LenientThis]. |
| 26 {% endif %} | 26 {% endif %} |
| 27 v8::Local<v8::Object> holder = info.Holder(); | 27 v8::Local<v8::Object> holder = info.Holder(); |
| 28 {% endif %} | 28 {% endif %} |
| 29 {# impl #} | 29 {# impl #} |
| 30 {% if not attribute.is_static %} | |
| 31 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | |
| 32 {% endif %} | |
| 33 {% if attribute.is_same_object %} | |
| 34 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "same
object_{{attribute.name}}"); | |
| 35 { | |
| 36 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState
::current(info.GetIsolate()), holder, propertyName); | |
| 37 if (!v8Value.IsEmpty()) { | |
| 38 v8SetReturnValue(info, v8Value); | |
| 39 return; | |
| 40 } | |
| 41 } | |
| 42 {% endif %} | |
| 43 {% if attribute.cached_attribute_validation_method %} | 30 {% if attribute.cached_attribute_validation_method %} |
| 44 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); | 31 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); |
| 32 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 45 if (!impl->{{attribute.cached_attribute_validation_method}}()) { | 33 if (!impl->{{attribute.cached_attribute_validation_method}}()) { |
| 46 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState
::current(info.GetIsolate()), holder, propertyName); | 34 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState
::current(info.GetIsolate()), holder, propertyName); |
| 47 if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) { | 35 if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) { |
| 48 v8SetReturnValue(info, v8Value); | 36 v8SetReturnValue(info, v8Value); |
| 49 return; | 37 return; |
| 50 } | 38 } |
| 51 } | 39 } |
| 40 {% elif not attribute.is_static %} |
| 41 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 52 {% endif %} | 42 {% endif %} |
| 53 {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %} | 43 {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %} |
| 54 if (!impl->document()) | 44 if (!impl->document()) |
| 55 return; | 45 return; |
| 56 {% endif %} | 46 {% endif %} |
| 57 {# Local variables #} | 47 {# Local variables #} |
| 58 {% if attribute.is_call_with_execution_context %} | 48 {% if attribute.is_call_with_execution_context %} |
| 59 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); | 49 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); |
| 60 {% endif %} | 50 {% endif %} |
| 61 {% if attribute.is_call_with_script_state %} | 51 {% if attribute.is_call_with_script_state %} |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 116 } |
| 127 {% elif world_suffix %} | 117 {% elif world_suffix %} |
| 128 {{attribute.v8_set_return_value_for_main_world}}; | 118 {{attribute.v8_set_return_value_for_main_world}}; |
| 129 {% else %} | 119 {% else %} |
| 130 {% if attribute.use_output_parameter_for_result %} | 120 {% if attribute.use_output_parameter_for_result %} |
| 131 {{attribute.cpp_type}} result; | 121 {{attribute.cpp_type}} result; |
| 132 {{attribute.cpp_value}}; | 122 {{attribute.cpp_value}}; |
| 133 {% endif %} | 123 {% endif %} |
| 134 {{attribute.v8_set_return_value}}; | 124 {{attribute.v8_set_return_value}}; |
| 135 {% endif %} | 125 {% endif %} |
| 136 {% if attribute.is_same_object %} | |
| 137 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), holde
r, propertyName, info.GetReturnValue().Get()); | |
| 138 {% endif %} | |
| 139 } | 126 } |
| 140 {% endmacro %} | 127 {% endmacro %} |
| 141 | 128 |
| 142 | 129 |
| 143 {######################################} | 130 {######################################} |
| 144 {% macro release_only_check(reflect_only_values, reflect_missing, | 131 {% macro release_only_check(reflect_only_values, reflect_missing, |
| 145 reflect_invalid, reflect_empty, cpp_value) %} | 132 reflect_invalid, reflect_empty, cpp_value) %} |
| 146 {# Attribute is limited to only known values: check that the attribute value is | 133 {# Attribute is limited to only known values: check that the attribute value is |
| 147 one of those. If not, set it to the empty string. | 134 one of those. If not, set it to the empty string. |
| 148 http://www.whatwg.org/specs/web-apps/current-work/#limited-to-only-known-valu
es #} | 135 http://www.whatwg.org/specs/web-apps/current-work/#limited-to-only-known-valu
es #} |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 setter_callback_for_main_world, | 499 setter_callback_for_main_world, |
| 513 wrapper_type_info, | 500 wrapper_type_info, |
| 514 access_control, | 501 access_control, |
| 515 property_attribute, | 502 property_attribute, |
| 516 only_exposed_to_private_script, | 503 only_exposed_to_private_script, |
| 517 property_location(attribute), | 504 property_location(attribute), |
| 518 holder_check, | 505 holder_check, |
| 519 ] %} | 506 ] %} |
| 520 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 507 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 521 {%- endmacro %} | 508 {%- endmacro %} |
| OLD | NEW |