Bug 1573992 - Convert two dom.keyboardevent.* prefs to staticprefs. r=njn

Converts dom.keyboardevent.dispatch_during_composition and dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content to static prefs. Removes the dispatch_during_composition entry from mobile.js, since it just redefines the same pref value.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
kriswright 2019-08-26 20:25:42 +00:00
parent fa50c7828f
commit 6f43a49b41
5 changed files with 20 additions and 39 deletions

View File

@ -807,8 +807,6 @@ pref("webchannel.allowObject.urlWhitelist", "https://accounts.firefox.com https:
pref("media.openUnsupportedTypeWithExternalApp", true);
pref("dom.keyboardevent.dispatch_during_composition", true);
// Ask for permission when enumerating WebRTC devices.
pref("media.navigator.permission.device", true);

View File

@ -1606,6 +1606,21 @@
#endif
mirror: always
# If this is true, TextEventDispatcher dispatches keydown and keyup events
# even during composition (keypress events are never fired during composition
# even if this is true).
- name: dom.keyboardevent.dispatch_during_composition
type: bool
value: true
mirror: always
# If this is true, keypress events for non-printable keys are dispatched only
# for event listeners of the system event group in web content.
- name: dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content
type: bool
value: true
mirror: always
# If this is true, "keypress" event's keyCode value and charCode value always
# become same if the event is not created/initialized by JS.
- name: dom.keyboardevent.keypress.set_keycode_and_charcode_to_same_value

View File

@ -285,16 +285,6 @@ pref("dom.serviceWorkers.update_delay", 1000);
// Enable test for 24 hours update, service workers will always treat last update check time is over 24 hours
pref("dom.serviceWorkers.testUpdateOverOneDay", false);
// If this is true, TextEventDispatcher dispatches keydown and keyup events
// even during composition (keypress events are never fired during composition
// even if this is true).
pref("dom.keyboardevent.dispatch_during_composition", true);
// If this is true, TextEventDispatcher dispatches keypress event with setting
// WidgetEvent::mFlags::mOnlySystemGroupDispatchInContent to true if it won't
// cause inputting printable character.
pref("dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content", true);
// Blacklist of domains of web apps which are not aware of strict keypress
// dispatching behavior. This is comma separated list. If you need to match
// all sub-domains, you can specify it as "*.example.com". Additionally, you

View File

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TextEventDispatcher.h"
#include "nsIDocShell.h"
@ -19,11 +20,6 @@ namespace widget {
/******************************************************************************
* TextEventDispatcher
*****************************************************************************/
bool TextEventDispatcher::sDispatchKeyEventsDuringComposition = false;
bool TextEventDispatcher::sDispatchKeyPressEventsOnlySystemGroupInContent =
false;
TextEventDispatcher::TextEventDispatcher(nsIWidget* aWidget)
: mWidget(aWidget),
mDispatchingEvent(0),
@ -33,19 +29,6 @@ TextEventDispatcher::TextEventDispatcher(nsIWidget* aWidget)
mHasFocus(false) {
MOZ_RELEASE_ASSERT(mWidget, "aWidget must not be nullptr");
static bool sInitialized = false;
if (!sInitialized) {
Preferences::AddBoolVarCache(
&sDispatchKeyEventsDuringComposition,
"dom.keyboardevent.dispatch_during_composition", true);
Preferences::AddBoolVarCache(
&sDispatchKeyPressEventsOnlySystemGroupInContent,
"dom.keyboardevent.keypress."
"dispatch_non_printable_keys_only_system_group_in_content",
true);
sInitialized = true;
}
ClearNotificationRequests();
}
@ -543,7 +526,8 @@ bool TextEventDispatcher::DispatchKeyboardEventInternal(
// However, if we need to behave like other browsers, we need the keydown
// and keyup events. Note that this behavior is also allowed by D3E spec.
// FYI: keypress events must not be fired during composition.
if (!sDispatchKeyEventsDuringComposition || aMessage == eKeyPress) {
if (!StaticPrefs::dom_keyboardevent_dispatch_during_composition() ||
aMessage == eKeyPress) {
return false;
}
// XXX If there was mOnlyContentDispatch for this case, it might be useful
@ -658,7 +642,8 @@ bool TextEventDispatcher::DispatchKeyboardEventInternal(
}
}
if (sDispatchKeyPressEventsOnlySystemGroupInContent &&
if (StaticPrefs::
dom_keyboardevent_keypress_dispatch_non_printable_keys_only_system_group_in_content() &&
keyEvent.mMessage == eKeyPress &&
!keyEvent.ShouldKeyPressEventBeFiredOnContent()) {
// Note that even if we set it to true, this may be overwritten by

View File

@ -440,13 +440,6 @@ class TextEventDispatcher final {
// received yet. Otherwise, false.
bool mHasFocus;
// If this is true, keydown and keyup events are dispatched even when there
// is a composition.
static bool sDispatchKeyEventsDuringComposition;
// If this is true, keypress events for non-printable keys are dispatched only
// for event listeners of the system event group in web content.
static bool sDispatchKeyPressEventsOnlySystemGroupInContent;
nsresult BeginInputTransactionInternal(TextEventDispatcherListener* aListener,
InputTransactionType aType);