mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-15 03:00:30 +00:00
Fix for bug 9503.
This commit is contained in:
parent
dc793ce800
commit
6830e1839d
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
|
||||
// Responses to changes
|
||||
void OnContentAdded(nsIPresContext& aPresContext);
|
||||
void OnContentRemoved(nsIPresContext& aPresContext, nsIFrame* aChildFrame);
|
||||
|
||||
virtual nsIFrame* GetFirstFrame();
|
||||
virtual nsIFrame* GetLastFrame();
|
||||
|
Loading…
Reference in New Issue
Block a user