mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1573992 - Convert 3 ui.key.* prefs to static prefs. r=njn
Converts ui.key.generalAccessKey, ui.key.chromeAccess, and ui.key.contentAccess to static prefs. Updates usages. Differential Revision: https://phabricator.services.mozilla.com/D42392 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6f43a49b41
commit
be316b6bf9
@ -76,6 +76,7 @@
|
|||||||
#include "mozilla/PresShell.h"
|
#include "mozilla/PresShell.h"
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
#include "mozilla/StaticPrefs_ui.h"
|
||||||
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/HTMLCanvasElement.h"
|
#include "mozilla/dom/HTMLCanvasElement.h"
|
||||||
@ -249,7 +250,7 @@ KeyBinding Accessible::AccessKey() const {
|
|||||||
if (!key) return KeyBinding();
|
if (!key) return KeyBinding();
|
||||||
|
|
||||||
// Get modifier mask. Use ui.key.generalAccessKey (unless it is -1).
|
// Get modifier mask. Use ui.key.generalAccessKey (unless it is -1).
|
||||||
switch (Preferences::GetInt("ui.key.generalAccessKey", -1)) {
|
switch (StaticPrefs::ui_key_generalAccessKey()) {
|
||||||
case -1:
|
case -1:
|
||||||
break;
|
break;
|
||||||
case dom::KeyboardEvent_Binding::DOM_VK_SHIFT:
|
case dom::KeyboardEvent_Binding::DOM_VK_SHIFT:
|
||||||
@ -275,10 +276,12 @@ KeyBinding Accessible::AccessKey() const {
|
|||||||
int32_t modifierMask = 0;
|
int32_t modifierMask = 0;
|
||||||
switch (treeItem->ItemType()) {
|
switch (treeItem->ItemType()) {
|
||||||
case nsIDocShellTreeItem::typeChrome:
|
case nsIDocShellTreeItem::typeChrome:
|
||||||
rv = Preferences::GetInt("ui.key.chromeAccess", &modifierMask);
|
modifierMask = StaticPrefs::ui_key_chromeAccess();
|
||||||
|
rv = NS_OK;
|
||||||
break;
|
break;
|
||||||
case nsIDocShellTreeItem::typeContent:
|
case nsIDocShellTreeItem::typeContent:
|
||||||
rv = Preferences::GetInt("ui.key.contentAccess", &modifierMask);
|
modifierMask = StaticPrefs::ui_key_contentAccess();
|
||||||
|
rv = NS_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6676,6 +6676,37 @@
|
|||||||
# Prefs starting with "ui."
|
# Prefs starting with "ui."
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- name: ui.key.generalAccessKey
|
||||||
|
type: int32_t
|
||||||
|
value: -1
|
||||||
|
mirror: always
|
||||||
|
|
||||||
|
# Only used if generalAccessKey is -1.
|
||||||
|
- name: ui.key.chromeAccess
|
||||||
|
type: int32_t
|
||||||
|
#ifdef XP_MACOSX
|
||||||
|
# 0 = disabled, 1 = Shift, 2 = Ctrl, 4 = Alt, 3 = ctrl+shift, 8 = Meta
|
||||||
|
value: 2
|
||||||
|
#else
|
||||||
|
# 0 = disabled, 1 = Shift, 2 = Ctrl, 4 = Alt, 5 = Alt+Shift,
|
||||||
|
# 8 = Meta, 16 = Win
|
||||||
|
value: 4
|
||||||
|
#endif
|
||||||
|
mirror: always
|
||||||
|
|
||||||
|
# Only used if generalAccessKey is -1.
|
||||||
|
- name: ui.key.contentAccess
|
||||||
|
type: int32_t
|
||||||
|
#ifdef XP_MACOSX
|
||||||
|
# 0 = disabled, 1 = Shift, 2 = Ctrl, 4 = Alt, 3 = ctrl+shift, 8 = Meta
|
||||||
|
value: 6
|
||||||
|
#else
|
||||||
|
# 0 = disabled, 1 = Shift, 2 = Ctrl, 4 = Alt, 5 = Alt+Shift,
|
||||||
|
# 8 = Meta, 16 = Win
|
||||||
|
value: 5
|
||||||
|
#endif
|
||||||
|
mirror: always
|
||||||
|
|
||||||
# If the user puts a finger down on an element and we think the user might be
|
# If the user puts a finger down on an element and we think the user might be
|
||||||
# executing a pan gesture, how long do we wait before tentatively deciding the
|
# executing a pan gesture, how long do we wait before tentatively deciding the
|
||||||
# gesture is actually a tap and activating the target element?
|
# gesture is actually a tap and activating the target element?
|
||||||
|
@ -2635,13 +2635,6 @@ pref("services.blocklist.gfx.signer", "remote-settings.content-signature.mozilla
|
|||||||
// Use 17 for Ctrl, 18 for Alt, 224 for Meta, 91 for Win, 0 for none. Mac settings in macprefs.js
|
// Use 17 for Ctrl, 18 for Alt, 224 for Meta, 91 for Win, 0 for none. Mac settings in macprefs.js
|
||||||
pref("ui.key.accelKey", 17);
|
pref("ui.key.accelKey", 17);
|
||||||
pref("ui.key.menuAccessKey", 18);
|
pref("ui.key.menuAccessKey", 18);
|
||||||
pref("ui.key.generalAccessKey", -1);
|
|
||||||
|
|
||||||
// If generalAccessKey is -1, use the following two prefs instead.
|
|
||||||
// Use 0 for disabled, 1 for Shift, 2 for Ctrl, 4 for Alt, 8 for Meta, 16 for Win
|
|
||||||
// (values can be combined, e.g. 5 for Alt+Shift)
|
|
||||||
pref("ui.key.chromeAccess", 4);
|
|
||||||
pref("ui.key.contentAccess", 5);
|
|
||||||
|
|
||||||
pref("ui.key.menuAccessKeyFocuses", false); // overridden below
|
pref("ui.key.menuAccessKeyFocuses", false); // overridden below
|
||||||
|
|
||||||
@ -3923,17 +3916,6 @@ pref("ui.mouse.radius.inputSource.touchOnly", true);
|
|||||||
// Use 17 for Ctrl, 18 for Option, 224 for Cmd, 0 for none
|
// Use 17 for Ctrl, 18 for Option, 224 for Cmd, 0 for none
|
||||||
pref("ui.key.menuAccessKey", 0);
|
pref("ui.key.menuAccessKey", 0);
|
||||||
pref("ui.key.accelKey", 224);
|
pref("ui.key.accelKey", 224);
|
||||||
// (pinkerton, joki, saari) IE5 for mac uses Control for access keys. The HTML4 spec
|
|
||||||
// suggests to use command on mac, but this really sucks (imagine someone having a "q"
|
|
||||||
// as an access key and not letting you quit the app!). As a result, we've made a
|
|
||||||
// command decision 1 day before tree lockdown to change it to the control key.
|
|
||||||
pref("ui.key.generalAccessKey", -1);
|
|
||||||
|
|
||||||
// If generalAccessKey is -1, use the following two prefs instead.
|
|
||||||
// Use 0 for disabled, 1 for Shift, 2 for Ctrl, 4 for Alt, 8 for Meta (Cmd)
|
|
||||||
// (values can be combined, e.g. 3 for Ctrl+Shift)
|
|
||||||
pref("ui.key.chromeAccess", 2);
|
|
||||||
pref("ui.key.contentAccess", 6);
|
|
||||||
|
|
||||||
// See bug 404131, topmost <panel> element wins to Dashboard on MacOSX.
|
// See bug 404131, topmost <panel> element wins to Dashboard on MacOSX.
|
||||||
pref("ui.panel.default_level_parent", false);
|
pref("ui.panel.default_level_parent", false);
|
||||||
|
@ -786,10 +786,6 @@ class WidgetKeyboardEvent : public WidgetInputEvent {
|
|||||||
"Invalid native key binding type");
|
"Invalid native key binding type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t GenericAccessModifierKeyPref();
|
|
||||||
static int32_t ChromeAccessModifierMaskPref();
|
|
||||||
static int32_t ContentAccessModifierMaskPref();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "mozilla/MouseEvents.h"
|
#include "mozilla/MouseEvents.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/StaticPrefs_mousewheel.h"
|
#include "mozilla/StaticPrefs_mousewheel.h"
|
||||||
|
#include "mozilla/StaticPrefs_ui.h"
|
||||||
#include "mozilla/TextEvents.h"
|
#include "mozilla/TextEvents.h"
|
||||||
#include "mozilla/TouchEvents.h"
|
#include "mozilla/TouchEvents.h"
|
||||||
#include "mozilla/dom/KeyboardEventBinding.h"
|
#include "mozilla/dom/KeyboardEventBinding.h"
|
||||||
@ -1009,7 +1010,7 @@ Modifiers WidgetKeyboardEvent::ModifiersForAccessKeyMatching() const {
|
|||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
Modifiers WidgetKeyboardEvent::AccessKeyModifiers(AccessKeyType aType) {
|
Modifiers WidgetKeyboardEvent::AccessKeyModifiers(AccessKeyType aType) {
|
||||||
switch (GenericAccessModifierKeyPref()) {
|
switch (StaticPrefs::ui_key_generalAccessKey()) {
|
||||||
case -1:
|
case -1:
|
||||||
break; // use the individual prefs
|
break; // use the individual prefs
|
||||||
case NS_VK_SHIFT:
|
case NS_VK_SHIFT:
|
||||||
@ -1028,47 +1029,14 @@ Modifiers WidgetKeyboardEvent::AccessKeyModifiers(AccessKeyType aType) {
|
|||||||
|
|
||||||
switch (aType) {
|
switch (aType) {
|
||||||
case AccessKeyType::eChrome:
|
case AccessKeyType::eChrome:
|
||||||
return PrefFlagsToModifiers(ChromeAccessModifierMaskPref());
|
return PrefFlagsToModifiers(StaticPrefs::ui_key_chromeAccess());
|
||||||
case AccessKeyType::eContent:
|
case AccessKeyType::eContent:
|
||||||
return PrefFlagsToModifiers(ContentAccessModifierMaskPref());
|
return PrefFlagsToModifiers(StaticPrefs::ui_key_contentAccess());
|
||||||
default:
|
default:
|
||||||
return MODIFIER_NONE;
|
return MODIFIER_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
|
||||||
int32_t WidgetKeyboardEvent::GenericAccessModifierKeyPref() {
|
|
||||||
static bool sInitialized = false;
|
|
||||||
static int32_t sValue = -1;
|
|
||||||
if (!sInitialized) {
|
|
||||||
Preferences::AddIntVarCache(&sValue, "ui.key.generalAccessKey", sValue);
|
|
||||||
sInitialized = true;
|
|
||||||
}
|
|
||||||
return sValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
int32_t WidgetKeyboardEvent::ChromeAccessModifierMaskPref() {
|
|
||||||
static bool sInitialized = false;
|
|
||||||
static int32_t sValue = 0;
|
|
||||||
if (!sInitialized) {
|
|
||||||
Preferences::AddIntVarCache(&sValue, "ui.key.chromeAccess", sValue);
|
|
||||||
sInitialized = true;
|
|
||||||
}
|
|
||||||
return sValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
int32_t WidgetKeyboardEvent::ContentAccessModifierMaskPref() {
|
|
||||||
static bool sInitialized = false;
|
|
||||||
static int32_t sValue = 0;
|
|
||||||
if (!sInitialized) {
|
|
||||||
Preferences::AddIntVarCache(&sValue, "ui.key.contentAccess", sValue);
|
|
||||||
sInitialized = true;
|
|
||||||
}
|
|
||||||
return sValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
void WidgetKeyboardEvent::Shutdown() {
|
void WidgetKeyboardEvent::Shutdown() {
|
||||||
delete sKeyNameIndexHashtable;
|
delete sKeyNameIndexHashtable;
|
||||||
|
Loading…
Reference in New Issue
Block a user