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

Unified Diff: third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl

Issue 2419383002: Add function to check what HTML Element interface corresponds to a given tag name. (Closed)
Patch Set: Made changes Created 4 years, 2 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: third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
index 41e819805b4bddec7f607ff60adad54543aea120..f6ad8a8ee4d3f29d7e4a6e00fb0a19c764369f59 100644
--- a/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
@@ -4,7 +4,7 @@
#ifndef {{namespace}}ElementTypeHelpers_h
#define {{namespace}}ElementTypeHelpers_h
-#include "core/dom/Element.h"
+#include "core/{{namespace|lower}}/{{namespace}}Element.h"
#include "{{namespace}}Names.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -35,6 +35,22 @@ template <> inline bool isElementOfType<const {{tag.interface}}>(const {{namespa
{% for tag in tags|sort if not tag.multipleTagNames and not tag.noTypeHelpers %}
#define to{{tag.interface}}(x) blink::toElement<blink::{{tag.interface}}>(x)
{% endfor %}
+
+{% if namespace == "HTML" %}
+
+enum class HTMLElementType {
+ {% for element in elements|sort %} k{{element}},
+ {% endfor %}
+};
+
+// Tag checking.
+// tagName is the local name for an html element in lowercase
+// The corresponding HTMLElement type for the tag name will be returned
+// Do NOT use this function with SVG tag names and SVGElements
+// If tagName is an undefined html tag name HTMLUnknownElement is returned
+HTMLElementType htmlElementTypeForTag(const AtomicString& tagName);
+
+{% endif %}
} // namespace blink
#endif
« no previous file with comments | « third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.cpp.tmpl ('k') | third_party/WebKit/Source/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698