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

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

Issue 23591020: Add toHTMLDocument() convenience methods that take a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Improve casting Created 7 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 | « Source/core/dom/Element.cpp ('k') | Source/core/html/HTMLIFrameElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLDocument.h
diff --git a/Source/core/html/HTMLDocument.h b/Source/core/html/HTMLDocument.h
index 6990a78bdba86226742ae5106a4008a3e70f26a3..181b94203088614b3c722ffd7b684110f29fb6b4 100644
--- a/Source/core/html/HTMLDocument.h
+++ b/Source/core/html/HTMLDocument.h
@@ -112,6 +112,18 @@ inline const HTMLDocument* toHTMLDocument(const Document* document)
return static_cast<const HTMLDocument*>(document);
}
+inline HTMLDocument& toHTMLDocument(Document& document)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(document.isHTMLDocument());
+ return static_cast<HTMLDocument&>(document);
+}
+
+inline const HTMLDocument& toHTMLDocument(const Document& document)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(document.isHTMLDocument());
+ return static_cast<const HTMLDocument&>(document);
+}
+
// This will catch anyone doing an unnecessary cast.
void toHTMLDocument(const HTMLDocument*);
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/HTMLIFrameElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698