diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index ead30bb7956..e673a2cce2b 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -16,7 +16,7 @@ * Reserved. */ - +#include "nsXULAtoms.h" #include "nsMenuFrame.h" #include "nsAreaFrame.h" #include "nsIContent.h" @@ -81,6 +81,26 @@ nsMenuFrame::SetInitialChildList(nsIPresContext& aPresContext, if (nsLayoutAtoms::popupList == aListName) { mPopupFrames.SetFrames(aChildList); } else { + + nsFrameList frames(aChildList); + + // We may have an xpmenuchildren in here. Get it out, and move it into + // the popup frame list. + nsIFrame* frame = frames.FirstChild(); + while (frame) { + nsCOMPtr content; + frame->GetContent(getter_AddRefs(content)); + nsCOMPtr tag; + content->GetTag(*getter_AddRefs(tag)); + if (tag.get() == nsXULAtoms::xpmenuchildren) { + // Remove this frame from the list and place it in the other list. + frames.RemoveFrame(frame); + mPopupFrames.AppendFrame(this, frame); + rv = nsAreaFrame::SetInitialChildList(aPresContext, aListName, aChildList); + return rv; + } + frame->GetNextSibling(&frame); + } rv = nsAreaFrame::SetInitialChildList(aPresContext, aListName, aChildList); } return rv; @@ -120,4 +140,4 @@ nsMenuFrame::GetFrameForPoint(const nsPoint& aPoint, { *aFrame = this; // Capture all events so that we can perform selection return NS_OK; -} \ No newline at end of file +} diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index 2423c1bf802..1e1c3275b66 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -69,7 +69,7 @@ nsMenuPopupFrame::Init(nsIPresContext& aPresContext, aContext, PR_FALSE, getter_AddRefs(menuStyle)); - rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, menuStyle, aPrevInFlow); + rv = nsBoxFrame::Init(aPresContext, aContent, aParent, menuStyle, aPrevInFlow); CreateViewForFrame(aPresContext, this, menuStyle, PR_TRUE); return rv; }