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

Unified Diff: Source/build/scripts/templates/ElementFactory.cpp.tmpl

Issue 236673002: Simplify whitespace handling in build/ Jinja templates (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: One more FIXME Created 6 years, 8 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
« no previous file with comments | « Source/build/scripts/template_expander.py ('k') | Source/build/scripts/templates/ElementFactory.h.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/build/scripts/templates/ElementFactory.cpp.tmpl
diff --git a/Source/build/scripts/templates/ElementFactory.cpp.tmpl b/Source/build/scripts/templates/ElementFactory.cpp.tmpl
index 1ac6129aa2be1dc2a1fc952156d1f36fd49bec50..592dcfc740ee33a59b33922c5daa0a15b165498e 100644
--- a/Source/build/scripts/templates/ElementFactory.cpp.tmpl
+++ b/Source/build/scripts/templates/ElementFactory.cpp.tmpl
@@ -1,4 +1,4 @@
-{% from "macros.tmpl" import license -%}
+{% from "macros.tmpl" import license %}
{{ license() }}
#include "config.h"
@@ -6,12 +6,12 @@
#include "RuntimeEnabledFeatures.h"
#include "{{namespace}}Names.h"
-{%- for tag in tags|sort %}
+{% for tag in tags|sort %}
#include "core/{{namespace|lower}}/{{tag.interface}}.h"
-{%- endfor %}
-{%- if fallback_interface %}
+{% endfor %}
+{% if fallback_interface %}
#include "core/{{namespace|lower}}/{{fallback_interface}}.h"
-{%- endif %}
+{% endif %}
#include "core/dom/ContextFeatures.h"
#include "core/dom/custom/CustomElement.h"
#include "core/dom/custom/CustomElementRegistrationContext.h"
@@ -24,39 +24,40 @@ namespace WebCore {
using namespace {{namespace}}Names;
typedef PassRefPtr<{{namespace}}Element> (*ConstructorFunction)(Document&,
- {%- if namespace == 'HTML' %}
+ {% if namespace == 'HTML' %}
HTMLFormElement*,
- {%- endif %}
+ {% endif %}
bool createdByParser);
typedef HashMap<AtomicString, ConstructorFunction> FunctionMap;
static FunctionMap* g_constructors = 0;
-
-{%- for tag in tags|sort if not tag.noConstructor %}
+{# FIXME: add blank line #}
+{% for tag in tags|sort if not tag.noConstructor %}
static PassRefPtr<{{namespace}}Element> {{tag|symbol}}Constructor(
Document& document,
-{%- if namespace == 'HTML' %}
+ {% if namespace == 'HTML' %}
HTMLFormElement* formElement,
-{%- endif %}
+ {% endif %}
bool createdByParser)
{
-{%- if tag.contextConditional %}
+ {% if tag.contextConditional %}
if (!ContextFeatures::{{tag.contextConditional}}Enabled(&document))
return {{fallback_interface}}::create({{tag|symbol}}Tag, document);
-{%- endif %}
-{%- if tag.runtimeEnabled %}
+ {% endif %}
+ {% if tag.runtimeEnabled %}
if (!RuntimeEnabledFeatures::{{tag.runtimeEnabled}}Enabled())
return {{fallback_interface}}::create({{tag|symbol}}Tag, document);
-{%- endif %}
+ {% endif %}
+ {# FIXME: replace with an |args| variable #}
return {{tag.interface}}::create(
-{%- if tag.multipleTagNames -%} {{tag|symbol}}Tag, {% endif -%}
+ {%- if tag.multipleTagNames %}{{tag|symbol}}Tag, {% endif -%}
document
-{%- if namespace == 'HTML' and tag.constructorNeedsFormElement %}, formElement{% endif -%}
-{%- if tag.constructorNeedsCreatedByParser %}, createdByParser{% endif -%}
+ {%- if namespace == 'HTML' and tag.constructorNeedsFormElement %}, formElement{% endif %}
+ {%- if tag.constructorNeedsCreatedByParser %}, createdByParser{% endif -%}
);
}
-{%- endfor %}
+{% endfor %}
struct Create{{namespace}}FunctionMapData {
const QualifiedName& tag;
@@ -68,9 +69,9 @@ static void create{{namespace}}FunctionMap()
ASSERT(!g_constructors);
g_constructors = new FunctionMap;
static const Create{{namespace}}FunctionMapData data[] = {
-{%- for tag in tags|sort if not tag.noConstructor %}
+ {% for tag in tags|sort if not tag.noConstructor %}
{ {{tag|symbol}}Tag, {{tag|symbol}}Constructor },
-{%- endfor %}
+ {% endfor %}
};
for (size_t i = 0; i < WTF_ARRAY_LENGTH(data); i++)
g_constructors->set(data[i].tag.localName(), data[i].func);
@@ -79,15 +80,17 @@ static void create{{namespace}}FunctionMap()
PassRefPtr<{{namespace}}Element> {{namespace}}ElementFactory::create{{namespace}}Element(
const AtomicString& localName,
Document& document,
-{%- if namespace == 'HTML' %}
+ {% if namespace == 'HTML' %}
HTMLFormElement* formElement,
-{%- endif %}
+ {% endif %}
bool createdByParser)
{
if (!g_constructors)
create{{namespace}}FunctionMap();
if (ConstructorFunction function = g_constructors->get(localName))
- return function(document, {%- if namespace == 'HTML' %}formElement,{% endif %} createdByParser);
+ {# FIXME: add missing space; should be:
+ return function(document, {% if namespace == 'HTML' %}formElement, {% endif %}createdByParser); #}
+ return function(document,{% if namespace == 'HTML' %}formElement,{% endif %} createdByParser);
if (document.registrationContext() && CustomElement::isValidName(localName)) {
RefPtr<Element> element = document.registrationContext()->createCustomTagElement(document, QualifiedName(nullAtom, localName, {{namespace_prefix}}NamespaceURI));
« no previous file with comments | « Source/build/scripts/template_expander.py ('k') | Source/build/scripts/templates/ElementFactory.h.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698