Skip to content

Commit

Permalink
Backed out changeset f9a25f51a254 (bug 1811487) for causing bc failur…
Browse files Browse the repository at this point in the history
…es related to PanelMultiView. CLOSED TREE
  • Loading branch information
Iulian Moraru committed Jan 23, 2023
1 parent a5a20b0 commit bca5dd3
Show file tree
Hide file tree
Showing 19 changed files with 195 additions and 221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,14 @@ add_task(async function testTabOpenMenulist() {
await shown;
ok(gMainMenulist.open, "menulist open");
let menuHidden = BrowserTestUtils.waitForEvent(popup, "popuphidden");
let panelHidden = BrowserTestUtils.waitForEvent(gPanel, "popuphidden");
EventUtils.synthesizeKey("KEY_Tab");
await menuHidden;
ok(!gMainMenulist.open, "menulist closed after Tab");

is(gPanel.state, "open", "Panel should be open");
await hidePopup();
// Tab in an open menulist closes the menulist, but also dismisses the panel
// above it (bug 1566673). So, we just wait for the panel to hide rather than
// using hidePopup().
await panelHidden;
});

if (AppConstants.platform == "macosx") {
Expand Down
12 changes: 4 additions & 8 deletions dom/xul/XULButtonElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ void XULButtonElement::HandleEnterKeyPress(WidgetEvent& aEvent) {
#ifdef XP_WIN
if (XULPopupElement* popup = GetContainingPopupElement()) {
if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
pm->HidePopup(
popup, {HidePopupOption::HideChain, HidePopupOption::DeselectMenu,
HidePopupOption::Async});
pm->HidePopup(popup, /* aHideChain = */ true,
/* aDeselectMenu = */ true, /* aAsynchronous = */ true,
/* aIsCancel = */ false);
}
}
#endif
Expand Down Expand Up @@ -211,11 +211,7 @@ void XULButtonElement::CloseMenuPopup(bool aDeselectMenu) {
return;
}
if (auto* popup = GetMenuPopupContent()) {
HidePopupOptions options{HidePopupOption::Async};
if (aDeselectMenu) {
options += HidePopupOption::DeselectMenu;
}
pm->HidePopup(popup, options);
pm->HidePopup(popup, false, aDeselectMenu, true, false);
}
}

Expand Down
9 changes: 2 additions & 7 deletions dom/xul/XULPopupElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,9 @@ void XULPopupElement::OpenPopupAtScreenRect(const nsAString& aPosition,

void XULPopupElement::HidePopup(bool aCancel) {
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (!pm) {
return;
}
HidePopupOptions options{HidePopupOption::DeselectMenu};
if (aCancel) {
options += HidePopupOption::IsRollup;
if (pm) {
pm->HidePopup(this, false, true, false, aCancel);
}
pm->HidePopup(this, options);
}

static Modifiers ConvertModifiers(const ActivateMenuItemOptions& aModifiers) {
Expand Down
4 changes: 1 addition & 3 deletions dom/xul/nsXULPopupListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ void nsXULPopupListener::ClosePopup() {
// popup is hidden. Use asynchronous hiding just to be safe so we don't
// fire events during destruction.
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm)
pm->HidePopup(mPopupContent,
{HidePopupOption::DeselectMenu, HidePopupOption::Async});
if (pm) pm->HidePopup(mPopupContent, false, true, true, false);
mPopupContent = nullptr; // release the popup
}
} // ClosePopup
Expand Down
2 changes: 1 addition & 1 deletion layout/xul/nsMenuBarListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ nsresult nsMenuBarListener::KeyUp(Event* aKeyEvent) {
// handle key events when menubar is active and IME should be
// disabled.
if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
pm->Rollup({});
pm->Rollup(0, false, nullptr, nullptr);
}
// If menubar active state is changed or the menubar is destroyed
// during closing the popups, we should do nothing anymore.
Expand Down
4 changes: 1 addition & 3 deletions layout/xul/nsMenuPopupFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
#include <algorithm>

#include "X11UndefineNone.h"
#include "nsXULPopupManager.h"

using namespace mozilla;
using mozilla::dom::Document;
Expand Down Expand Up @@ -2464,8 +2463,7 @@ void nsMenuPopupFrame::CheckForAnchorChange(nsRect& aRect) {
if (pm) {
// As the caller will be iterating over the open popups, hide
// asyncronously.
pm->HidePopup(mContent,
{HidePopupOption::DeselectMenu, HidePopupOption::Async});
pm->HidePopup(mContent, false, true, true, false);
}

return;
Expand Down
Loading

0 comments on commit bca5dd3

Please sign in to comment.