| Index: Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
|
| diff --git a/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl b/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
|
| index 623877e7e73be873d5d64bfac8e5c3d83690f174..b79df23fd426897bd60e39082af476a8c451b328 100644
|
| --- a/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
|
| +++ b/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
|
| @@ -1,4 +1,4 @@
|
| -{% from "macros.tmpl" import license -%}
|
| +{% from "macros.tmpl" import license %}
|
| {{ license() }}
|
|
|
| #ifndef {{namespace}}ElementTypeHelpers_h
|
| @@ -12,34 +12,40 @@
|
| namespace WebCore {
|
| // Type checking.
|
| {% for tag in tags|sort if not tag.multipleTagNames and not tag.noTypeHelpers %}
|
| +{# FIXME: remove blank line #}
|
| +
|
| class {{tag.interface}};
|
| void is{{tag.interface}}(const {{tag.interface}}&); // Catch unnecessary runtime check of type known at compile time.
|
| void is{{tag.interface}}(const {{tag.interface}}*); // Catch unnecessary runtime check of type known at compile time.
|
|
|
| {# For HTML Elements, call hasLocalName() instead of hasTagName() to avoid checking the namespace unnecessarily #}
|
| -{%- if namespace == "HTML" -%}
|
| +{% if namespace == "HTML" %}
|
| inline bool is{{tag.interface}}(const HTMLElement& element) {
|
| -{%- if tag.runtimeEnabled or tag.contextConditional %}
|
| + {% if tag.runtimeEnabled or tag.contextConditional %}
|
| if (element.isHTMLUnknownElement())
|
| return false;
|
| -{%- endif %}
|
| + {% endif %}
|
| return element.hasLocalName(HTMLNames::{{tag|symbol}}Tag);
|
| }
|
| inline bool is{{tag.interface}}(const Element& element) {
|
| return element.isHTMLElement() && is{{tag.interface}}(toHTMLElement(element));
|
| }
|
| inline bool is{{tag.interface}}(const HTMLElement* element) { return element && is{{tag.interface}}(*element); }
|
| -{% else %}
|
| +{# FIXME: remove - #}
|
| +{%- else %}
|
| +{# FIXME: remove blank line #}
|
| +
|
| inline bool is{{tag.interface}}(const Element& element) {
|
| -{%- if tag.contextConditional %}
|
| + {% if tag.contextConditional %}
|
| if (!ContextFeatures::{{tag.contextConditional}}Enabled(&element.document()))
|
| return false;
|
| -{%- endif %}
|
| -{%- if tag.runtimeEnabled %}
|
| + {% endif %}
|
| + {% if tag.runtimeEnabled %}
|
| if (!RuntimeEnabledFeatures::{{tag.runtimeEnabled}}Enabled())
|
| return false;
|
| -{%- endif %}
|
| + {% endif %}
|
| return element.hasTagName({{namespace}}Names::{{tag|symbol}}Tag);
|
| + {# FIXME: remove the - #}
|
| }
|
| {%- endif -%}
|
|
|
| @@ -49,16 +55,21 @@ template<typename T> inline bool is{{tag.interface}}(const RefPtr<T>& node) { re
|
| inline bool is{{tag.interface}}(const Node& node) { return node.isElementNode() ? is{{tag.interface}}(toElement(node)) : false; }
|
| inline bool is{{tag.interface}}(const Node* node) { return node && node->isElementNode() ? is{{tag.interface}}(*toElement(node)) : false; }
|
| template <> inline bool isElementOfType<const {{tag.interface}}>(const Element& element) { return is{{tag.interface}}(element); }
|
| -{%- if namespace == "HTML" %}
|
| +{% if namespace == "HTML" %}
|
| template <> inline bool isElementOfType<const {{tag.interface}}>(const HTMLElement& element) { return is{{tag.interface}}(element); }
|
| -{%- endif %}
|
| +{% endif %}
|
|
|
| {% endfor %}
|
| +{# FIXME: remove excess blank lines #}
|
| +
|
|
|
| // Using macros because the types are forward-declared and we don't want to use reinterpret_cast in the
|
| // casting functions above. reinterpret_cast would be unsafe due to multiple inheritence.
|
| +
|
| {% for tag in tags|sort if not tag.multipleTagNames and not tag.noTypeHelpers %}
|
| #define to{{tag.interface}}(x) WebCore::toElement<WebCore::{{tag.interface}}>(x)
|
| +{# FIXME: remove blank line #}
|
| +
|
| {% endfor %}
|
| } // WebCore
|
|
|
|
|