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

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: Rebased 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
« no previous file with comments | « Source/bindings/scripts/unstable/v8_types.py ('k') | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/attributes.cpp
diff --git a/Source/bindings/templates/attributes.cpp b/Source/bindings/templates/attributes.cpp
index c7c1345d5ff23fb44a05fe882844796c581365ab..151308fd025cd922cfda658d3ec0ff8ee1b8851c 100644
--- a/Source/bindings/templates/attributes.cpp
+++ b/Source/bindings/templates/attributes.cpp
@@ -110,7 +110,18 @@ static void {{attribute.name}}AttributeSetter{{world_suffix}}(v8::Local<v8::Stri
{% if not attribute.is_static %}
{{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder());
{% endif %}
+ {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %}
+ if (!imp->document())
+ 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.enum_validation_expression %}
{# Setter ignores invalid enum values #}
String string = cppValue;
« no previous file with comments | « Source/bindings/scripts/unstable/v8_types.py ('k') | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698