Bug 1626388 - Convert ui.key.menuAccessKeyFocuses to static pref r=njn

Converts `ui.key.menuAccessKeyFocuses` to a static pref and removes `nsMenuBarListener::InitializeStatics()`. This pref sets to `true` in windows and linux, which may affect behavior in SeaMonkey and Thunderbird.

Differential Revision: https://phabricator.services.mozilla.com/D69617

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kristen Wright 2020-04-07 17:10:30 +00:00
parent 41a1cec59e
commit 6de3ea1964
6 changed files with 17 additions and 27 deletions

View File

@ -1452,11 +1452,6 @@ pref("identity.fxaccounts.commands.enabled", true);
// Default is 24 hours.
pref("identity.fxaccounts.commands.missed.fetch_interval", 86400);
// On GTK, we now default to showing the menubar only when alt is pressed:
#ifdef MOZ_WIDGET_GTK
pref("ui.key.menuAccessKeyFocuses", true);
#endif
// Whether we should run a test-pattern through EME GMPs before assuming they'll
// decode H.264.
pref("media.gmp.trial-create.enabled", true);

View File

@ -75,7 +75,6 @@
# include "nsXULPrototypeCache.h"
# include "nsXULTooltipListener.h"
# include "nsMenuBarListener.h"
#endif
#include "mozilla/dom/UIDirectionManager.h"
@ -249,10 +248,6 @@ nsresult nsLayoutStatics::Initialize() {
nsPermissionManager::Startup();
#ifdef MOZ_XUL
nsMenuBarListener::InitializeStatics();
#endif
UIDirectionManager::Initialize();
CacheObserver::Init();

View File

@ -17,6 +17,7 @@
#include "nsContentUtils.h"
#include "mozilla/BasicEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs_ui.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/EventBinding.h"
@ -37,7 +38,6 @@ NS_IMPL_ISUPPORTS(nsMenuBarListener, nsIDOMEventListener)
int32_t nsMenuBarListener::mAccessKey = -1;
Modifiers nsMenuBarListener::mAccessKeyMask = 0;
bool nsMenuBarListener::mAccessKeyFocuses = false;
nsMenuBarListener::nsMenuBarListener(nsMenuBarFrame* aMenuBarFrame,
nsIContent* aMenuBarContent)
@ -117,11 +117,6 @@ void nsMenuBarListener::OnDestroyMenuBarFrame() {
mTopWindowEventTarget = nullptr;
}
void nsMenuBarListener::InitializeStatics() {
Preferences::AddBoolVarCache(&mAccessKeyFocuses,
"ui.key.menuAccessKeyFocuses");
}
nsresult nsMenuBarListener::GetMenuAccessKey(int32_t* aAccessKey) {
if (!aAccessKey) return NS_ERROR_INVALID_POINTER;
InitAccessKey();
@ -190,7 +185,7 @@ nsresult nsMenuBarListener::KeyUp(Event* aKeyEvent) {
return NS_OK;
}
if (mAccessKey && mAccessKeyFocuses) {
if (mAccessKey && StaticPrefs::ui_key_menuAccessKeyFocuses()) {
bool defaultPrevented = keyEvent->DefaultPrevented();
// On a press of the ALT key by itself, we toggle the menu's
@ -414,7 +409,7 @@ nsresult nsMenuBarListener::KeyDown(Event* aKeyEvent) {
}
#endif
if (mAccessKey && mAccessKeyFocuses) {
if (mAccessKey && StaticPrefs::ui_key_menuAccessKeyFocuses()) {
bool defaultPrevented = aKeyEvent->DefaultPrevented();
// No other modifiers can be down.

View File

@ -46,8 +46,6 @@ class nsMenuBarListener final : public nsIDOMEventListener {
*/
void OnDestroyMenuBarFrame();
static void InitializeStatics();
/**
* GetMenuAccessKey() returns keyCode value of a modifier key which is
* used for accesskey. Returns 0 if the platform doesn't support access key.
@ -109,8 +107,6 @@ class nsMenuBarListener final : public nsIDOMEventListener {
bool mAccessKeyDown;
// Whether or not the ALT key down is canceled by other action.
bool mAccessKeyDownCanceled;
// Does the access key by itself focus the menubar?
static bool mAccessKeyFocuses;
// See KeyboardEvent for sample values (DOM_VK_* constants).
static int32_t mAccessKey;
// Modifier mask for the access key.

View File

@ -7469,7 +7469,7 @@
type: uint32_t
value: 500
mirror: always
# A testing flag.
- name: network.predictor.doing-tests
type: bool
@ -8445,6 +8445,19 @@
#endif
mirror: always
# Does the access key by itself focus the menu bar?
- name: ui.key.menuAccessKeyFocuses
type: bool
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
# On Windows and Linux, we now default to showing the menu bar only when alt
# is pressed.
value: true
#else
value: false
#endif
mirror: always
# If true, all popups won't hide automatically on blur
- name: ui.popup.disable_autohide
type: RelaxedAtomicBool

View File

@ -2374,8 +2374,6 @@ pref("services.blocklist.gfx.signer", "remote-settings.content-signature.mozilla
pref("ui.key.accelKey", 17);
pref("ui.key.menuAccessKey", 18);
pref("ui.key.menuAccessKeyFocuses", false); // overridden below
// Middle-mouse handling
pref("middlemouse.paste", false);
pref("middlemouse.contentLoadURL", false);
@ -3111,8 +3109,6 @@ pref("ui.mouse.radius.inputSource.touchOnly", true);
// force_gdi_classic_for_families.
pref("gfx.font_rendering.cleartype_params.force_gdi_classic_max_size", 15);
pref("ui.key.menuAccessKeyFocuses", true);
// override double-click word selection behavior.
pref("layout.word_select.eat_space_to_next_word", true);