Bug 764400 - Move various nsIContent methods to nsINode; r=mounir

This commit is contained in:
Aryeh Gregor 2012-06-14 09:47:03 +03:00
parent aa8b0b1f6b
commit 67f9002049
2 changed files with 69 additions and 59 deletions

View File

@ -250,65 +250,6 @@ public:
return OwnerDoc()->IsHTML();
}
/**
* Get the namespace that this element's tag is defined in
* @return the namespace
*/
PRInt32 GetNameSpaceID() const
{
return mNodeInfo->NamespaceID();
}
/**
* Get the tag for this element. This will always return a non-null
* atom pointer (as implied by the naming of the method).
*/
nsIAtom *Tag() const
{
return mNodeInfo->NameAtom();
}
/**
* Get the NodeInfo for this element
* @return the nodes node info
*/
nsINodeInfo *NodeInfo() const
{
return mNodeInfo;
}
inline bool IsInNamespace(PRInt32 aNamespace) const {
return mNodeInfo->NamespaceID() == aNamespace;
}
inline bool IsHTML() const {
return IsInNamespace(kNameSpaceID_XHTML);
}
inline bool IsHTML(nsIAtom* aTag) const {
return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
}
inline bool IsSVG() const {
return IsInNamespace(kNameSpaceID_SVG);
}
inline bool IsSVG(nsIAtom* aTag) const {
return mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
}
inline bool IsXUL() const {
return IsInNamespace(kNameSpaceID_XUL);
}
inline bool IsMathML() const {
return IsInNamespace(kNameSpaceID_MathML);
}
inline bool IsMathML(nsIAtom* aTag) const {
return mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
}
/**
* Returns an atom holding the name of the attribute of type ID on
* this content node (if applicable). Returns null for non-element

View File

@ -476,6 +476,75 @@ public:
return mNodeInfo->LocalName();
}
/**
* Get the namespace that this element's tag is defined in
* @return the namespace
*/
PRInt32 GetNameSpaceID() const
{
return mNodeInfo->NamespaceID();
}
/**
* Get the tag for this element. This will always return a non-null atom
* pointer (as implied by the naming of the method). For elements this is
* the non-namespaced tag, and for other nodes it's something like "#text",
* "#comment", "#document", etc.
*/
nsIAtom* Tag() const
{
return mNodeInfo->NameAtom();
}
/**
* Get the NodeInfo for this element
* @return the nodes node info
*/
nsINodeInfo* NodeInfo() const
{
return mNodeInfo;
}
bool IsInNamespace(PRInt32 aNamespace) const
{
return mNodeInfo->NamespaceID() == aNamespace;
}
bool IsHTML() const
{
return IsInNamespace(kNameSpaceID_XHTML);
}
bool IsHTML(nsIAtom* aTag) const
{
return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
}
bool IsSVG() const
{
return IsInNamespace(kNameSpaceID_SVG);
}
bool IsSVG(nsIAtom* aTag) const
{
return mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
}
bool IsXUL() const
{
return IsInNamespace(kNameSpaceID_XUL);
}
bool IsMathML() const
{
return IsInNamespace(kNameSpaceID_MathML);
}
bool IsMathML(nsIAtom* aTag) const
{
return mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
}
nsINode*
InsertBefore(nsINode *aNewChild, nsINode *aRefChild, nsresult *aReturn)
{