If a sort isn't initially imposed, just append new nodes onto end of container's child list.

This commit is contained in:
rjc%netscape.com 1999-04-20 22:14:38 +00:00
Родитель 5ef183af6c
Коммит d51ded93c9
2 изменённых файлов: 90 добавлений и 86 удалений

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

@ -985,7 +985,9 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
sortInfo.kTreeCellAtom = kTreeCellAtom;
sortInfo.kNameSpaceID_XUL = kNameSpaceID_XUL;
if (NS_FAILED(rv = GetSortColumnInfo(treeNode, sortResource, sortDirection))) return(rv);
PRBool childAdded = PR_FALSE;
if (NS_SUCCEEDED(rv = GetSortColumnInfo(treeNode, sortResource, sortDirection)))
{
char *uri = sortResource.ToNewCString();
if (uri)
{
@ -1007,12 +1009,11 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
sortInfo.descendingSort = PR_TRUE;
else
sortInfo.descendingSort = PR_FALSE;
// crap
// figure out where to insert the node when a sort order is being imposed
PRInt32 childIndex = 0, numChildren = 0, nameSpaceID;
nsCOMPtr<nsIContent> child;
nsresult rv;
PRBool childAdded = PR_FALSE;
if (NS_FAILED(rv = container->ChildCount(numChildren))) return(rv);
for (childIndex=0; childIndex<numChildren; childIndex++)
@ -1031,11 +1032,12 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
}
}
}
}
}
if (childAdded == PR_FALSE)
{
container->AppendChildTo(node, PR_TRUE);
}
}
return(NS_OK);
}

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

@ -985,7 +985,9 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
sortInfo.kTreeCellAtom = kTreeCellAtom;
sortInfo.kNameSpaceID_XUL = kNameSpaceID_XUL;
if (NS_FAILED(rv = GetSortColumnInfo(treeNode, sortResource, sortDirection))) return(rv);
PRBool childAdded = PR_FALSE;
if (NS_SUCCEEDED(rv = GetSortColumnInfo(treeNode, sortResource, sortDirection)))
{
char *uri = sortResource.ToNewCString();
if (uri)
{
@ -1007,12 +1009,11 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
sortInfo.descendingSort = PR_TRUE;
else
sortInfo.descendingSort = PR_FALSE;
// crap
// figure out where to insert the node when a sort order is being imposed
PRInt32 childIndex = 0, numChildren = 0, nameSpaceID;
nsCOMPtr<nsIContent> child;
nsresult rv;
PRBool childAdded = PR_FALSE;
if (NS_FAILED(rv = container->ChildCount(numChildren))) return(rv);
for (childIndex=0; childIndex<numChildren; childIndex++)
@ -1031,11 +1032,12 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
}
}
}
}
}
if (childAdded == PR_FALSE)
{
container->AppendChildTo(node, PR_TRUE);
}
}
return(NS_OK);
}