diff --git a/widget/src/windows/nsMenu.cpp b/widget/src/windows/nsMenu.cpp index dee3a67f66f3..e20ce0054c5a 100644 --- a/widget/src/windows/nsMenu.cpp +++ b/widget/src/windows/nsMenu.cpp @@ -558,9 +558,26 @@ nsEventStatus nsMenu::MenuConstruct( if (domElement) domElement->SetAttribute("open", "true"); - // Now get the kids + // Now get the kids. Retrieve our menupopup child. + nsCOMPtr menuPopupNode; + mDOMNode->GetFirstChild(getter_AddRefs(menuPopupNode)); + while (menuPopupNode) { + nsCOMPtr menuPopupElement(do_QueryInterface(menuPopupNode)); + if (menuPopupElement) { + nsString menuPopupNodeType; + menuPopupElement->GetNodeName(menuPopupNodeType); + if (menuPopupNodeType.Equals("menupopup")) + break; + } + nsCOMPtr oldMenuPopupNode(menuPopupNode); + oldMenuPopupNode->GetNextSibling(getter_AddRefs(menuPopupNode)); + } + + if (!menuPopupNode) + return nsEventStatus_eIgnore; + nsCOMPtr menuitemNode; - mDOMNode->GetFirstChild(getter_AddRefs(menuitemNode)); + menuPopupNode->GetFirstChild(getter_AddRefs(menuitemNode)); unsigned short menuIndex = 0;