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

--HG--
extra : rebase_source : 98653e5427d9d4720d19011673cbb0f9cdf36f1a
This commit is contained in:
Masayuki Nakano 2016-05-21 00:52:03 +09:00
Родитель 805f86c2b5
Коммит 97f043ea9e
9 изменённых файлов: 45 добавлений и 14 удалений

Просмотреть файл

@ -611,10 +611,10 @@ ResponsiveUI.prototype = {
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);

Просмотреть файл

@ -2771,7 +2771,7 @@ function runKeyTests()
{ 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 },

Просмотреть файл

@ -248,7 +248,12 @@ 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)

Просмотреть файл

@ -204,8 +204,13 @@ function guessKeyNameFromKeyCode(KeyboardEvent, aKeyCode) {
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:

Просмотреть файл

@ -3,4 +3,4 @@
# 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)

Просмотреть файл

@ -834,7 +834,7 @@ function guessKeyNameFromKeyCode_(aKeyCode, win = window)
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:

Просмотреть файл

@ -1242,7 +1242,7 @@ function _guessKeyNameFromKeyCode(aKeyCode, aWindow = window)
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:

Просмотреть файл

@ -27,8 +27,12 @@
#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)
@ -82,6 +86,15 @@
#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
/******************************************************************************
@ -995,13 +1008,14 @@ KEY_MAP_QT (AudioBassBoostDown, Qt::Key_BassDown)
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)
@ -1329,3 +1343,5 @@ KEY_MAP_ANDROID (SoftRight, AKEYCODE_SOFT_RIGHT)
#undef KEY_MAP_GTK
#undef KEY_MAP_QT
#undef KEY_MAP_ANDROID
#undef KEY_MAP_ANDROID_EXCEPT_B2G
#undef KEY_MAP_B2G

Просмотреть файл

@ -900,8 +900,13 @@ WidgetKeyboardEvent::ComputeKeyCodeFromKeyNameIndex(KeyNameIndex aKeyNameIndex)
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: