зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
a9e2694194
Коммит
b8cc36b196
|
@ -34,7 +34,6 @@ class nsIWidget;
|
||||||
- (id)initWithGeckoMenu:(nsMenuX*)geckoMenu;
|
- (id)initWithGeckoMenu:(nsMenuX*)geckoMenu;
|
||||||
- (void)runBlockWhenOpen:(void (^)())block;
|
- (void)runBlockWhenOpen:(void (^)())block;
|
||||||
- (void)menu:(NSMenu*)menu willActivateItem:(NSMenuItem*)item;
|
- (void)menu:(NSMenu*)menu willActivateItem:(NSMenuItem*)item;
|
||||||
@property BOOL menuIsInMenubar;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
class nsMenuXObserver {
|
class nsMenuXObserver {
|
||||||
|
|
|
@ -88,7 +88,6 @@ nsMenuX::nsMenuX(nsMenuParentX* aParent, nsMenuGroupOwnerX* aMenuGroupOwner, nsI
|
||||||
SwizzleDynamicIndexingMethods();
|
SwizzleDynamicIndexingMethods();
|
||||||
|
|
||||||
mMenuDelegate = [[MenuDelegate alloc] initWithGeckoMenu:this];
|
mMenuDelegate = [[MenuDelegate alloc] initWithGeckoMenu:this];
|
||||||
mMenuDelegate.menuIsInMenubar = mMenuGroupOwner->GetMenuBar() != nullptr;
|
|
||||||
|
|
||||||
if (!nsMenuBarX::sNativeEventTarget) {
|
if (!nsMenuBarX::sNativeEventTarget) {
|
||||||
nsMenuBarX::sNativeEventTarget = [[NativeMenuItemTarget alloc] init];
|
nsMenuBarX::sNativeEventTarget = [[NativeMenuItemTarget alloc] init];
|
||||||
|
@ -1153,20 +1152,6 @@ void nsMenuX::Dump(uint32_t aIndent) const {
|
||||||
return;
|
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.
|
// Hold a strong reference to mGeckoMenu while calling its methods.
|
||||||
RefPtr<nsMenuX> geckoMenu = mGeckoMenu;
|
RefPtr<nsMenuX> geckoMenu = mGeckoMenu;
|
||||||
geckoMenu->MenuOpened();
|
geckoMenu->MenuOpened();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче