nsXULElement::QueryInterface(REFNSIID iid, void** result) { if (! result) return NS_ERROR_NULL_POINTER;  nsresult rv;  if (iid.Equals(NS_GET_IID(nsIStyledContent)) || iid.Equals(kIContentIID) || iid.Equals(kISupportsIID)) { *result = NS_STATIC_CAST(nsIStyledContent*, this);
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aResult) { return mOuter->QueryInterface(aIID, aResult);
nsXULElement::QueryInterface(REFNSIID iid, void** result){    if (! result)        return NS_ERROR_NULL_POINTER;    nsresult rv;    if (iid.Equals(NS_GET_IID(nsIStyledContent)) ||        iid.Equals(kIContentIID) ||        iid.Equals(kISupportsIID)) {        *result = NS_STATIC_CAST(nsIStyledContent*, this);    }    else if (iid.Equals(NS_GET_IID(nsIXMLContent))) {        *result = NS_STATIC_CAST(nsIXMLContent*, this);    }    else if (iid.Equals(NS_GET_IID(nsIXULContent))) {        *result = NS_STATIC_CAST(nsIXULContent*, this);    }    else if (iid.Equals(NS_GET_IID(nsIDOMXULElement)) ||             iid.Equals(kIDOMElementIID) ||             iid.Equals(kIDOMNodeIID)) {        *result = NS_STATIC_CAST(nsIDOMElement*, this);    }    else if (iid.Equals(kIScriptObjectOwnerIID)) {        *result = NS_STATIC_CAST(nsIScriptObjectOwner*, this);    }    else if (iid.Equals(NS_GET_IID(nsIScriptEventHandlerOwner))) {        *result = NS_STATIC_CAST(nsIScriptEventHandlerOwner*, this);    }    else if (iid.Equals(kIDOMEventReceiverIID)) {        *result = NS_STATIC_CAST(nsIDOMEventReceiver*, this);    }    else if (iid.Equals(kIDOMEventTargetIID)) {        *result = NS_STATIC_CAST(nsIDOMEventTarget*, this);    }    else if (iid.Equals(kIJSScriptObjectIID)) {        *result = NS_STATIC_CAST(nsIJSScriptObject*, this);    }    else if (iid.Equals(NS_GET_IID(nsIFocusableContent)) &&             (NameSpaceID() == kNameSpaceID_XUL) &&             IsFocusableContent()) {        *result = NS_STATIC_CAST(nsIFocusableContent*, this);    }    else if (iid.Equals(NS_GET_IID(nsIBindableContent))) {        *result = NS_STATIC_CAST(nsIBindableContent*, this);    }    else if (iid.Equals(NS_GET_IID(nsIStyleRule))) {        *result = NS_STATIC_CAST(nsIStyleRule*, this);    }    else if (iid.Equals(NS_GET_IID(nsIChromeEventHandler))) {        *result = NS_STATIC_CAST(nsIChromeEventHandler*, this);    }    else if ((iid.Equals(NS_GET_IID(nsIDOMXULPopupElement))) &&             (NameSpaceID() == kNameSpaceID_XUL) &&             ((Tag() == kPopupAtom) || (Tag() == kMenuPopupAtom))) {        // We delegate XULPopupElement APIs to an aggregate object        if (! InnerXULElement()) {            rv = EnsureSlots();            if (NS_FAILED(rv)) return rv;            if ((mSlots->mInnerXULElement = new nsXULPopupElement(this)) == nsnull)                return NS_ERROR_OUT_OF_MEMORY;        }        return InnerXULElement()->QueryInterface(iid, result);    }    else if ((iid.Equals(NS_GET_IID(nsIDOMXULTreeElement)) ||              iid.Equals(NS_GET_IID(nsIXULTreeContent))) &&             (NameSpaceID() == kNameSpaceID_XUL) &&             (Tag() == kTreeAtom)) {        // We delegate XULTreeElement APIs to an aggregate object        if (! InnerXULElement()) {            rv = EnsureSlots();            if (NS_FAILED(rv)) return rv;            if ((mSlots->mInnerXULElement = new nsXULTreeElement(this)) == nsnull)                return NS_ERROR_OUT_OF_MEMORY;        }        return InnerXULElement()->QueryInterface(iid, result);    }    else if (iid.Equals(NS_GET_IID(nsIDOMXULIFrameElement)) &&             (NameSpaceID() == kNameSpaceID_XUL) &&             (Tag() == kIFrameAtom)) {        // We delegate XULIFrameElement APIs to an aggregate object        if (! InnerXULElement()) {            rv = EnsureSlots();            if (NS_FAILED(rv)) return rv;            if ((mSlots->mInnerXULElement = new nsXULIFrameElement(this)) == nsnull)                return NS_ERROR_OUT_OF_MEMORY;        }        return InnerXULElement()->QueryInterface(iid, result);    }    else if (iid.Equals(NS_GET_IID(nsIDOMXULBrowserElement)) &&             (NameSpaceID() == kNameSpaceID_XUL) &&             (Tag() == kBrowserAtom)) {        // We delegate XULBrowserElement APIs to an aggregate object        if (! InnerXULElement()) {            rv = EnsureSlots();            if (NS_FAILED(rv)) return rv;            if ((mSlots->mInnerXULElement = new nsXULBrowserElement(this)) == nsnull)                return NS_ERROR_OUT_OF_MEMORY;        }        return InnerXULElement()->QueryInterface(iid, result);    }    else if (iid.Equals(NS_GET_IID(nsIDOMXULEditorElement)) &&             (NameSpaceID() == kNameSpaceID_XUL) &&             (Tag() == kEditorAtom)) {        // We delegate XULEditorElement APIs to an aggregate object        if (! InnerXULElement()) {            rv = EnsureSlots();            if (NS_FAILED(rv)) return rv;            if ((mSlots->mInnerXULElement = new nsXULEditorElement(this)) == nsnull)                return NS_ERROR_OUT_OF_MEMORY;        }        return InnerXULElement()->QueryInterface(iid, result);    }    else {        *result = nsnull;        return NS_NOINTERFACE;    }    // if we get here, we know one of the above IIDs was ok.    NS_ADDREF(this);    return NS_OK;}