From 733990645b49763f3f8aed92b094c96cbcae0a10 Mon Sep 17 00:00:00 2001 From: "mats.palmgren%bredband.net" Date: Sat, 20 Oct 2007 05:43:39 +0000 Subject: [PATCH] Discard aPrevFrame if it's the mPopupFrame since it's on a different lists. b=394800 r=enndeakin sr=bzbarsky a=dbaron --- layout/xul/base/src/nsBoxFrame.cpp | 2 ++ layout/xul/base/src/nsMenuFrame.cpp | 3 +++ layout/xul/test/Makefile.in | 1 + layout/xul/test/test_bug394800.xhtml | 40 ++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 layout/xul/test/test_bug394800.xhtml diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index da68a17ae7c..56ada6a4345 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -1032,6 +1032,8 @@ nsBoxFrame::InsertFrames(nsIAtom* aListName, { NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this, "inserting after sibling frame with different parent"); + NS_ASSERTION(!aPrevFrame || mFrames.ContainsFrame(aPrevFrame), + "inserting after sibling frame not in our child list"); NS_PRECONDITION(!aListName, "We don't support out-of-flow kids"); nsBoxLayoutState state(PresContext()); diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index d5745a99e0e..aa8353f0708 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -1198,6 +1198,9 @@ nsMenuFrame::InsertFrames(nsIAtom* aListName, NS_FRAME_HAS_DIRTY_CHILDREN); rv = NS_OK; } else { + if (NS_UNLIKELY(aPrevFrame == mPopupFrame)) { + aPrevFrame = nsnull; + } rv = nsBoxFrame::InsertFrames(aListName, aPrevFrame, aFrameList); } diff --git a/layout/xul/test/Makefile.in b/layout/xul/test/Makefile.in index 0120a8a5428..cfc581682d7 100644 --- a/layout/xul/test/Makefile.in +++ b/layout/xul/test/Makefile.in @@ -45,6 +45,7 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk _TEST_FILES = test_bug372685.xul \ + test_bug394800.xhtml \ $(NULL) libs:: $(_TEST_FILES) diff --git a/layout/xul/test/test_bug394800.xhtml b/layout/xul/test/test_bug394800.xhtml new file mode 100644 index 00000000000..61f56b4eb0a --- /dev/null +++ b/layout/xul/test/test_bug394800.xhtml @@ -0,0 +1,40 @@ + + + + Test Mozilla bug 394800 + + + + + + + + +
+ +Mozilla Bug 394800 +

+ +
+
+ + + + +