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

Side by Side Diff: sky/engine/build/scripts/templates/ElementFactory.cpp.tmpl

Issue 943013002: Implement Custom Elements (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: attributeChanged***d***Callback Created 5 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 unified diff | Download patch
OLDNEW
1 {% from "macros.tmpl" import license %} 1 {% from "macros.tmpl" import license %}
2 {{ license() }} 2 {{ license() }}
3 3
4 #include "config.h" 4 #include "config.h"
5 #include "{{namespace}}ElementFactory.h" 5 #include "{{namespace}}ElementFactory.h"
6 6
7 #include "{{namespace}}Names.h" 7 #include "{{namespace}}Names.h"
8 {% for tag in tags|sort %} 8 {% for tag in tags|sort %}
9 #include "core/{{namespace|lower}}/{{tag.interface}}.h" 9 #include "core/{{namespace|lower}}/{{tag.interface}}.h"
10 {% endfor %} 10 {% endfor %}
11 {% if fallback_interface %} 11 {% if fallback_interface %}
12 #include "core/{{namespace|lower}}/{{fallback_interface}}.h" 12 #include "core/{{namespace|lower}}/{{fallback_interface}}.h"
13 {% endif %} 13 {% endif %}
14 #include "core/dom/custom/CustomElement.h" 14 #include "core/dom/custom2/new_custom_element_registry.h"
15 #include "core/dom/custom/CustomElementRegistrationContext.h"
16 #include "core/dom/Document.h" 15 #include "core/dom/Document.h"
17 #include "core/frame/Settings.h" 16 #include "core/frame/Settings.h"
18 #include "gen/sky/platform/RuntimeEnabledFeatures.h" 17 #include "gen/sky/platform/RuntimeEnabledFeatures.h"
19 #include "wtf/HashMap.h" 18 #include "wtf/HashMap.h"
20 19
21 namespace blink { 20 namespace blink {
22 21
23 using namespace {{namespace}}Names; 22 using namespace {{namespace}}Names;
24 23
25 typedef PassRefPtr<{{namespace}}Element> (*ConstructorFunction)( 24 typedef PassRefPtr<{{namespace}}Element> (*ConstructorFunction)(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 72
74 PassRefPtr<Element> {{namespace}}ElementFactory::createElement( 73 PassRefPtr<Element> {{namespace}}ElementFactory::createElement(
75 const AtomicString& localName, 74 const AtomicString& localName,
76 Document& document, 75 Document& document,
77 bool createdByParser) 76 bool createdByParser)
78 { 77 {
79 if (!g_constructors) 78 if (!g_constructors)
80 create{{namespace}}FunctionMap(); 79 create{{namespace}}FunctionMap();
81 if (ConstructorFunction function = g_constructors->get(localName)) 80 if (ConstructorFunction function = g_constructors->get(localName))
82 return function(document, createdByParser); 81 return function(document, createdByParser);
83 82 return document.elementRegistry().CreateElement(document, localName);
84 if (CustomElement::isValidName(localName))
85 return document.registrationContext().createCustomTagElement(document, Q ualifiedName(localName));
86
87 return {{fallback_interface}}::create(QualifiedName(localName), document);
88 } 83 }
89 84
90 } // namespace blink 85 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698