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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/ElementFactory.cpp.tmpl

Issue 2002903002: Hook createElement for Custom Elements V1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: RuntimeEnabledFeatures Created 4 years, 7 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 "{{namespace}}ElementFactory.h" 4 #include "{{namespace}}ElementFactory.h"
5 5
6 #include "{{namespace}}Names.h" 6 #include "{{namespace}}Names.h"
7 {% for tag in tags|groupby('interface') %} 7 {% for tag in tags|groupby('interface') %}
8 #include "core/{{namespace|lower}}/{{tag[0]}}.h" 8 #include "core/{{namespace|lower}}/{{tag[0]}}.h"
9 {% endfor %} 9 {% endfor %}
10 {% if fallback_interface %} 10 {% if fallback_interface %}
11 #include "core/{{namespace|lower}}/{{fallback_interface}}.h" 11 #include "core/{{namespace|lower}}/{{fallback_interface}}.h"
12 {% endif %} 12 {% endif %}
13 {% if namespace == 'HTML' %}
14 #include "core/dom/custom/CustomElement.h"
15 {% endif %}
13 #include "core/dom/custom/V0CustomElement.h" 16 #include "core/dom/custom/V0CustomElement.h"
14 #include "core/dom/custom/V0CustomElementRegistrationContext.h" 17 #include "core/dom/custom/V0CustomElementRegistrationContext.h"
15 #include "core/dom/Document.h" 18 #include "core/dom/Document.h"
16 #include "core/frame/Settings.h" 19 #include "core/frame/Settings.h"
17 #include "platform/RuntimeEnabledFeatures.h" 20 #include "platform/RuntimeEnabledFeatures.h"
18 #include "wtf/HashMap.h" 21 #include "wtf/HashMap.h"
19 22
20 namespace blink { 23 namespace blink {
21 24
22 using namespace {{namespace}}Names; 25 using namespace {{namespace}}Names;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 {% if namespace == 'HTML' %} 82 {% if namespace == 'HTML' %}
80 HTMLFormElement* formElement, 83 HTMLFormElement* formElement,
81 {% endif %} 84 {% endif %}
82 bool createdByParser) 85 bool createdByParser)
83 { 86 {
84 if (!g_constructors) 87 if (!g_constructors)
85 create{{namespace}}FunctionMap(); 88 create{{namespace}}FunctionMap();
86 if (ConstructorFunction function = g_constructors->get(localName)) 89 if (ConstructorFunction function = g_constructors->get(localName))
87 return function(document, {% if namespace == 'HTML' %}formElement, {% en dif %}createdByParser); 90 return function(document, {% if namespace == 'HTML' %}formElement, {% en dif %}createdByParser);
88 91
92 {% if namespace == 'HTML' %}
93 if (CustomElement::shouldCreateCustomElement(document, localName))
dominicc (has gone to gerrit) 2016/05/25 05:25:52 :/ this might do things with v0 where they did not
kojii 2016/05/25 05:58:24 Not sure if I understand correctly, but if you're
94 return CustomElement::createCustomElement(document, localName);
95 {% endif %}
96
89 if (document.registrationContext() && V0CustomElement::isValidName(localName )) { 97 if (document.registrationContext() && V0CustomElement::isValidName(localName )) {
90 Element* element = document.registrationContext()->createCustomTagElemen t(document, QualifiedName(nullAtom, localName, {{namespace_prefix}}NamespaceURI) ); 98 Element* element = document.registrationContext()->createCustomTagElemen t(document, QualifiedName(nullAtom, localName, {{namespace_prefix}}NamespaceURI) );
91 ASSERT_WITH_SECURITY_IMPLICATION(element->is{{namespace}}Element()); 99 ASSERT_WITH_SECURITY_IMPLICATION(element->is{{namespace}}Element());
92 return to{{namespace}}Element(element); 100 return to{{namespace}}Element(element);
93 } 101 }
94 102
95 return {{fallback_interface}}::create(QualifiedName(nullAtom, localName, {{n amespace_prefix}}NamespaceURI), document); 103 return {{fallback_interface}}::create(QualifiedName(nullAtom, localName, {{n amespace_prefix}}NamespaceURI), document);
96 } 104 }
97 105
98 } // namespace blink 106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698