Bug 1440189 - part 1: Stop dispatching keypress event to the default event group in web content (only Nightly and early Beta) r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 26 Jan 2018 00:16:14 +0900
changeset 761033 b737a75d3299278757390ff830536652c33a4342
parent 760935 ee326c976eebdca48128054022c443d3993e12b0
child 761034 6fd8d8644f7621569c12f64f01586f108197f904
push id100822
push usermasayuki@d-toybox.com
push dateWed, 28 Feb 2018 15:32:41 +0000
reviewerssmaug
bugs1440189
milestone60.0a1
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
modules/libpref/init/all.js
widget/TextEventDispatcher.cpp
--- 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(