Bug 1272578 part.3 Rename key name VolumeMute to AudioVolumeMute except on B2G r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 21 May 2016 00:57:18 +0900
changeset 369269 e98017e01edff89f3cd4be6a3a743d0d03afae75
parent 369268 3dae64ffcf79bf233e01011c2ad37e2025044bf8
child 369270 303a3767a31fddf454c0a463ba2a85a01d658044
push id18820
push usermasayuki@d-toybox.com
push dateSat, 21 May 2016 02:04:20 +0000
reviewerssmaug
bugs1272578
milestone49.0a1
Bug 1272578 part.3 Rename key name VolumeMute to AudioVolumeMute except on B2G r?smaug VolumeMute was renamed to AudioVolumeMute 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: KSkcPbIovin
dom/base/test/chrome/window_nsITextInputProcessor.xul
dom/events/KeyNameList.h
dom/inputmethod/forms.js
testing/marionette/event.js
testing/mochitest/tests/SimpleTest/EventUtils.js
widget/NativeKeyToDOMKeyName.h
widget/WidgetEventImpl.cpp
--- a/dom/base/test/chrome/window_nsITextInputProcessor.xul
+++ b/dom/base/test/chrome/window_nsITextInputProcessor.xul
@@ -2765,17 +2765,17 @@ function runKeyTests()
     { key: "F19",                       keyCode: KeyboardEvent.DOM_VK_F19 },
     { 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: "AudioVolumeMute",           keyCode: KeyboardEvent.DOM_VK_VOLUME_MUTE },
     { key: "AudioVolumeDown",           keyCode: KeyboardEvent.DOM_VK_VOLUME_DOWN },
     { key: "AudioVolumeUp",             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 },
--- a/dom/events/KeyNameList.h
+++ b/dom/events/KeyNameList.h
@@ -246,22 +246,23 @@ DEFINE_KEYNAME_WITH_SAME_NAME(AudioBassB
 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)
 DEFINE_KEYNAME_WITH_SAME_NAME(AudioVolumeUp)
+DEFINE_KEYNAME_WITH_SAME_NAME(AudioVolumeMute)
 #else
 // Temporarily, remaining for B2G
 DEFINE_KEYNAME_WITH_SAME_NAME(VolumeDown)
 DEFINE_KEYNAME_WITH_SAME_NAME(VolumeUp)
+DEFINE_KEYNAME_WITH_SAME_NAME(VolumeMute)
 #endif
-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)
 
 /******************************************************************************
  * Speech Keys
  *****************************************************************************/
--- a/dom/inputmethod/forms.js
+++ b/dom/inputmethod/forms.js
@@ -197,24 +197,26 @@ function guessKeyNameFromKeyCode(Keyboar
     case KeyboardEvent.DOM_VK_F23:
       return "F23";
     case KeyboardEvent.DOM_VK_F24:
       return "F24";
     case KeyboardEvent.DOM_VK_NUM_LOCK:
       return "NumLock";
     case KeyboardEvent.DOM_VK_SCROLL_LOCK:
       return "ScrollLock";
+#ifndef MOZ_B2G
     case KeyboardEvent.DOM_VK_VOLUME_MUTE:
-      return "VolumeMute";
-#ifndef MOZ_B2G
+      return "AudioVolumeMute";
     case KeyboardEvent.DOM_VK_VOLUME_DOWN:
       return "AudioVolumeDown";
     case KeyboardEvent.DOM_VK_VOLUME_UP:
       return "AudioVolumeUp";
 #else
+    case KeyboardEvent.DOM_VK_VOLUME_MUTE:
+      return "VolumeMute";
     case KeyboardEvent.DOM_VK_VOLUME_DOWN:
       return "VolumeDown";
     case KeyboardEvent.DOM_VK_VOLUME_UP:
       return "VolumeUp";
 #endif
     case KeyboardEvent.DOM_VK_META:
       return "Meta";
     case KeyboardEvent.DOM_VK_ALTGR:
--- a/testing/marionette/event.js
+++ b/testing/marionette/event.js
@@ -827,17 +827,17 @@ function guessKeyNameFromKeyCode_(aKeyCo
       return "F23";
     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";
+      return "AudioVolumeMute";
     case KeyboardEvent.DOM_VK_VOLUME_DOWN:
       return "AudioVolumeDown";
     case KeyboardEvent.DOM_VK_VOLUME_UP:
       return "AudioVolumeUp";
     case KeyboardEvent.DOM_VK_META:
       return "Meta";
     case KeyboardEvent.DOM_VK_ALTGR:
       return "AltGraph";
--- a/testing/mochitest/tests/SimpleTest/EventUtils.js
+++ b/testing/mochitest/tests/SimpleTest/EventUtils.js
@@ -1235,17 +1235,17 @@ function _guessKeyNameFromKeyCode(aKeyCo
       return "F23";
     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";
+      return "AudioVolumeMute";
     case KeyboardEvent.DOM_VK_VOLUME_DOWN:
       return "AudioVolumeDown";
     case KeyboardEvent.DOM_VK_VOLUME_UP:
       return "AudioVolumeUp";
     case KeyboardEvent.DOM_VK_META:
       return "Meta";
     case KeyboardEvent.DOM_VK_ALTGR:
       return "AltGraph";
--- a/widget/NativeKeyToDOMKeyName.h
+++ b/widget/NativeKeyToDOMKeyName.h
@@ -1021,23 +1021,24 @@ KEY_MAP_B2G               (VolumeDown,  
 KEY_MAP_WIN               (AudioVolumeUp, VK_VOLUME_UP)
 KEY_MAP_WIN_CMD           (AudioVolumeUp, APPCOMMAND_VOLUME_UP)
 KEY_MAP_COCOA             (AudioVolumeUp, kVK_VolumeUp)
 KEY_MAP_GTK               (AudioVolumeUp, GDK_AudioRaiseVolume)
 KEY_MAP_QT                (AudioVolumeUp, Qt::Key_VolumeUp)
 KEY_MAP_ANDROID_EXCEPT_B2G(AudioVolumeUp, AKEYCODE_VOLUME_UP)
 KEY_MAP_B2G               (VolumeUp,      AKEYCODE_VOLUME_UP)
 
-// VolumeMute (should be renamed to AudioVolumeMute)
-KEY_MAP_WIN     (VolumeMute, VK_VOLUME_MUTE)
-KEY_MAP_WIN_CMD (VolumeMute, APPCOMMAND_VOLUME_MUTE)
-KEY_MAP_COCOA   (VolumeMute, kVK_Mute)
-KEY_MAP_GTK     (VolumeMute, GDK_AudioMute)
-KEY_MAP_QT      (VolumeMute, Qt::Key_VolumeMute)
-KEY_MAP_ANDROID (VolumeMute, AKEYCODE_VOLUME_MUTE)
+// AudioVolumeMute
+KEY_MAP_WIN               (AudioVolumeMute, VK_VOLUME_MUTE)
+KEY_MAP_WIN_CMD           (AudioVolumeMute, APPCOMMAND_VOLUME_MUTE)
+KEY_MAP_COCOA             (AudioVolumeMute, kVK_Mute)
+KEY_MAP_GTK               (AudioVolumeMute, GDK_AudioMute)
+KEY_MAP_QT                (AudioVolumeMute, Qt::Key_VolumeMute)
+KEY_MAP_ANDROID_EXCEPT_B2G(AudioVolumeMute, AKEYCODE_VOLUME_MUTE)
+KEY_MAP_B2G               (VolumeMute,      AKEYCODE_VOLUME_MUTE)
 
 /******************************************************************************
  * Application Keys
  ******************************************************************************/
 // LaunchCalculator
 KEY_MAP_GTK     (LaunchCalculator, GDK_Calculator)
 KEY_MAP_QT      (LaunchCalculator, Qt::Key_Calculator)
 KEY_MAP_ANDROID (LaunchCalculator, AKEYCODE_CALCULATOR)
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -893,24 +893,26 @@ WidgetKeyboardEvent::ComputeKeyCodeFromK
     case KEY_NAME_INDEX_F23:
       return nsIDOMKeyEvent::DOM_VK_F23;
     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:
+#ifndef MOZ_B2G
+    case KEY_NAME_INDEX_AudioVolumeMute:
       return nsIDOMKeyEvent::DOM_VK_VOLUME_MUTE;
-#ifndef MOZ_B2G
     case KEY_NAME_INDEX_AudioVolumeDown:
       return nsIDOMKeyEvent::DOM_VK_VOLUME_DOWN;
     case KEY_NAME_INDEX_AudioVolumeUp:
       return nsIDOMKeyEvent::DOM_VK_VOLUME_UP;
 #else // #ifndef MOZ_B2G
+    case KEY_NAME_INDEX_VolumeMute:
+      return nsIDOMKeyEvent::DOM_VK_VOLUME_MUTE;
     case KEY_NAME_INDEX_VolumeDown:
       return nsIDOMKeyEvent::DOM_VK_VOLUME_DOWN;
     case KEY_NAME_INDEX_VolumeUp:
       return nsIDOMKeyEvent::DOM_VK_VOLUME_UP;
 #endif // #ifndef MOZ_B2G #else
     case KEY_NAME_INDEX_Meta:
       return nsIDOMKeyEvent::DOM_VK_META;
     case KEY_NAME_INDEX_AltGraph: