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

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

Issue 30493002: IDL compiler: EventHandler for setters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Briefer Created 7 years, 2 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 50f45c10347209f050277f1db47feaf5ed9499ef..80593fe954028bb5ffcab279ed5cd474c2489722 100644
--- a/Source/bindings/templates/attributes.cpp
+++ b/Source/bindings/templates/attributes.cpp
@@ -107,7 +107,18 @@ static void {{attribute.name}}AttributeGetterCallback{{world_suffix}}(v8::Local<
static void {{attribute.name}}AttributeSetter{{world_suffix}}(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
{{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder());
+ {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %}
+ if (!imp->document())
haraken 2013/10/19 12:41:29 I think this check should be moved to core/ if the
Nils Barth (inactive) 2013/10/21 02:41:38 28 attribute setters.
haraken 2013/10/21 03:43:52 OK, then it would make sense to keep the check in
Nils Barth (inactive) 2013/10/21 03:58:34 Got it, n/p!
+ return;
+ {% endif %}
+ {% if attribute.idl_type != 'EventHandler' %}
{{attribute.v8_value_to_local_cpp_value}};
+ {% else %}{# EventHandler hack #}
+ {# Non-callable input should be treated as null #}
+ if (!jsValue->IsNull() && !jsValue->IsFunction())
+ jsValue = v8::Null(info.GetIsolate());
+ transferHiddenDependency(info.Holder(), {{attribute.event_handler_getter_expression}}, jsValue, {{v8_class_name}}::eventListenerCacheIndex, info.GetIsolate());
+ {% endif %}
{% if attribute.is_call_with_script_execution_context %}
ExecutionContext* scriptContext = getExecutionContext();
{% endif %}

Powered by Google App Engine
This is Rietveld 408576698