doc->ContentReplaced(this, oldKid, aKid, aIndex);
doc->ContentReplaced(NS_STATIC_CAST(nsIStyledContent*, this), oldKid, aKid, aIndex);
RDFElementImpl::ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify){    nsresult rv;    if (NS_FAILED(rv = EnsureContentsGenerated()))        return rv;    NS_PRECONDITION(nsnull != mChildren, "illegal value");    if (! mChildren)        return NS_ERROR_ILLEGAL_VALUE;    NS_PRECONDITION(nsnull != aKid, "null ptr");    if (! aKid)        return NS_ERROR_NULL_POINTER;    nsIContent* oldKid = (nsIContent *)mChildren->ElementAt(aIndex);    PRBool replaceOk = mChildren->ReplaceElementAt(aKid, aIndex);    if (replaceOk) {        NS_ADDREF(aKid);        aKid->SetParent(this);        //nsRange::OwnerChildReplaced(this, aIndex, oldKid);        nsIDocument* doc = mDocument;        if (nsnull != doc) {            aKid->SetDocument(doc, PR_TRUE);            if (aNotify) {                doc->ContentReplaced(this, oldKid, aKid, aIndex);            }        }        oldKid->SetDocument(nsnull, PR_TRUE);        oldKid->SetParent(nsnull);        NS_RELEASE(oldKid);    }    return NS_OK;}