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

Unified Diff: Source/bindings/templates/attributes.cpp

Issue 953473002: bindings: Supports [Replaceable] accessors. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed a review comment. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/templates/attributes.cpp
diff --git a/Source/bindings/templates/attributes.cpp b/Source/bindings/templates/attributes.cpp
index 7b1a84db784dc1e0f003ee70abef2a3dd2b0fbaa..cc89f02bbedef3015efa3485544fc8bcaa846995 100644
--- a/Source/bindings/templates/attributes.cpp
+++ b/Source/bindings/templates/attributes.cpp
@@ -214,7 +214,7 @@ v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info
{% set cpp_class, v8_class = 'Element', 'V8Element' %}
{% endif %}
{# Local variables #}
- {% if not attribute.is_static %}
+ {% if not attribute.is_static and not attribute.is_replaceable %}
v8::Local<v8::Object> holder = info.Holder();
{% endif %}
{% if attribute.has_setter_exception_state %}
@@ -226,6 +226,9 @@ v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info
{{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}());
if (!impl)
return;
+ {% elif attribute.is_replaceable %}
+ v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{attribute.name}}");
+ {{cpp_class}}ForceSetAttributeOnThis(propertyName, v8Value, info);
{% elif not attribute.is_static %}
{{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
{% endif %}
@@ -235,7 +238,9 @@ v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info
{% endif %}
{# Convert JS value to C++ value #}
{% if attribute.idl_type != 'EventHandler' %}
+ {% if v8_value_to_local_cpp_value(attribute) %}
{{v8_value_to_local_cpp_value(attribute) | indent}}
+ {% endif %}
{% elif not is_node %}{# EventHandler hack #}
moveEventListenerToNewWrapper(info.GetIsolate(), holder, {{attribute.event_handler_getter_expression}}, v8Value, {{v8_class}}::eventListenerCacheIndex);
{% endif %}
@@ -268,7 +273,9 @@ v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info
ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
{% endif %}
{# Set #}
+ {% if attribute.cpp_setter %}
{{attribute.cpp_setter}};
+ {% endif %}
{# Post-set #}
{% if attribute.is_setter_raises_exception %}
exceptionState.throwIfNeeded();

Powered by Google App Engine
This is Rietveld 408576698