Bug 1316597 Prevent immediate opening and closing of select dropdowns when anchored on selection r=jaws
MozReview-Commit-ID: CkKTh2j2vZF
--- a/layout/xul/nsMenuFrame.cpp
+++ b/layout/xul/nsMenuFrame.cpp
@@ -544,16 +544,18 @@ nsMenuFrame::ToggleMenuState()
CloseMenu(false);
else
OpenMenu(false);
}
void
nsMenuFrame::PopupOpened()
{
+ gMenuJustOpenedOrClosed = true;
+
nsWeakFrame weakFrame(this);
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::open,
NS_LITERAL_STRING("true"), true);
if (!weakFrame.IsAlive())
return;
nsMenuParent* menuParent = GetMenuParent();
if (menuParent) {
@@ -703,18 +705,16 @@ nsMenuFrame::GetAnchor()
}
void
nsMenuFrame::OpenMenu(bool aSelectFirstItem)
{
if (!mContent)
return;
- gMenuJustOpenedOrClosed = true;
-
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm) {
pm->KillMenuTimer();
// This opens the menu asynchronously
pm->ShowMenu(mContent, aSelectFirstItem, true);
}
}