Bug 325288 r=annie.sullivan Closing a container should close its children.

git-svn-id: svn://10.0.0.236/trunk@189323 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brettw%gmail.com
2006-02-07 18:48:38 +00:00
parent bcc99307d9
commit 2cecd985e0
2 changed files with 20 additions and 6 deletions

View File

@@ -361,11 +361,23 @@ nsNavHistoryContainerResultNode::OpenContainer()
// nsNavHistoryContainerResultNode::CloseContainer
//
// Set aUpdateVisible to redraw the screen, this is the normal operation.
// This is set to false for the recursive calls since the root container
// that is being closed will handle recomputation of the visible elements
// for its entire subtree.
nsresult
nsNavHistoryContainerResultNode::CloseContainer()
nsNavHistoryContainerResultNode::CloseContainer(PRBool aUpdateVisible)
{
NS_ASSERTION(mExpanded, "Container must be expanded to close it");
// recursively close all child containers
for (PRInt32 i = 0; i < mChildren.Count(); i ++) {
if (mChildren[i]->IsContainer() && mChildren[i]->GetAsContainer()->mExpanded)
mChildren[i]->GetAsContainer()->CloseContainer(PR_FALSE);
}
mExpanded = PR_FALSE;
nsresult rv;
@@ -376,10 +388,12 @@ nsNavHistoryContainerResultNode::CloseContainer()
remote->OnContainerClosed(this);
}
nsNavHistoryResult* result = GetResult();
NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
rv = result->RefreshVisibleSection(this);
NS_ENSURE_SUCCESS(rv, rv);
if (aUpdateVisible) {
nsNavHistoryResult* result = GetResult();
NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
rv = result->RefreshVisibleSection(this);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}

View File

@@ -398,7 +398,7 @@ public:
// overridded by descendents to populate
virtual nsresult OpenContainer();
nsresult CloseContainer();
nsresult CloseContainer(PRBool aUpdateVisible = PR_TRUE);
// this points to the result that owns this container. All containers have
// their result pointer set so we can quickly get to the result without having