Bug 763283 part 1 - Add new nsINode::AsContent() and nsINode::IsContent() methods; r=mounir

This commit is contained in:
Aryeh Gregor 2012-06-10 15:39:21 +03:00
parent 3fcf9b9977
commit bd2dec6adf
2 changed files with 19 additions and 0 deletions

View File

@ -923,4 +923,10 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContent, NS_ICONTENT_IID)
inline nsIContent* nsINode::AsContent()
{
MOZ_ASSERT(IsContent());
return static_cast<nsIContent*>(this);
}
#endif /* nsIContent_h___ */

View File

@ -374,6 +374,19 @@ public:
*/
mozilla::dom::Element* AsElement();
/**
* Return whether the node is a content node
*/
bool IsContent() const {
return IsNodeOfType(eCONTENT);
}
/**
* Return this node as nsIContent. Should only be used for nodes for which
* IsContent() is true. This is defined inline in nsIContent.h.
*/
nsIContent* AsContent();
virtual nsIDOMNode* AsDOMNode() = 0;
/**