Fix for bug 9503.

This commit is contained in:
hyatt%netscape.com 1999-07-10 00:51:35 +00:00
parent dc793ce800
commit 6830e1839d
5 changed files with 60 additions and 5 deletions

View File

@ -4601,6 +4601,22 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
shell->GetPrimaryFrameFor(aChild, &childFrame);
if (childFrame) {
#ifdef INCLUDE_XUL
nsCOMPtr<nsIAtom> tag;
aContainer->GetTag(*getter_AddRefs(tag));
if (tag.get() == nsXULAtoms::treechildren ||
tag.get() == nsXULAtoms::treeitem) {
// Convert to a tree row group frame.
nsIFrame* parentFrame;
childFrame->GetParent(&parentFrame);
nsTreeRowGroupFrame* treeRowGroup = (nsTreeRowGroupFrame*)parentFrame;
if (treeRowGroup && treeRowGroup->IsLazy()) {
treeRowGroup->OnContentRemoved(*aPresContext, childFrame);
}
}
#endif // INCLUDE_XUL
// Walk the frame subtree deleting any out-of-flow frames, and
// remove the mapping from content objects to frames
DeletingFrameSubtree(aPresContext, shell, childFrame, childFrame);

View File

@ -4601,6 +4601,22 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
shell->GetPrimaryFrameFor(aChild, &childFrame);
if (childFrame) {
#ifdef INCLUDE_XUL
nsCOMPtr<nsIAtom> tag;
aContainer->GetTag(*getter_AddRefs(tag));
if (tag.get() == nsXULAtoms::treechildren ||
tag.get() == nsXULAtoms::treeitem) {
// Convert to a tree row group frame.
nsIFrame* parentFrame;
childFrame->GetParent(&parentFrame);
nsTreeRowGroupFrame* treeRowGroup = (nsTreeRowGroupFrame*)parentFrame;
if (treeRowGroup && treeRowGroup->IsLazy()) {
treeRowGroup->OnContentRemoved(*aPresContext, childFrame);
}
}
#endif // INCLUDE_XUL
// Walk the frame subtree deleting any out-of-flow frames, and
// remove the mapping from content objects to frames
DeletingFrameSubtree(aPresContext, shell, childFrame, childFrame);

View File

@ -55,11 +55,19 @@ nsTreeFrame::~nsTreeFrame()
{
}
void nsTreeFrame::SetSelection(nsIPresContext& aPresContext, nsTreeCellFrame* pFrame)
void nsTreeFrame::SetSelection(nsIPresContext& aPresContext, nsTreeCellFrame* aFrame)
{
PRInt32 count = mSelectedItems.Count();
if (count == 1) {
// See if we're already selected.
nsTreeCellFrame* frame = (nsTreeCellFrame*)mSelectedItems[0];
if (frame == aFrame)
return;
}
ClearSelection(aPresContext);
mSelectedItems.AppendElement(pFrame);
pFrame->Select(aPresContext, PR_TRUE);
mSelectedItems.AppendElement(aFrame);
aFrame->Select(aPresContext, PR_TRUE);
FireChangeHandler(aPresContext);
}

View File

@ -923,11 +923,17 @@ PRBool nsTreeRowGroupFrame::ContinueReflow(nsIPresContext& aPresContext, nscoord
if (height <= 0 && IsLazy()) {
mIsFull = PR_TRUE;
nsIFrame* lastChild = GetLastFrame();
if (lastChild != mBottomFrame) {
nsIFrame* startingPoint = mBottomFrame;
if (startingPoint == nsnull) {
// We just want to delete everything but the first item.
startingPoint = GetFirstFrame();
}
if (lastChild != startingPoint) {
// We have some hangers on (probably caused by shrinking the size of the window).
// Nuke them.
nsIFrame* currFrame;
mBottomFrame->GetNextSibling(&currFrame);
startingPoint->GetNextSibling(&currFrame);
while (currFrame) {
nsIFrame* nextFrame;
currFrame->GetNextSibling(&nextFrame);
@ -966,6 +972,14 @@ void nsTreeRowGroupFrame::OnContentAdded(nsIPresContext& aPresContext)
}
}
void nsTreeRowGroupFrame::OnContentRemoved(nsIPresContext& aPresContext,
nsIFrame* aChildFrame)
{
// We need to make sure we update things when content gets removed.
// Clear out our top and bottom frames.
mTopFrame = mBottomFrame = nsnull;
}
void nsTreeRowGroupFrame::SetContentChain(nsISupportsArray* aContentChain)
{
NS_IF_RELEASE(mContentChain);

View File

@ -60,6 +60,7 @@ public:
// Responses to changes
void OnContentAdded(nsIPresContext& aPresContext);
void OnContentRemoved(nsIPresContext& aPresContext, nsIFrame* aChildFrame);
virtual nsIFrame* GetFirstFrame();
virtual nsIFrame* GetLastFrame();