OLD | NEW |
1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_cpp_value %} | 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_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_data_type_property %} | 8 {%- if attribute.is_data_type_property %} |
9 const v8::PropertyCallbackInfo<v8::Value>& info | 9 const v8::PropertyCallbackInfo<v8::Value>& info |
10 {%- else %} | 10 {%- else %} |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 return false; | 482 return false; |
483 | 483 |
484 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 484 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
485 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn
UserScript, "{{cpp_class}}", "{{attribute.name}}", holder, {{attribute.private_s
cript_cpp_value_to_v8_value}}); | 485 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn
UserScript, "{{cpp_class}}", "{{attribute.name}}", holder, {{attribute.private_s
cript_cpp_value_to_v8_value}}); |
486 } | 486 } |
487 {% endmacro %} | 487 {% endmacro %} |
488 | 488 |
489 | 489 |
490 {##############################################################################} | 490 {##############################################################################} |
491 {% macro attribute_configuration(attribute) %} | 491 {% macro attribute_configuration(attribute) %} |
| 492 {% from 'conversions.cpp' import property_location %} |
492 {% if attribute.constructor_type %} | 493 {% if attribute.constructor_type %} |
493 {% set getter_callback = | 494 {% set getter_callback = |
494 '%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial, attr
ibute.name) | 495 '%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial, attr
ibute.name) |
495 if attribute.needs_constructor_getter_callback else | 496 if attribute.needs_constructor_getter_callback else |
496 'v8ConstructorAttributeGetter' %} | 497 'v8ConstructorAttributeGetter' %} |
497 {% set setter_callback = | 498 {% set setter_callback = |
498 '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_or_partial, attrib
ute.name) | 499 '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_or_partial, attrib
ute.name) |
499 if attribute.needs_constructor_setter_callback else | 500 if attribute.needs_constructor_setter_callback else |
500 '%sV8Internal::%sConstructorAttributeSetterCallback' % (cpp_class_or_part
ial, cpp_class) %} | 501 '%sV8Internal::%sConstructorAttributeSetterCallback' % (cpp_class_or_part
ial, cpp_class) %} |
501 {% else %}{# regular attributes #} | 502 {% else %}{# regular attributes #} |
(...skipping 18 matching lines...) Expand all Loading... |
520 ' | '.join(attribute.access_control_list) %} | 521 ' | '.join(attribute.access_control_list) %} |
521 {% else %} | 522 {% else %} |
522 {% set access_control = 'v8::DEFAULT' %} | 523 {% set access_control = 'v8::DEFAULT' %} |
523 {% endif %} | 524 {% endif %} |
524 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % | 525 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % |
525 ' | '.join(attribute.property_attributes) %} | 526 ' | '.join(attribute.property_attributes) %} |
526 {% set only_exposed_to_private_script = | 527 {% set only_exposed_to_private_script = |
527 'V8DOMConfiguration::OnlyExposedToPrivateScript' | 528 'V8DOMConfiguration::OnlyExposedToPrivateScript' |
528 if attribute.only_exposed_to_private_script else | 529 if attribute.only_exposed_to_private_script else |
529 'V8DOMConfiguration::ExposedToAllScripts' %} | 530 'V8DOMConfiguration::ExposedToAllScripts' %} |
530 {% set property_location_list = [] %} | |
531 {% if attribute.on_instance %} | |
532 {% set property_location_list = property_location_list + ['V8DOMConfiguration::O
nInstance'] %} | |
533 {% endif %} | |
534 {% if attribute.on_prototype %} | |
535 {% set property_location_list = property_location_list + ['V8DOMConfiguration::O
nPrototype'] %} | |
536 {% endif %} | |
537 {% if attribute.on_interface %} | |
538 {% set property_location_list = property_location_list + ['V8DOMConfiguration::O
nInterface'] %} | |
539 {% endif %} | |
540 {% set property_location = property_location_list | join(' | ') %} | |
541 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' | 531 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' |
542 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} | 532 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} |
543 {% set attribute_configuration_list = [ | 533 {% set attribute_configuration_list = [ |
544 '"%s"' % attribute.name, | 534 '"%s"' % attribute.name, |
545 getter_callback, | 535 getter_callback, |
546 setter_callback, | 536 setter_callback, |
547 getter_callback_for_main_world, | 537 getter_callback_for_main_world, |
548 setter_callback_for_main_world, | 538 setter_callback_for_main_world, |
549 wrapper_type_info, | 539 wrapper_type_info, |
550 access_control, | 540 access_control, |
551 property_attribute, | 541 property_attribute, |
552 only_exposed_to_private_script, | 542 only_exposed_to_private_script, |
553 property_location, | 543 property_location(attribute), |
554 holder_check, | 544 holder_check, |
555 ] %} | 545 ] %} |
556 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 546 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
557 {%- endmacro %} | 547 {%- endmacro %} |
OLD | NEW |