{% from "macros.tmpl" import license %} {{ license() }} #include "{{namespace}}ElementFactory.h" #include "{{namespace}}Names.h" {% for tag in tags|sort %} #include "core/{{namespace|lower}}/{{tag.interface}}.h" {% endfor %} {% if fallback_interface %} #include "core/{{namespace|lower}}/{{fallback_interface}}.h" {% endif %} #include "core/dom/custom/custom_element_registry.h" #include "core/dom/Document.h" #include "core/frame/Settings.h" #include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "wtf/HashMap.h" namespace blink { using namespace {{namespace}}Names; typedef PassRefPtr<{{namespace}}Element> (*ConstructorFunction)( Document&, bool createdByParser); typedef HashMap FunctionMap; {% for tag in tags|sort if not tag.noConstructor %} {% filter enable_conditional(tag.Conditional) %} static PassRefPtr<{{namespace}}Element> {{tag|symbol}}Constructor( Document& document, bool createdByParser) { {% if tag.runtimeEnabled %} if (!RuntimeEnabledFeatures::{{tag.runtimeEnabled}}Enabled()) return {{fallback_interface}}::create({{tag|symbol}}Tag, document); {% endif %} return {{tag.interface}}::create( {%- if tag.multipleTagNames %}{{tag|symbol}}Tag, {% endif -%} document {%- if tag.constructorNeedsCreatedByParser %}, createdByParser{% endif -%} ); } {% endfilter %} {% endfor %} struct Create{{namespace}}FunctionMapData { const QualifiedName& tag; ConstructorFunction func; }; PassRefPtr {{namespace}}ElementFactory::createElement( const AtomicString& localName, Document& document, bool createdByParser) { return document.elementRegistry().CreateElement(document, localName); } } // namespace blink