diff --git a/mozilla/browser/components/places/src/nsNavHistoryResult.cpp b/mozilla/browser/components/places/src/nsNavHistoryResult.cpp index 8520c4d0c46..2c3d6304e31 100755 --- a/mozilla/browser/components/places/src/nsNavHistoryResult.cpp +++ b/mozilla/browser/components/places/src/nsNavHistoryResult.cpp @@ -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; } diff --git a/mozilla/browser/components/places/src/nsNavHistoryResult.h b/mozilla/browser/components/places/src/nsNavHistoryResult.h index 4fdd7dcb2f9..3cb35f50914 100644 --- a/mozilla/browser/components/places/src/nsNavHistoryResult.h +++ b/mozilla/browser/components/places/src/nsNavHistoryResult.h @@ -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