From 2c4d69359fc76d115c62e14383c4eef21f6b1ba5 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Thu, 16 Apr 2020 17:53:41 -0400 Subject: Issue #1375 - Overload FromContent() to work with const --- dom/base/nsIContent.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dom/base/nsIContent.h b/dom/base/nsIContent.h index edb0d69f3..25b582abd 100644 --- a/dom/base/nsIContent.h +++ b/dom/base/nsIContent.h @@ -1028,7 +1028,15 @@ inline nsIContent* nsINode::AsContent() { \ return aContent->_check ? static_cast<_class*>(aContent) : nullptr; \ } \ + static const _class* FromContent(const nsIContent* aContent) \ + { \ + return aContent->_check ? static_cast(aContent) : nullptr; \ + } \ static _class* FromContentOrNull(nsIContent* aContent) \ + { \ + return aContent ? FromContent(aContent) : nullptr; \ + } \ + static const _class* FromContentOrNull(const nsIContent* aContent) \ { \ return aContent ? FromContent(aContent) : nullptr; \ } -- cgit v1.2.3