mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 508927. In list box body frame don't return a frame for an item that is not in its child list, and don't destory a frame if it is not in the childlist. r=bzbarsky
This commit is contained in:
parent
8204627bef
commit
a468df22eb
@ -1228,6 +1228,9 @@ nsListBoxBodyFrame::GetNextItemBox(nsIBox* aBox, PRInt32 aOffset,
|
||||
nsIFrame* existingFrame =
|
||||
presContext->GetPresShell()->GetPrimaryFrameFor(nextContent);
|
||||
|
||||
if (existingFrame && existingFrame->GetParent() != this)
|
||||
return GetNextItemBox(aBox, ++aOffset, aCreated);
|
||||
|
||||
if (!existingFrame) {
|
||||
// Either append the new frame, or insert it after the current frame
|
||||
PRBool isAppend = result != mLinkupFrame && mRowsToPrepend <= 0;
|
||||
@ -1506,6 +1509,11 @@ void
|
||||
nsListBoxBodyFrame::RemoveChildFrame(nsBoxLayoutState &aState,
|
||||
nsIFrame *aFrame)
|
||||
{
|
||||
if (!mFrames.ContainsFrame(aFrame)) {
|
||||
NS_ERROR("tried to remove a child frame which isn't our child");
|
||||
return;
|
||||
}
|
||||
|
||||
if (aFrame == GetContentInsertionFrame()) {
|
||||
// Don't touch that one
|
||||
return;
|
||||
@ -1515,12 +1523,7 @@ nsListBoxBodyFrame::RemoveChildFrame(nsBoxLayoutState &aState,
|
||||
nsCSSFrameConstructor* fc = presContext->PresShell()->FrameConstructor();
|
||||
fc->RemoveMappingsForFrameSubtree(aFrame);
|
||||
|
||||
#ifdef DEBUG
|
||||
PRBool removed =
|
||||
#endif
|
||||
mFrames.RemoveFrame(aFrame);
|
||||
NS_ASSERTION(removed,
|
||||
"Going to destroy a frame we didn't remove. Prepare to crash");
|
||||
mFrames.RemoveFrame(aFrame);
|
||||
if (mLayoutManager)
|
||||
mLayoutManager->ChildrenRemoved(this, aState, aFrame);
|
||||
aFrame->Destroy();
|
||||
|
Loading…
Reference in New Issue
Block a user