Eliminate nsIContent::SetDocument/SetParent/SetBindingParent in favor of

BindToTree and UnbindFromTree methods.  Bug 286000, r=sicking, sr=jst
This commit is contained in:
bzbarsky%mit.edu 2005-11-02 07:42:55 +00:00
Родитель 3c37f44c08
Коммит 1814388ddf
3 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -249,7 +249,12 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
return; return;
} }
rootContent->SetDocument(doc, PR_FALSE, PR_TRUE); rv = rootContent->BindToTree(doc, nsnull, nsnull, PR_TRUE);
if (NS_FAILED(rv)) {
NS_ERROR("Failed to bind root to tree");
rootContent->UnbindFromTree();
return rv;
}
doc->SetRootContent(rootContent); doc->SetRootContent(rootContent);

Просмотреть файл

@ -296,12 +296,12 @@ void txMozillaXMLOutput::endElement(const nsAString& aName, const PRInt32 aNsID)
// up the tree // up the tree
// we can't use GetParentNode to check if mCurrentNode is the // we can't use GetParentNode to check if mCurrentNode is the
// "non-added node" since that does strange things when we've called // "non-added node" since that does strange things when we've called
// SetDocument manually // BindToTree manually
if (mCurrentNode == mNonAddedNode) { if (mCurrentNode == mNonAddedNode) {
nsCOMPtr<nsIDocument> document = do_QueryInterface(mNonAddedParent); nsCOMPtr<nsIDocument> document = do_QueryInterface(mNonAddedParent);
if (document && !mRootContent) { if (document && !mRootContent) {
mRootContent = do_QueryInterface(mCurrentNode); mRootContent = do_QueryInterface(mCurrentNode);
mRootContent->SetDocument(document, PR_FALSE, PR_TRUE); mRootContent->BindToTree(document, nsnull, nsnull, PR_TRUE);
document->SetRootContent(mRootContent); document->SetRootContent(mRootContent);
} }
else { else {
@ -455,11 +455,6 @@ void txMozillaXMLOutput::startElement(const nsAString& aName,
ssle->InitStyleLinkElement(nsnull, PR_FALSE); ssle->InitStyleLinkElement(nsnull, PR_FALSE);
ssle->SetEnableUpdates(PR_FALSE); ssle->SetEnableUpdates(PR_FALSE);
} }
nsCOMPtr<nsIContent> cont = do_QueryInterface(element);
NS_ASSERTION(cont, "element doesn't implement nsIContent");
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
cont->SetDocument(doc, PR_FALSE, PR_TRUE);
} }
mParentNode = mCurrentNode; mParentNode = mCurrentNode;
mCurrentNode = do_QueryInterface(element); mCurrentNode = do_QueryInterface(element);
@ -498,7 +493,7 @@ void txMozillaXMLOutput::closePrevious(PRInt8 aAction)
mParentNode = wrapper; mParentNode = wrapper;
mRootContent = do_QueryInterface(wrapper); mRootContent = do_QueryInterface(wrapper);
mRootContent->SetDocument(document, PR_FALSE, PR_TRUE); mRootContent->BindToTree(document, nsnull, nsnull, PR_TRUE);
document->SetRootContent(mRootContent); document->SetRootContent(mRootContent);
} }
@ -509,7 +504,7 @@ void txMozillaXMLOutput::closePrevious(PRInt8 aAction)
else { else {
if (document && currentElement && !mRootContent) { if (document && currentElement && !mRootContent) {
mRootContent = do_QueryInterface(mCurrentNode); mRootContent = do_QueryInterface(mCurrentNode);
mRootContent->SetDocument(document, PR_FALSE, PR_TRUE); mRootContent->BindToTree(document, nsnull, nsnull, PR_TRUE);
document->SetRootContent(mRootContent); document->SetRootContent(mRootContent);
} }
else { else {

Просмотреть файл

@ -712,7 +712,7 @@ txMozillaXSLTProcessor::notifyError()
return; return;
} }
rootContent->SetDocument(document, PR_FALSE, PR_TRUE); rootContent->BindToTree(document, nsnull, nsnull, PR_TRUE);
document->SetRootContent(rootContent); document->SetRootContent(rootContent);
nsCOMPtr<nsIDOMText> text; nsCOMPtr<nsIDOMText> text;