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

Unified Diff: Source/core/dom/EventFactory.cpp.tmpl

Issue 14905002: Use jinja2 templating engine for Python code generators (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 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
Index: Source/core/dom/EventFactory.cpp.tmpl
diff --git a/Source/core/dom/EventFactory.cpp.tmpl b/Source/core/dom/EventFactory.cpp.tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..dfbe9e4cab684c08191b5b944aaa3a9c6f1da731
--- /dev/null
+++ b/Source/core/dom/EventFactory.cpp.tmpl
@@ -0,0 +1,26 @@
+{% from "macros.tmpl" import wrap_with_condition -%}
+
+{{ license }}
+#include "config.h"
+#include "EventFactory.h"
+
+#include "EventHeaders.h"
+#include "RuntimeEnabledFeatures.h"
+
+namespace WebCore {
+
+PassRefPtr<{{namespace}}> {{namespace}}Factory::create(const String& type)
+{
+{%- for event in events %}
+{%- call wrap_with_condition(event.conditional) %}
+ if (type == "{{event.name}}"
+ {{- " && RuntimeEnabledFeatures::" + event.runtimeConditional + "()" if event.runtimeConditional else "" -}}
+ )
+ return {{event.interfaceName}}::create();
+{%- endcall %}
+{%- endfor %}
+ return 0;
+}
+
+} // namespace WebCore
+

Powered by Google App Engine
This is Rietveld 408576698