Index: Source/core/dom/Element.h |
diff --git a/Source/core/dom/Element.h b/Source/core/dom/Element.h |
index e70cc638e960047023adedca42ccf0f35af1a381..ba609f48cc7048c69df023eee089499db30d6c10 100644 |
--- a/Source/core/dom/Element.h |
+++ b/Source/core/dom/Element.h |
@@ -888,6 +888,16 @@ inline bool isShadowHost(const Element* element) |
return element && element->shadow(); |
} |
+// These macros do the same as their NODE equivalents but additionally provide a template specialization |
+// for isElementOfType<>() so that the Traversal<> API works for these Element types. |
+#define DEFINE_ELEMENT_TYPE_CASTS(thisType, predicate) \ |
+ template <> inline bool isElementOfType<const thisType>(const Element& element) { return element.predicate; } \ |
+ DEFINE_NODE_TYPE_CASTS(thisType, predicate) |
+ |
+#define DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ |
+ template <> inline bool isElementOfType<const thisType>(const Element& element) { return is##thisType(element); } \ |
+ DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) |
+ |
} // namespace |
#endif |