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

Unified Diff: Source/core/html/HTMLElement.h

Issue 471173003: Introduce HasHTMLTagName functor and use it with ElementTraversal (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add comment Created 6 years, 4 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/html/HTMLTableElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLElement.h
diff --git a/Source/core/html/HTMLElement.h b/Source/core/html/HTMLElement.h
index 590b8eff543b5b1692d5a03681e742c48e930649..082ca218edb6a9674ca8c24bd6baee87f78fd74e 100644
--- a/Source/core/html/HTMLElement.h
+++ b/Source/core/html/HTMLElement.h
@@ -149,6 +149,15 @@ inline bool Node::hasTagName(const HTMLQualifiedName& name) const
return isHTMLElement() && toHTMLElement(*this).hasTagName(name);
}
+// Functor used to match HTMLElements with a specific HTML tag when using the ElementTraversal API.
+class HasHTMLTagName {
+public:
+ explicit HasHTMLTagName(const HTMLQualifiedName& tagName): m_tagName(tagName) { }
+ bool operator() (const HTMLElement& element) const { return element.hasTagName(m_tagName); }
+private:
+ const HTMLQualifiedName& m_tagName;
+};
+
// This requires isHTML*Element(const Element&) and isHTML*Element(const HTMLElement&).
// When the input element is an HTMLElement, we don't need to check the namespace URI, just the local name.
#define DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \
« no previous file with comments | « no previous file | Source/core/html/HTMLTableElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698