зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1707869: Introduce helper to detect when native context menus are enabled via prefs on macOS. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D113579
This commit is contained in:
Родитель
8999ef4a4b
Коммит
fbd8c01170
|
@ -48,9 +48,7 @@
|
|||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPrefs_browser.h"
|
||||
#include "mozilla/StaticPrefs_ui.h"
|
||||
#include "mozilla/StaticPrefs_widget.h"
|
||||
#include "mozilla/StaticPrefs_xul.h"
|
||||
#include "mozilla/widget/nsAutoRollup.h"
|
||||
#ifdef XP_MACOSX
|
||||
|
@ -741,8 +739,7 @@ void nsXULPopupManager::ShowPopup(nsIContent* aPopup,
|
|||
|
||||
static bool ShouldUseNativeContextMenus() {
|
||||
#ifdef XP_MACOSX
|
||||
return StaticPrefs::widget_macos_native_context_menus() &&
|
||||
StaticPrefs::browser_proton_enabled();
|
||||
return mozilla::widget::NativeMenuSupport::ShouldUseNativeContextMenus();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -32,6 +32,9 @@ class NativeMenuSupport final {
|
|||
// as a native context menu.
|
||||
static already_AddRefed<NativeMenu> CreateNativeContextMenu(
|
||||
dom::Element* aPopup);
|
||||
|
||||
// Whether or not native context menus are enabled.
|
||||
static bool ShouldUseNativeContextMenus();
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "mozilla/widget/NativeMenuSupport.h"
|
||||
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/StaticPrefs_browser.h"
|
||||
#include "mozilla/StaticPrefs_widget.h"
|
||||
#include "NativeMenuMac.h"
|
||||
#include "nsCocoaWindow.h"
|
||||
#include "nsMenuBarX.h"
|
||||
|
@ -23,4 +25,8 @@ already_AddRefed<NativeMenu> NativeMenuSupport::CreateNativeContextMenu(dom::Ele
|
|||
return MakeAndAddRef<NativeMenuMac>(aPopup);
|
||||
}
|
||||
|
||||
bool NativeMenuSupport::ShouldUseNativeContextMenus() {
|
||||
return StaticPrefs::widget_macos_native_context_menus() && StaticPrefs::browser_proton_enabled();
|
||||
}
|
||||
|
||||
} // namespace mozilla::widget
|
||||
|
|
Загрузка…
Ссылка в новой задаче