Bug 1440189 - part 1: Stop dispatching keypress event to the default event group in web content (only Nightly and early Beta) r?smaug
UI Events declares that keypress event should be fired only when the keydown
sequence produces some characters. For conforming to UI Events and
compatibility with the other browsers, we should stop dispatching keypress
events for non-printable keys.
For getting regression reports, we should enable this new behavior only
on Nightly and early Beta.
MozReview-Commit-ID: 5IIL9huejXH
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -218,17 +218,21 @@ pref("dom.gamepad.haptic_feedback.enable
// 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", false);
// If this is true, TextEventDispatcher dispatches keypress event with setting
// WidgetEvent::mFlags::mOnlySystemGroupDispatchInContent to true if it won't
// cause inputting printable character.
+#ifdef EARLY_BETA_OR_EARLIER
+pref("dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content", true);
+#else
pref("dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content", false);
+#endif
// Whether the WebMIDI API is enabled
pref("dom.webmidi.enabled", false);
// Whether to run add-on code in different compartments from browser code. This
// causes a separate compartment for each (addon, global) combination, which may
// significantly increase the number of compartments in the system.
pref("dom.compartment_per_addon", true);
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -40,17 +40,17 @@ TextEventDispatcher::TextEventDispatcher
Preferences::AddBoolVarCache(
&sDispatchKeyEventsDuringComposition,
"dom.keyboardevent.dispatch_during_composition",
false);
Preferences::AddBoolVarCache(
&sDispatchKeyPressEventsOnlySystemGroupInContent,
"dom.keyboardevent.keypress."
"dispatch_non_printable_keys_only_system_group_in_content",
- false);
+ true);
sInitialized = true;
}
ClearNotificationRequests();
}
nsresult
TextEventDispatcher::BeginInputTransaction(