Backing out bug 377035 because it caches the tree body inappropriately

git-svn-id: svn://10.0.0.236/trunk@226206 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
neil%parkwaycc.co.uk 2007-05-09 20:13:26 +00:00
parent fadd38fb54
commit 7e886e1d93
2 changed files with 16 additions and 16 deletions

View File

@ -556,9 +556,9 @@ nsTreeContentView::SetTree(nsITreeBoxObject* aTree)
nsCOMPtr<nsIDOMElement> bodyElement;
mBoxObject->GetTreeBody(getter_AddRefs(bodyElement));
if (bodyElement) {
mBody = do_QueryInterface(bodyElement);
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(bodyElement);
PRInt32 index = 0;
Serialize(mBody, -1, &index, mRows);
Serialize(bodyContent, -1, &index, mRows);
}
}
@ -818,16 +818,18 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument,
return;
}
// If we have a legal tag, go up to the tree/select and make sure
// that it's ours.
// If we have a legal tag, go up to the tree and make sure that it's ours.
nsCOMPtr<nsIContent> parent = aContent;
nsINodeInfo *ni = nsnull;
do {
parent = parent->GetParent();
if (parent)
ni = parent->NodeInfo();
} while (parent && !ni->Equals(nsGkAtoms::tree, kNameSpaceID_XUL));
for (nsIContent* element = aContent; element != mBody; element = element->GetParent()) {
if (!element)
return; // this is not for us
nsIAtom *parentTag = element->Tag();
if ((element->IsNodeOfType(nsINode::eXUL) && parentTag == nsGkAtoms::tree) ||
(element->IsNodeOfType(nsINode::eHTML) && parentTag == nsGkAtoms::select))
return; // this is not for us
if (parent != mRoot) {
// This is not for us, we can bail out.
return;
}
// Handle changes of the hidden attribute.
@ -987,7 +989,7 @@ nsTreeContentView::ContentInserted(nsIDocument *aDocument,
// If we have a legal tag, go up to the tree/select and make sure
// that it's ours.
for (nsIContent* element = aContainer; element != mBody; element = element->GetParent()) {
for (nsIContent* element = aContainer; element != mRoot; element = element->GetParent()) {
if (!element)
return; // this is not for us
nsIAtom *parentTag = element->Tag();
@ -1070,11 +1072,11 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
// If we have a legal tag, go up to the tree/select and make sure
// that it's ours.
for (nsIContent* element = aContainer; element != mBody; element = element->GetParent()) {
for (nsIContent* element = aContainer; element != mRoot; element = element->GetParent()) {
if (!element)
return; // this is not for us
nsIAtom *parentTag = element->Tag();
if ((element->IsNodeOfType(nsINode::eXUL) && parentTag == nsGkAtoms::tree) ||
if ((element->IsNodeOfType(nsINode::eXUL) && parentTag == nsGkAtoms::tree) ||
(element->IsNodeOfType(nsINode::eHTML) && parentTag == nsGkAtoms::select))
return; // this is not for us
}
@ -1437,7 +1439,6 @@ nsTreeContentView::ClearRows()
Row::Destroy(mAllocator, (Row*)mRows[i]);
mRows.Clear();
mRoot = nsnull;
mBody = nsnull;
// Remove ourselves from mDocument's observers.
if (mDocument) {
mDocument->RemoveObserver(this);

View File

@ -132,7 +132,6 @@ class nsTreeContentView : public nsINativeTreeView,
nsCOMPtr<nsITreeBoxObject> mBoxObject;
nsCOMPtr<nsITreeSelection> mSelection;
nsCOMPtr<nsIContent> mRoot;
nsCOMPtr<nsIContent> mBody;
nsIDocument* mDocument; // WEAK
nsFixedSizeAllocator mAllocator;
nsVoidArray mRows;