| 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 63d283460ec5d9b0760c3728b81fe7fdca860d59..912224722b47d612b9f6f4f48845aa4037d06d39 100644
|
| --- a/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
|
| +++ b/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
|
| @@ -17,21 +17,7 @@ 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' %}
|
| -inline bool is{{tag.interface}}(const HTMLElement& element) {
|
| - {% if tag.runtimeEnabled or tag.contextConditional %}
|
| - if (element.isHTMLUnknownElement())
|
| - return false;
|
| - {% 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 %}
|
| -inline bool is{{tag.interface}}(const Element& element) {
|
| +inline bool is{{tag.interface}}(const {{namespace}}Element& element) {
|
| {% if tag.contextConditional %}
|
| if (!ContextFeatures::{{tag.contextConditional}}Enabled(&element.document()))
|
| return false;
|
| @@ -42,17 +28,15 @@ inline bool is{{tag.interface}}(const Element& element) {
|
| {% endif %}
|
| return element.hasTagName({{namespace}}Names::{{tag|symbol}}Tag);
|
| }
|
| -{% endif %}
|
| -inline bool is{{tag.interface}}(const Element* element) { return element && is{{tag.interface}}(*element); }
|
| +inline bool is{{tag.interface}}(const {{namespace}}Element* element) { return element && is{{tag.interface}}(*element); }
|
| template<typename T> inline bool is{{tag.interface}}(const PassRefPtr<T>& node) { return is{{tag.interface}}(node.get()); }
|
| template<typename T> inline bool is{{tag.interface}}(const RefPtr<T>& node) { return is{{tag.interface}}(node.get()); }
|
| -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" %}
|
| -template <> inline bool isElementOfType<const {{tag.interface}}>(const HTMLElement& element) { return is{{tag.interface}}(element); }
|
| -{% endif %}
|
| +inline bool is{{tag.interface}}(const Node& node) { return node.is{{namespace}}Element() && is{{tag.interface}}(to{{namespace}}Element(node)); }
|
| +inline bool is{{tag.interface}}(const Node* node) { return node && is{{tag.interface}}(*node); }
|
| +template <> inline bool isElementOfType<const {{tag.interface}}>(const Node& node) { return is{{tag.interface}}(node); }
|
| +template <> inline bool isElementOfType<const {{tag.interface}}>(const {{namespace}}Element& element) { return is{{tag.interface}}(element); }
|
| {% endfilter %}
|
| +
|
| {% endfor %}
|
| // 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.
|
|
|