Index: Source/build/scripts/templates/ElementWrapperFactory.cpp.tmpl |
diff --git a/Source/build/scripts/templates/ElementWrapperFactory.cpp.tmpl b/Source/build/scripts/templates/ElementWrapperFactory.cpp.tmpl |
index b3b4603045eaf0ee100c29ea025fc3cf1a3086b6..03123f30e73594726a511bbfd121011763cffc8a 100644 |
--- a/Source/build/scripts/templates/ElementWrapperFactory.cpp.tmpl |
+++ b/Source/build/scripts/templates/ElementWrapperFactory.cpp.tmpl |
@@ -7,15 +7,13 @@ |
#include "RuntimeEnabledFeatures.h" |
#include "{{namespace}}Names.h" |
#include "bindings/v8/CustomElementWrapper.h" |
-{%- for tag in tags|sort if tag|has_js_interface %} |
-#include "V8{{tag|interface}}.h" |
+{%- for tag in tags|sort if tag.has_js_interface %} |
+#include "V8{{tag.interface}}.h" |
{%- endfor %} |
-{%- for tag in tags|sort if tag|has_js_interface %} |
-#include "core/{{namespace|lower}}/{{tag|js_interface}}.h" |
+{%- for tag in tags|sort if tag.has_js_interface %} |
+#include "core/{{namespace|lower}}/{{tag.js_interface}}.h" |
{%- endfor %} |
-{%- if fallback_interface %} |
-#include "core/{{namespace|lower}}/{{fallback_interface}}.h" |
-{%- endif %} |
+#include "core/{{namespace|lower}}/{{fallback_js_interface}}.h" |
#include "core/dom/ContextFeatures.h" |
#include "core/dom/Document.h" |
#include "core/page/Settings.h" |
@@ -33,19 +31,19 @@ static v8::Handle<v8::Object> create{{namespace}}ElementWrapper({{namespace}}Ele |
return v8::Handle<v8::Object>(); |
} |
-{%- for interface, list in tags|sort|groupby('js_interface') if interface %} |
-static v8::Handle<v8::Object> create{{interface}}Wrapper({{namespace}}Element* element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
+{%- for js_interface, list in tags|sort|selectattr('has_js_interface')|groupby('js_interface') %} |
+static v8::Handle<v8::Object> create{{js_interface}}Wrapper({{namespace}}Element* element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
{ |
{%- if list[0].wrapperOnlyIfMediaIsAvailable %} |
Settings* settings = element->document().settings(); |
if (!RuntimeEnabledFeatures::mediaEnabled() || (settings && !settings->mediaEnabled())) |
- return createV8{{namespace}}FallbackWrapper(to{{fallback_interface}}(element), creationContext, isolate); |
+ return createV8{{namespace}}FallbackWrapper(to{{fallback_js_interface}}(element), creationContext, isolate); |
{%- endif %} |
{%- if list[0].contextConditional %} |
if (!ContextFeatures::{{list[0].contextConditional}}Enabled(&element->document())) |
- return createV8{{namespace}}FallbackWrapper(to{{fallback_interface}}(element), creationContext, isolate); |
+ return createV8{{namespace}}FallbackWrapper(to{{fallback_js_interface}}(element), creationContext, isolate); |
{%- endif %} |
- return wrap(static_cast<{{interface}}*>(element), creationContext, isolate); |
+ return wrap(static_cast<{{js_interface}}*>(element), creationContext, isolate); |
} |
{%- endfor %} |
@@ -55,11 +53,11 @@ v8::Handle<v8::Object> createV8{{namespace}}Wrapper({{namespace}}Element* elemen |
DEFINE_STATIC_LOCAL(FunctionMap, map, ()); |
if (map.isEmpty()) { |
{%- for tag in tags|sort %} |
- map.set({{tag|symbol}}Tag.localName().impl(), create{{tag|js_interface}}Wrapper); |
+ map.set({{tag|symbol}}Tag.localName().impl(), create{{tag.js_interface}}Wrapper); |
{%- endfor %} |
} // taco |
- CreateHTMLElementWrapperFunction createWrapperFunction = map.get(element->localName().impl()); |
+ Create{{namespace}}ElementWrapperFunction createWrapperFunction = map.get(element->localName().impl()); |
if (createWrapperFunction == create{{namespace}}ElementWrapper) |
createWrapperFunction = createV8{{namespace}}DirectWrapper; |
if (element->isCustomElement()) |
@@ -67,7 +65,11 @@ v8::Handle<v8::Object> createV8{{namespace}}Wrapper({{namespace}}Element* elemen |
if (createWrapperFunction) |
return createWrapperFunction(element, creationContext, isolate); |
- return wrap(to{{fallback_interface}}(element), creationContext, isolate); |
+{%- if fallback_js_interface == namespace + "Element" %} |
+ return V8{{fallback_js_interface}}::createWrapper(element, creationContext, isolate); |
+{%- else %} |
+ return wrap(to{{fallback_js_interface}}(element), creationContext, isolate); |
+{%- endif %} |
} |
WrapperTypeInfo* findWrapperTypeFor{{namespace}}TagName(const AtomicString& name) |
@@ -77,15 +79,15 @@ WrapperTypeInfo* findWrapperTypeFor{{namespace}}TagName(const AtomicString& name |
if (map.isEmpty()) { |
// FIXME: This seems wrong. We should list every interface here, not |
// just the ones that have specialized JavaScript interfaces. |
-{%- for tag in tags|sort if tag|has_js_interface %} |
- map.set({{tag|symbol}}Tag.localName().impl(), WrapperTypeTraits<{{tag|js_interface}}>::info()); |
+{%- for tag in tags|sort if tag.has_js_interface %} |
+ map.set({{tag|symbol}}Tag.localName().impl(), WrapperTypeTraits<{{tag.js_interface}}>::info()); |
{%- endfor %} |
} |
if (WrapperTypeInfo* result = map.get(name.impl())) |
return result; |
- return WrapperTypeTraits<{{fallback_interface}}>::info(); |
+ return WrapperTypeTraits<{{fallback_js_interface}}>::info(); |
} |
} |