Reoving unnecessary casts and giving this code some more nsCOMPtr love. r=bryner@netscape.com, sr=me

This commit is contained in:
jst%netscape.com 2001-09-11 03:35:30 +00:00
parent 34984743e0
commit 6f2d4f378d

View File

@ -1604,8 +1604,7 @@ nsGenericHTMLElement::SetAttr(nsINodeInfo* aNodeInfo,
// We still rely on the old way of setting the attribute. // We still rely on the old way of setting the attribute.
return NS_STATIC_CAST(nsIContent *, this)->SetAttr(nsid, atom, aValue, return SetAttr(nsid, atom, aValue, aNotify);
aNotify);
} }
PRBool nsGenericHTMLElement::IsEventName(nsIAtom* aName) PRBool nsGenericHTMLElement::IsEventName(nsIAtom* aName)
@ -3569,11 +3568,10 @@ nsGenericHTMLContainerElement::CopyInnerTo(nsIContent* aSrcContent,
nsGenericHTMLContainerElement* aDst, nsGenericHTMLContainerElement* aDst,
PRBool aDeep) PRBool aDeep)
{ {
nsresult result = nsGenericHTMLElement::CopyInnerTo(aSrcContent, nsresult rv = nsGenericHTMLElement::CopyInnerTo(aSrcContent, aDst, aDeep);
aDst,
aDeep); if (NS_FAILED(rv)) {
if (NS_FAILED(result)) { return rv;
return result;
} }
if (aDeep) { if (aDeep) {
@ -3581,29 +3579,24 @@ nsGenericHTMLContainerElement::CopyInnerTo(nsIContent* aSrcContent,
PRInt32 count = mChildren.Count(); PRInt32 count = mChildren.Count();
for (index = 0; index < count; index++) { for (index = 0; index < count; index++) {
nsIContent* child = (nsIContent*)mChildren.ElementAt(index); nsIContent* child = (nsIContent*)mChildren.ElementAt(index);
if (nsnull != child) {
nsIDOMNode* node;
result = child->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
if (NS_OK == result) {
nsIDOMNode* newNode;
result = node->CloneNode(aDeep, &newNode); nsCOMPtr<nsIDOMNode> node(do_QueryInterface(child));
if (NS_OK == result) {
nsIContent* newContent;
result = newNode->QueryInterface(NS_GET_IID(nsIContent), (void**)&newContent); if (node) {
if (NS_OK == result) { nsCOMPtr<nsIDOMNode> newNode;
result = aDst->AppendChildTo(newContent, PR_FALSE, PR_FALSE);
NS_RELEASE(newContent); rv = node->CloneNode(aDeep, getter_AddRefs(newNode));
if (node) {
nsCOMPtr<nsIContent> newContent(do_QueryInterface(newNode));
if (newContent) {
rv = aDst->AppendChildTo(newContent, PR_FALSE, PR_FALSE);
} }
NS_RELEASE(newNode);
} }
NS_RELEASE(node);
} }
if (NS_OK != result) { if (NS_FAILED(rv)) {
return result; return rv;
}
} }
} }
} }