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

Unified Diff: Source/core/dom/Element.h

Issue 191963002: Use new Traversal<SVG*Element> API more in SVG code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | Source/core/svg/SVGAnimateElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | Source/core/svg/SVGAnimateElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698