Bug 1272578 part.1 Rename key name VolumeDown to AudioVolumeDown except on B2G r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 21 May 2016 00:52:03 +0900
changeset 298778 d0604395964c8aa9886755d53128bcfe5f3b2af8
parent 298777 f02ee7dd94e0f854e0c46d9df2b3b64775dcac68
child 298779 8e106633b86e4371fbc675429651fc00e2088f7a
push id30285
push usercbook@mozilla.com
push dateWed, 25 May 2016 13:06:07 +0000
treeherdermozilla-central@d6d4e8417d2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1272578
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1272578 part.1 Rename key name VolumeDown to AudioVolumeDown except on B2G r=smaug VolumeDown was renamed to AudioVolumeDown in the latest draft and Chromium uses the new name. Therefore, we need to update this but Gaia uses the old name. So, we shouldn't rename on B2G until Gaia is fixed. Note that this patch changes tests but they are not used by B2G. Therefore, just replacing with new name is enough. Only forms.js is necessary #ifdef because the main purpose of forms.js is for B2G's IME framework. However, it's available on the other platforms if chrome needs to use it. MozReview-Commit-ID: cq98qJnS8M
devtools/client/responsivedesign/responsivedesign.jsm
dom/base/test/chrome/window_nsITextInputProcessor.xul
dom/events/KeyNameList.h
dom/inputmethod/forms.js
dom/inputmethod/jar.mn
testing/marionette/event.js
testing/mochitest/tests/SimpleTest/EventUtils.js
widget/NativeKeyToDOMKeyName.h
widget/WidgetEventImpl.cpp
--- a/devtools/client/responsivedesign/responsivedesign.jsm
+++ b/devtools/client/responsivedesign/responsivedesign.jsm
@@ -606,20 +606,20 @@ ResponsiveUI.prototype = {
     });
     volumeUp.addEventListener("mouseup", () => {
       SystemAppProxy.dispatchKeyboardEvent("keyup", {key: "VolumeUp"});
     });
 
     let volumeDown = this.chromeDoc.createElement("button");
     volumeDown.className = "devtools-responsiveui-volume-down-button";
     volumeDown.addEventListener("mousedown", () => {
-      SystemAppProxy.dispatchKeyboardEvent("keydown", {key: "VolumeDown"});
+      SystemAppProxy.dispatchKeyboardEvent("keydown", {key: "AudioVolumeDown"});
     });
     volumeDown.addEventListener("mouseup", () => {
-      SystemAppProxy.dispatchKeyboardEvent("keyup", {key: "VolumeDown"});
+      SystemAppProxy.dispatchKeyboardEvent("keyup", {key: "AudioVolumeDown"});
     });
 
     volumeButtons.appendChild(volumeUp);
     volumeButtons.appendChild(volumeDown);
     this.stack.appendChild(volumeButtons);
 
     let bottomToolbar = this.chromeDoc.createElement("toolbar");
     bottomToolbar.className = "devtools-responsiveui-hardware-buttons";
--- a/dom/base/test/chrome/window_nsITextInputProcessor.xul
+++ b/dom/base/test/chrome/window_nsITextInputProcessor.xul
@@ -2766,17 +2766,17 @@ function runKeyTests()
     { key: "F20",                       keyCode: KeyboardEvent.DOM_VK_F20 },
     { key: "F21",                       keyCode: KeyboardEvent.DOM_VK_F21 },
     { key: "F22",                       keyCode: KeyboardEvent.DOM_VK_F22 },
     { key: "F23",                       keyCode: KeyboardEvent.DOM_VK_F23 },
     { key: "F24",                       keyCode: KeyboardEvent.DOM_VK_F24 },
     { key: "NumLock",                   keyCode: KeyboardEvent.DOM_VK_NUM_LOCK,           isModifier: true, isLockableModifier: true },
     { key: "ScrollLock",                keyCode: KeyboardEvent.DOM_VK_SCROLL_LOCK,        isModifier: true, isLockableModifier: true },
     { key: "VolumeMute",                keyCode: KeyboardEvent.DOM_VK_VOLUME_MUTE },
-    { key: "VolumeDown",                keyCode: KeyboardEvent.DOM_VK_VOLUME_DOWN },
+    { key: "AudioVolumeDown",           keyCode: KeyboardEvent.DOM_VK_VOLUME_DOWN },
     { key: "VolumeUp",                  keyCode: KeyboardEvent.DOM_VK_VOLUME_UP },
     { key: "Meta",                      keyCode: KeyboardEvent.DOM_VK_META,               isModifier: true },
     { key: "AltGraph",                  keyCode: KeyboardEvent.DOM_VK_ALTGR,              isModifier: true },
     { key: "Attn",                      keyCode: KeyboardEvent.DOM_VK_ATTN },
     { key: "CrSel",                     keyCode: KeyboardEvent.DOM_VK_CRSEL },
     { key: "ExSel",                     keyCode: KeyboardEvent.DOM_VK_EXSEL },
     { key: "EraseEof",                  keyCode: KeyboardEvent.DOM_VK_EREOF },
     { key: "Play",                      keyCode: KeyboardEvent.DOM_VK_PLAY },
--- a/dom/events/KeyNameList.h
+++ b/dom/events/KeyNameList.h
@@ -243,17 +243,22 @@ DEFINE_KEYNAME_WITH_SAME_NAME(AudioBalan
 DEFINE_KEYNAME_WITH_SAME_NAME(AudioBassBoostDown)
 DEFINE_KEYNAME_WITH_SAME_NAME(AudioBassBoostToggle)
 DEFINE_KEYNAME_WITH_SAME_NAME(AudioBassBoostUp)
 DEFINE_KEYNAME_WITH_SAME_NAME(AudioFaderFront)
 DEFINE_KEYNAME_WITH_SAME_NAME(AudioFaderRear)
 DEFINE_KEYNAME_WITH_SAME_NAME(AudioSurroundModeNext)
 DEFINE_KEYNAME_WITH_SAME_NAME(AudioTrebleDown)
 DEFINE_KEYNAME_WITH_SAME_NAME(AudioTrebleUp)
+#ifndef MOZ_B2G
+DEFINE_KEYNAME_WITH_SAME_NAME(AudioVolumeDown)
+#else
+// Temporarily, remaining for B2G
 DEFINE_KEYNAME_WITH_SAME_NAME(VolumeDown)
+#endif
 DEFINE_KEYNAME_WITH_SAME_NAME(VolumeUp)
 DEFINE_KEYNAME_WITH_SAME_NAME(VolumeMute)
 DEFINE_KEYNAME_WITH_SAME_NAME(MicrophoneToggle)
 DEFINE_KEYNAME_WITH_SAME_NAME(MicrophoneVolumeDown)
 DEFINE_KEYNAME_WITH_SAME_NAME(MicrophoneVolumeUp)
 DEFINE_KEYNAME_WITH_SAME_NAME(MicrophoneVolumeMute)
 
 /******************************************************************************
--- a/dom/inputmethod/forms.js
+++ b/dom/inputmethod/forms.js
@@ -199,18 +199,23 @@ function guessKeyNameFromKeyCode(Keyboar
     case KeyboardEvent.DOM_VK_F24:
       return "F24";
     case KeyboardEvent.DOM_VK_NUM_LOCK:
       return "NumLock";
     case KeyboardEvent.DOM_VK_SCROLL_LOCK:
       return "ScrollLock";
     case KeyboardEvent.DOM_VK_VOLUME_MUTE:
       return "VolumeMute";
+#ifndef MOZ_B2G
+    case KeyboardEvent.DOM_VK_VOLUME_DOWN:
+      return "AudioVolumeDown";
+#else
     case KeyboardEvent.DOM_VK_VOLUME_DOWN:
       return "VolumeDown";
+#endif
     case KeyboardEvent.DOM_VK_VOLUME_UP:
       return "VolumeUp";
     case KeyboardEvent.DOM_VK_META:
       return "Meta";
     case KeyboardEvent.DOM_VK_ALTGR:
       return "AltGraph";
     case KeyboardEvent.DOM_VK_ATTN:
       return "Attn";
--- a/dom/inputmethod/jar.mn
+++ b/dom/inputmethod/jar.mn
@@ -1,6 +1,6 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 toolkit.jar:
-  content/global/forms.js                      (forms.js)
+* content/global/forms.js                      (forms.js)
--- a/testing/marionette/event.js
+++ b/testing/marionette/event.js
@@ -829,17 +829,17 @@ function guessKeyNameFromKeyCode_(aKeyCo
       return "F24";
     case KeyboardEvent.DOM_VK_NUM_LOCK:
       return "NumLock";
     case KeyboardEvent.DOM_VK_SCROLL_LOCK:
       return "ScrollLock";
     case KeyboardEvent.DOM_VK_VOLUME_MUTE:
       return "VolumeMute";
     case KeyboardEvent.DOM_VK_VOLUME_DOWN:
-      return "VolumeDown";
+      return "AudioVolumeDown";
     case KeyboardEvent.DOM_VK_VOLUME_UP:
       return "VolumeUp";
     case KeyboardEvent.DOM_VK_META:
       return "Meta";
     case KeyboardEvent.DOM_VK_ALTGR:
       return "AltGraph";
     case KeyboardEvent.DOM_VK_ATTN:
       return "Attn";
--- a/testing/mochitest/tests/SimpleTest/EventUtils.js
+++ b/testing/mochitest/tests/SimpleTest/EventUtils.js
@@ -1237,17 +1237,17 @@ function _guessKeyNameFromKeyCode(aKeyCo
       return "F24";
     case KeyboardEvent.DOM_VK_NUM_LOCK:
       return "NumLock";
     case KeyboardEvent.DOM_VK_SCROLL_LOCK:
       return "ScrollLock";
     case KeyboardEvent.DOM_VK_VOLUME_MUTE:
       return "VolumeMute";
     case KeyboardEvent.DOM_VK_VOLUME_DOWN:
-      return "VolumeDown";
+      return "AudioVolumeDown";
     case KeyboardEvent.DOM_VK_VOLUME_UP:
       return "VolumeUp";
     case KeyboardEvent.DOM_VK_META:
       return "Meta";
     case KeyboardEvent.DOM_VK_ALTGR:
       return "AltGraph";
     case KeyboardEvent.DOM_VK_ATTN:
       return "Attn";
--- a/widget/NativeKeyToDOMKeyName.h
+++ b/widget/NativeKeyToDOMKeyName.h
@@ -22,18 +22,22 @@
 #define KEY_MAP_WIN_OTH(aCPPKeyName, aNativeKey)
 #define KEY_MAP_WIN_CMD(aCPPKeyName, aAppCommand)
 // Mac OS X
 #define KEY_MAP_COCOA(aCPPKeyName, aNativeKey)
 // GTK
 #define KEY_MAP_GTK(aCPPKeyName, aNativeKey)
 // Qt
 #define KEY_MAP_QT(aCPPKeyName, aNativeKey)
-// Android and Gonk
+// Android and B2G
 #define KEY_MAP_ANDROID(aCPPKeyName, aNativeKey)
+// Only for Android
+#define KEY_MAP_ANDROID_EXCEPT_B2G(aCPPKeyName, aNativeKey)
+// Only for B2G
+#define KEY_MAP_B2G(aCPPKeyName, aNativeKey)
 
 #if defined(XP_WIN)
 #if defined(NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX)
 // KEY_MAP_WIN() defines the mapping not depending on keyboard layout.
 #undef KEY_MAP_WIN
 #define KEY_MAP_WIN(aCPPKeyName, aNativeKey) \
   NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX(aNativeKey, KEY_NAME_INDEX_##aCPPKeyName)
 #elif defined(NS_JAPANESE_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX)
@@ -77,16 +81,25 @@
 #elif defined(MOZ_WIDGET_QT)
 #undef KEY_MAP_QT
 #define KEY_MAP_QT(aCPPKeyName, aNativeKey) \
   NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX(aNativeKey, KEY_NAME_INDEX_##aCPPKeyName)
 #elif defined(ANDROID)
 #undef KEY_MAP_ANDROID
 #define KEY_MAP_ANDROID(aCPPKeyName, aNativeKey) \
   NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX(aNativeKey, KEY_NAME_INDEX_##aCPPKeyName)
+#ifndef MOZ_B2G
+#undef KEY_MAP_ANDROID_EXCEPT_B2G
+#define KEY_MAP_ANDROID_EXCEPT_B2G(aCPPKeyName, aNativeKey) \
+  NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX(aNativeKey, KEY_NAME_INDEX_##aCPPKeyName)
+#else // #ifndef MOZ_B2G
+#undef KEY_MAP_B2G
+#define KEY_MAP_B2G(aCPPKeyName, aNativeKey) \
+  NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX(aNativeKey, KEY_NAME_INDEX_##aCPPKeyName)
+#endif  // #ifndef MOZ_B2G #else
 #endif
 
 /******************************************************************************
  * Modifier Keys
  ******************************************************************************/
 // Alt
 KEY_MAP_WIN     (Alt, VK_MENU)
 KEY_MAP_WIN     (Alt, VK_LMENU)
@@ -990,23 +1003,24 @@ KEY_MAP_QT      (SpellCheck, Qt::Key_Spe
 // AudioBassBoostDown
 KEY_MAP_WIN_CMD (AudioBassBoostDown, APPCOMMAND_BASS_DOWN)
 KEY_MAP_QT      (AudioBassBoostDown, Qt::Key_BassDown)
 
 // AudioBassBoostUp
 KEY_MAP_WIN_CMD (AudioBassBoostUp, APPCOMMAND_BASS_UP)
 KEY_MAP_QT      (AudioBassBoostUp, Qt::Key_BassUp)
 
-// VolumeDown (should be renamed to AudioVolumeDown)
-KEY_MAP_WIN     (VolumeDown, VK_VOLUME_DOWN)
-KEY_MAP_WIN_CMD (VolumeDown, APPCOMMAND_VOLUME_DOWN)
-KEY_MAP_COCOA   (VolumeDown, kVK_VolumeDown)
-KEY_MAP_GTK     (VolumeDown, GDK_AudioLowerVolume)
-KEY_MAP_QT      (VolumeDown, Qt::Key_VolumeDown)
-KEY_MAP_ANDROID (VolumeDown, AKEYCODE_VOLUME_DOWN)
+// AudioVolumeDown
+KEY_MAP_WIN               (AudioVolumeDown, VK_VOLUME_DOWN)
+KEY_MAP_WIN_CMD           (AudioVolumeDown, APPCOMMAND_VOLUME_DOWN)
+KEY_MAP_COCOA             (AudioVolumeDown, kVK_VolumeDown)
+KEY_MAP_GTK               (AudioVolumeDown, GDK_AudioLowerVolume)
+KEY_MAP_QT                (AudioVolumeDown, Qt::Key_VolumeDown)
+KEY_MAP_ANDROID_EXCEPT_B2G(AudioVolumeDown, AKEYCODE_VOLUME_DOWN)
+KEY_MAP_B2G               (VolumeDown,      AKEYCODE_VOLUME_DOWN)
 
 // VolumeUp (should be renamed to AudioVolumeUp)
 KEY_MAP_WIN     (VolumeUp, VK_VOLUME_UP)
 KEY_MAP_WIN_CMD (VolumeUp, APPCOMMAND_VOLUME_UP)
 KEY_MAP_COCOA   (VolumeUp, kVK_VolumeUp)
 KEY_MAP_GTK     (VolumeUp, GDK_AudioRaiseVolume)
 KEY_MAP_QT      (VolumeUp, Qt::Key_VolumeUp)
 KEY_MAP_ANDROID (VolumeUp, AKEYCODE_VOLUME_UP)
@@ -1324,8 +1338,10 @@ KEY_MAP_ANDROID (SoftRight, AKEYCODE_SOF
 #undef KEY_MAP_WIN_JPN
 #undef KEY_MAP_WIN_KOR
 #undef KEY_MAP_WIN_OTH
 #undef KEY_MAP_WIN_CMD
 #undef KEY_MAP_COCOA
 #undef KEY_MAP_GTK
 #undef KEY_MAP_QT
 #undef KEY_MAP_ANDROID
+#undef KEY_MAP_ANDROID_EXCEPT_B2G
+#undef KEY_MAP_B2G
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -895,18 +895,23 @@ WidgetKeyboardEvent::ComputeKeyCodeFromK
     case KEY_NAME_INDEX_F24:
       return nsIDOMKeyEvent::DOM_VK_F24;
     case KEY_NAME_INDEX_NumLock:
       return nsIDOMKeyEvent::DOM_VK_NUM_LOCK;
     case KEY_NAME_INDEX_ScrollLock:
       return nsIDOMKeyEvent::DOM_VK_SCROLL_LOCK;
     case KEY_NAME_INDEX_VolumeMute:
       return nsIDOMKeyEvent::DOM_VK_VOLUME_MUTE;
+#ifndef MOZ_B2G
+    case KEY_NAME_INDEX_AudioVolumeDown:
+      return nsIDOMKeyEvent::DOM_VK_VOLUME_DOWN;
+#else // #ifndef MOZ_B2G
     case KEY_NAME_INDEX_VolumeDown:
       return nsIDOMKeyEvent::DOM_VK_VOLUME_DOWN;
+#endif // #ifndef MOZ_B2G #else
     case KEY_NAME_INDEX_VolumeUp:
       return nsIDOMKeyEvent::DOM_VK_VOLUME_UP;
     case KEY_NAME_INDEX_Meta:
       return nsIDOMKeyEvent::DOM_VK_META;
     case KEY_NAME_INDEX_AltGraph:
       return nsIDOMKeyEvent::DOM_VK_ALTGR;
     case KEY_NAME_INDEX_Attn:
       return nsIDOMKeyEvent::DOM_VK_ATTN;