mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1845587 - Don't close Firefox popups when MacOS toolbar menu opens. r=mstange
Now that we have native context menus we don't have to worry about those competing with the toolbar menus. Differential Revision: https://phabricator.services.mozilla.com/D184631
This commit is contained in:
parent
a9e2694194
commit
b8cc36b196
@ -34,7 +34,6 @@ class nsIWidget;
|
||||
- (id)initWithGeckoMenu:(nsMenuX*)geckoMenu;
|
||||
- (void)runBlockWhenOpen:(void (^)())block;
|
||||
- (void)menu:(NSMenu*)menu willActivateItem:(NSMenuItem*)item;
|
||||
@property BOOL menuIsInMenubar;
|
||||
@end
|
||||
|
||||
class nsMenuXObserver {
|
||||
|
@ -88,7 +88,6 @@ nsMenuX::nsMenuX(nsMenuParentX* aParent, nsMenuGroupOwnerX* aMenuGroupOwner, nsI
|
||||
SwizzleDynamicIndexingMethods();
|
||||
|
||||
mMenuDelegate = [[MenuDelegate alloc] initWithGeckoMenu:this];
|
||||
mMenuDelegate.menuIsInMenubar = mMenuGroupOwner->GetMenuBar() != nullptr;
|
||||
|
||||
if (!nsMenuBarX::sNativeEventTarget) {
|
||||
nsMenuBarX::sNativeEventTarget = [[NativeMenuItemTarget alloc] init];
|
||||
@ -1153,20 +1152,6 @@ void nsMenuX::Dump(uint32_t aIndent) const {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.menuIsInMenubar) {
|
||||
// If a menu in the menubar is trying open while a non-native menu is open, roll up the
|
||||
// non-native menu and reject the menubar opening attempt, effectively consuming the event.
|
||||
nsIRollupListener* rollupListener = nsBaseWidget::GetActiveRollupListener();
|
||||
if (rollupListener) {
|
||||
nsCOMPtr<nsIWidget> rollupWidget = rollupListener->GetRollupWidget();
|
||||
if (rollupWidget) {
|
||||
rollupListener->Rollup({0, nsIRollupListener::FlushViews::Yes});
|
||||
[menu cancelTracking];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hold a strong reference to mGeckoMenu while calling its methods.
|
||||
RefPtr<nsMenuX> geckoMenu = mGeckoMenu;
|
||||
geckoMenu->MenuOpened();
|
||||
|
Loading…
Reference in New Issue
Block a user