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

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

Issue 175693007: Generate isHTML*Element() / toHTML*Element() helper functions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make toHTMLObjectElement() work for FormAssociatedElement input Created 6 years, 10 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 | « Source/core/html/HTMLOListElement.h ('k') | Source/core/html/HTMLOptGroupElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLObjectElement.h
diff --git a/Source/core/html/HTMLObjectElement.h b/Source/core/html/HTMLObjectElement.h
index 347ed7993f84c2d830523921f786417f11f132d6..1ca9fd85774ebaeb8114eb16a953b7eed6f4fd53 100644
--- a/Source/core/html/HTMLObjectElement.h
+++ b/Source/core/html/HTMLObjectElement.h
@@ -111,9 +111,13 @@ private:
bool m_useFallbackContent : 1;
};
-DEFINE_NODE_TYPE_CASTS(HTMLObjectElement, hasTagName(HTMLNames::objectTag));
+// Intentionally left unimplemented, template specialization needs to be provided for specific
+// return types.
+template<typename T> inline const T& toElement(const FormAssociatedElement&);
Inactive 2014/02/23 18:27:33 I made toHTMLObjectElement() accept a FormAssociat
+template<typename T> inline const T* toElement(const FormAssociatedElement*);
-inline const HTMLObjectElement* toHTMLObjectElement(const FormAssociatedElement* element)
+// Make toHTMLObjectElement() accept a FormAssociatedElement as input instead of a Node.
+template<> inline const HTMLObjectElement* toElement<HTMLObjectElement>(const FormAssociatedElement* element)
{
ASSERT_WITH_SECURITY_IMPLICATION(!element || !element->isFormControlElement());
const HTMLObjectElement* objectElement = static_cast<const HTMLObjectElement*>(element);
@@ -123,7 +127,7 @@ inline const HTMLObjectElement* toHTMLObjectElement(const FormAssociatedElement*
return objectElement;
}
-inline const HTMLObjectElement& toHTMLObjectElement(const FormAssociatedElement& element)
+template<> inline const HTMLObjectElement& toElement<HTMLObjectElement>(const FormAssociatedElement& element)
{
ASSERT_WITH_SECURITY_IMPLICATION(!element.isFormControlElement());
const HTMLObjectElement& objectElement = static_cast<const HTMLObjectElement&>(element);
« no previous file with comments | « Source/core/html/HTMLOListElement.h ('k') | Source/core/html/HTMLOptGroupElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698