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

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

Issue 140663012: IDL compiler: Window-specific code + Window-only features (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No headers for named constructor attributes Created 6 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 f5a342f1546420d6c17c874a44018632e57121e5..1ed99173defcc50ef2cdc5b02123ad721e63f4aa 100644
--- a/Source/bindings/templates/attributes.cpp
+++ b/Source/bindings/templates/attributes.cpp
@@ -13,13 +13,17 @@ const v8::PropertyCallbackInfo<v8::Value>& info
{% set cpp_class, v8_class = 'Element', 'V8Element' %}
{# FIXME: Perl skips most of function, but this seems unnecessary #}
{% endif %}
- {% if attribute.is_unforgeable %}
+ {% if attribute.is_unforgeable or
+ interface_name == 'Window' and attribute.idl_type == 'EventHandler' %}
+ {% if interface_name == 'Window' %}
+ v8::Handle<v8::Object> holder = info.Holder();
+ {% else %}{# perform lookup first #}
v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{v8_class}}::domTemplate(info.GetIsolate(), worldType(info.GetIsolate())));
haraken 2014/02/06 07:57:44 I don't think we need this look up. I think we can
Nils Barth (inactive) 2014/02/06 08:40:14 Got it, added a FIXME.
if (holder.IsEmpty())
return;
+ {% endif %}{# Window #}
{{cpp_class}}* imp = {{v8_class}}::toNative(holder);
- {% endif %}
- {% if attribute.cached_attribute_validation_method %}
+ {% elif attribute.cached_attribute_validation_method %}
v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{attribute.name}}");
{{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
if (!imp->{{attribute.cached_attribute_validation_method}}()) {
@@ -31,7 +35,7 @@ const v8::PropertyCallbackInfo<v8::Value>& info
}
{% elif not (attribute.is_static or attribute.is_unforgeable) %}
{{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
- {% endif %}
+ {% endif %}{# imp #}
{% if attribute.reflect_only %}
{{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_original}};
{{release_only_check(attribute.reflect_only, attribute.reflect_missing,
@@ -59,6 +63,10 @@ const v8::PropertyCallbackInfo<v8::Value>& info
if (UNLIKELY(exceptionState.throwIfNeeded()))
return;
{% endif %}
+ {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %}
+ if (!imp->document())
+ return;
+ {% endif %}
{% if attribute.is_nullable %}
bool isNull = false;
{{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_original}};
@@ -191,14 +199,16 @@ v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
return;
}
{% endif %}
- {% if attribute.put_forwards %}
+ {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %}
+ {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
haraken 2014/02/06 07:57:44 This branch is doing exactly the same thing as the
Nils Barth (inactive) 2014/02/06 08:40:14 You mean the {% elif not attribute.is_static %} br
+ {% elif attribute.put_forwards %}
{{cpp_class}}* proxyImp = {{v8_class}}::toNative(info.Holder());
{{attribute.idl_type}}* imp = proxyImp->{{attribute.name}}();
if (!imp)
return;
{% elif not attribute.is_static %}
{{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
- {% endif %}
+ {% endif %}{# imp #}
{% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %}
if (!imp->document())
return;

Powered by Google App Engine
This is Rietveld 408576698