| OLD | NEW |
| 1 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %} | 1 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% macro attribute_getter(attribute, world_suffix) %} | 5 {% macro attribute_getter(attribute, world_suffix) %} |
| 6 {% filter conditional(attribute.conditional_string) %} | 6 {% filter conditional(attribute.conditional_string) %} |
| 7 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 7 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
| 8 {%- if attribute.is_expose_js_accessors %} | 8 {%- if attribute.is_expose_js_accessors %} |
| 9 const v8::FunctionCallbackInfo<v8::Value>& info | 9 const v8::FunctionCallbackInfo<v8::Value>& info |
| 10 {%- else %} | 10 {%- else %} |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info | 207 v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info |
| 208 {%- else %} | 208 {%- else %} |
| 209 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info | 209 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info |
| 210 {%- endif %}) | 210 {%- endif %}) |
| 211 { | 211 { |
| 212 {% if attribute.is_reflect and attribute.idl_type == 'DOMString' | 212 {% if attribute.is_reflect and attribute.idl_type == 'DOMString' |
| 213 and is_node and not attribute.is_implemented_in_private_script %} | 213 and is_node and not attribute.is_implemented_in_private_script %} |
| 214 {% set cpp_class, v8_class = 'Element', 'V8Element' %} | 214 {% set cpp_class, v8_class = 'Element', 'V8Element' %} |
| 215 {% endif %} | 215 {% endif %} |
| 216 {# Local variables #} | 216 {# Local variables #} |
| 217 {% if not attribute.is_static %} | 217 {% if not attribute.is_static and not attribute.is_replaceable %} |
| 218 v8::Local<v8::Object> holder = info.Holder(); | 218 v8::Local<v8::Object> holder = info.Holder(); |
| 219 {% endif %} | 219 {% endif %} |
| 220 {% if attribute.has_setter_exception_state %} | 220 {% if attribute.has_setter_exception_state %} |
| 221 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); | 221 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); |
| 222 {% endif %} | 222 {% endif %} |
| 223 {# impl #} | 223 {# impl #} |
| 224 {% if attribute.put_forwards %} | 224 {% if attribute.put_forwards %} |
| 225 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); | 225 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); |
| 226 {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}()); | 226 {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}()); |
| 227 if (!impl) | 227 if (!impl) |
| 228 return; | 228 return; |
| 229 {% elif attribute.is_replaceable %} |
| 230 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); |
| 231 {{cpp_class}}ForceSetAttributeOnThis(propertyName, v8Value, info); |
| 229 {% elif not attribute.is_static %} | 232 {% elif not attribute.is_static %} |
| 230 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 233 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 231 {% endif %} | 234 {% endif %} |
| 232 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %} | 235 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %} |
| 233 if (!impl->document()) | 236 if (!impl->document()) |
| 234 return; | 237 return; |
| 235 {% endif %} | 238 {% endif %} |
| 236 {# Convert JS value to C++ value #} | 239 {# Convert JS value to C++ value #} |
| 237 {% if attribute.idl_type != 'EventHandler' %} | 240 {% if attribute.idl_type != 'EventHandler' %} |
| 241 {% if v8_value_to_local_cpp_value(attribute) %} |
| 238 {{v8_value_to_local_cpp_value(attribute) | indent}} | 242 {{v8_value_to_local_cpp_value(attribute) | indent}} |
| 243 {% endif %} |
| 239 {% elif not is_node %}{# EventHandler hack #} | 244 {% elif not is_node %}{# EventHandler hack #} |
| 240 moveEventListenerToNewWrapper(info.GetIsolate(), holder, {{attribute.event_h
andler_getter_expression}}, v8Value, {{v8_class}}::eventListenerCacheIndex); | 245 moveEventListenerToNewWrapper(info.GetIsolate(), holder, {{attribute.event_h
andler_getter_expression}}, v8Value, {{v8_class}}::eventListenerCacheIndex); |
| 241 {% endif %} | 246 {% endif %} |
| 242 {# Type checking, possibly throw a TypeError, per: | 247 {# Type checking, possibly throw a TypeError, per: |
| 243 http://www.w3.org/TR/WebIDL/#es-type-mapping #} | 248 http://www.w3.org/TR/WebIDL/#es-type-mapping #} |
| 244 {% if attribute.has_type_checking_interface %} | 249 {% if attribute.has_type_checking_interface %} |
| 245 {# Type checking for interface types (if interface not implemented, throw | 250 {# Type checking for interface types (if interface not implemented, throw |
| 246 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} | 251 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} |
| 247 if (!cppValue{% if attribute.is_nullable %} && !isUndefinedOrNull(v8Value){%
endif %}) { | 252 if (!cppValue{% if attribute.is_nullable %} && !isUndefinedOrNull(v8Value){%
endif %}) { |
| 248 exceptionState.throwTypeError("The provided value is not of type '{{attr
ibute.idl_type}}'."); | 253 exceptionState.throwTypeError("The provided value is not of type '{{attr
ibute.idl_type}}'."); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 261 (attribute.is_reflect and | 266 (attribute.is_reflect and |
| 262 not(attribute.idl_type == 'DOMString' and is_node)) %} | 267 not(attribute.idl_type == 'DOMString' and is_node)) %} |
| 263 {# Skip on compact node DOMString getters #} | 268 {# Skip on compact node DOMString getters #} |
| 264 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 269 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
| 265 {% endif %} | 270 {% endif %} |
| 266 {% if attribute.is_call_with_execution_context or | 271 {% if attribute.is_call_with_execution_context or |
| 267 attribute.is_setter_call_with_execution_context %} | 272 attribute.is_setter_call_with_execution_context %} |
| 268 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); | 273 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); |
| 269 {% endif %} | 274 {% endif %} |
| 270 {# Set #} | 275 {# Set #} |
| 276 {% if attribute.cpp_setter %} |
| 271 {{attribute.cpp_setter}}; | 277 {{attribute.cpp_setter}}; |
| 278 {% endif %} |
| 272 {# Post-set #} | 279 {# Post-set #} |
| 273 {% if attribute.is_setter_raises_exception %} | 280 {% if attribute.is_setter_raises_exception %} |
| 274 exceptionState.throwIfNeeded(); | 281 exceptionState.throwIfNeeded(); |
| 275 {% endif %} | 282 {% endif %} |
| 276 {% if attribute.cached_attribute_validation_method %} | 283 {% if attribute.cached_attribute_validation_method %} |
| 277 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), holder, v8AtomicString(i
nfo.GetIsolate(), "{{attribute.name}}")); // Invalidate the cached value. | 284 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), holder, v8AtomicString(i
nfo.GetIsolate(), "{{attribute.name}}")); // Invalidate the cached value. |
| 278 {% endif %} | 285 {% endif %} |
| 279 } | 286 } |
| 280 {% endfilter %} | 287 {% endfilter %} |
| 281 {% endmacro %} | 288 {% endmacro %} |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 access_control, | 430 access_control, |
| 424 property_attribute, | 431 property_attribute, |
| 425 only_exposed_to_private_script, | 432 only_exposed_to_private_script, |
| 426 ] %} | 433 ] %} |
| 427 {% if not attribute.is_expose_js_accessors %} | 434 {% if not attribute.is_expose_js_accessors %} |
| 428 {% set attribute_configuration_list = attribute_configuration_list | 435 {% set attribute_configuration_list = attribute_configuration_list |
| 429 + [on_prototype] %} | 436 + [on_prototype] %} |
| 430 {% endif %} | 437 {% endif %} |
| 431 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 438 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 432 {%- endmacro %} | 439 {%- endmacro %} |
| OLD | NEW |