Bug 1024864 Warn KeyboardEvent.key value change when KeyboardEvent.key is read and its key value is obsolete r=smaug

This commit is contained in:
Masayuki Nakano 2014-06-14 11:24:16 +09:00
Родитель af5619baf2
Коммит f31b35e66b
3 изменённых файлов: 180 добавлений и 1 удалений

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

@ -40,3 +40,28 @@ DEPRECATED_OPERATION(SyncXMLHttpRequest)
DEPRECATED_OPERATION(DataContainerEvent)
DEPRECATED_OPERATION(SendAsBinary)
DEPRECATED_OPERATION(Window_Controllers)
DEPRECATED_OPERATION(KeyNameDown)
DEPRECATED_OPERATION(KeyNameLeft)
DEPRECATED_OPERATION(KeyNameRight)
DEPRECATED_OPERATION(KeyNameUp)
DEPRECATED_OPERATION(KeyNameCrsel)
DEPRECATED_OPERATION(KeyNameDel)
DEPRECATED_OPERATION(KeyNameExsel)
DEPRECATED_OPERATION(KeyNameMenu)
DEPRECATED_OPERATION(KeyNameEsc)
DEPRECATED_OPERATION(KeyNameNonconvert)
DEPRECATED_OPERATION(KeyNameHalfWidth)
DEPRECATED_OPERATION(KeyNameRomanCharacters)
DEPRECATED_OPERATION(KeyNameFullWidth)
DEPRECATED_OPERATION(KeyNameSelectMedia)
DEPRECATED_OPERATION(KeyNameMediaNextTrack)
DEPRECATED_OPERATION(KeyNameMediaPreviousTrack)
DEPRECATED_OPERATION(KeyNameRed)
DEPRECATED_OPERATION(KeyNameGreen)
DEPRECATED_OPERATION(KeyNameYellow)
DEPRECATED_OPERATION(KeyNameBlue)
DEPRECATED_OPERATION(KeyNameLive)
DEPRECATED_OPERATION(KeyNameApps)
DEPRECATED_OPERATION(KeyNameFastFwd)
DEPRECATED_OPERATION(KeyNameZoom)
DEPRECATED_OPERATION(KeyNameDeadKeys)

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

@ -5,6 +5,7 @@
#include "mozilla/dom/KeyboardEvent.h"
#include "mozilla/TextEvents.h"
#include "nsIDocument.h"
#include "prtime.h"
namespace mozilla {
@ -126,7 +127,110 @@ KeyboardEvent::GetModifierState(const nsAString& aKey,
NS_IMETHODIMP
KeyboardEvent::GetKey(nsAString& aKeyName)
{
mEvent->AsKeyboardEvent()->GetDOMKeyName(aKeyName);
WidgetKeyboardEvent* keyboardEvent = mEvent->AsKeyboardEvent();
keyboardEvent->GetDOMKeyName(aKeyName);
nsIDocument::DeprecatedOperations deprecatedOperation;
switch (keyboardEvent->mKeyNameIndex) {
case KEY_NAME_INDEX_Down:
deprecatedOperation = nsIDocument::eKeyNameDown;
break;
case KEY_NAME_INDEX_Left:
deprecatedOperation = nsIDocument::eKeyNameLeft;
break;
case KEY_NAME_INDEX_Right:
deprecatedOperation = nsIDocument::eKeyNameRight;
break;
case KEY_NAME_INDEX_Up:
deprecatedOperation = nsIDocument::eKeyNameUp;
break;
case KEY_NAME_INDEX_Crsel:
deprecatedOperation = nsIDocument::eKeyNameCrsel;
break;
case KEY_NAME_INDEX_Del:
deprecatedOperation = nsIDocument::eKeyNameDel;
break;
case KEY_NAME_INDEX_Exsel:
deprecatedOperation = nsIDocument::eKeyNameExsel;
break;
case KEY_NAME_INDEX_Menu:
deprecatedOperation = nsIDocument::eKeyNameMenu;
break;
case KEY_NAME_INDEX_Esc:
deprecatedOperation = nsIDocument::eKeyNameEsc;
break;
case KEY_NAME_INDEX_Nonconvert:
deprecatedOperation = nsIDocument::eKeyNameNonconvert;
break;
case KEY_NAME_INDEX_HalfWidth:
deprecatedOperation = nsIDocument::eKeyNameHalfWidth;
break;
case KEY_NAME_INDEX_RomanCharacters:
deprecatedOperation = nsIDocument::eKeyNameRomanCharacters;
break;
case KEY_NAME_INDEX_FullWidth:
deprecatedOperation = nsIDocument::eKeyNameFullWidth;
break;
case KEY_NAME_INDEX_SelectMedia:
deprecatedOperation = nsIDocument::eKeyNameSelectMedia;
break;
case KEY_NAME_INDEX_MediaNextTrack:
deprecatedOperation = nsIDocument::eKeyNameMediaNextTrack;
break;
case KEY_NAME_INDEX_MediaPreviousTrack:
deprecatedOperation = nsIDocument::eKeyNameMediaPreviousTrack;
break;
case KEY_NAME_INDEX_Red:
deprecatedOperation = nsIDocument::eKeyNameRed;
break;
case KEY_NAME_INDEX_Green:
deprecatedOperation = nsIDocument::eKeyNameGreen;
break;
case KEY_NAME_INDEX_Yellow:
deprecatedOperation = nsIDocument::eKeyNameYellow;
break;
case KEY_NAME_INDEX_Blue:
deprecatedOperation = nsIDocument::eKeyNameBlue;
break;
case KEY_NAME_INDEX_Live:
deprecatedOperation = nsIDocument::eKeyNameLive;
break;
case KEY_NAME_INDEX_Apps:
deprecatedOperation = nsIDocument::eKeyNameApps;
break;
case KEY_NAME_INDEX_FastFwd:
deprecatedOperation = nsIDocument::eKeyNameFastFwd;
break;
case KEY_NAME_INDEX_Zoom:
deprecatedOperation = nsIDocument::eKeyNameZoom;
break;
case KEY_NAME_INDEX_DeadGrave:
case KEY_NAME_INDEX_DeadAcute:
case KEY_NAME_INDEX_DeadCircumflex:
case KEY_NAME_INDEX_DeadTilde:
case KEY_NAME_INDEX_DeadMacron:
case KEY_NAME_INDEX_DeadBreve:
case KEY_NAME_INDEX_DeadAboveDot:
case KEY_NAME_INDEX_DeadUmlaut:
case KEY_NAME_INDEX_DeadAboveRing:
case KEY_NAME_INDEX_DeadDoubleacute:
case KEY_NAME_INDEX_DeadCaron:
case KEY_NAME_INDEX_DeadCedilla:
case KEY_NAME_INDEX_DeadOgonek:
case KEY_NAME_INDEX_DeadIota:
case KEY_NAME_INDEX_DeadVoicedSound:
case KEY_NAME_INDEX_DeadSemivoicedSound:
deprecatedOperation = nsIDocument::eKeyNameDeadKeys;
break;
default:
return NS_OK;
}
nsIDocument* doc = mOwner ? mOwner->GetExtantDoc() : nullptr;
if (NS_WARN_IF(!doc)) {
return NS_OK;
}
doc->WarnOnceAbout(deprecatedOperation);
return NS_OK;
}

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

@ -157,3 +157,53 @@ DataContainerEventWarning=Use of DataContainerEvent is deprecated. Use CustomEve
SendAsBinaryWarning=The non-standard sendAsBinary method is deprecated and will soon be removed. Use the standard send(Blob data) method instead.
# LOCALIZATION NOTE: Do not translate "window.controllers"
Window_ControllersWarning=window.controllers is deprecated. Do not use it for UA detection.
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Down" and "ArrowDown".
KeyNameDownWarning=KeyboardEvent.key value "Down" is obsolete and will be renamed to "ArrowDown". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Left" and "ArrowLeft".
KeyNameLeftWarning=KeyboardEvent.key value "Left" is obsolete and will be renamed to "ArrowLeft". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Right" and "ArrowRight".
KeyNameRightWarning=KeyboardEvent.key value "Right" is obsolete and will be renamed to "ArrowRight". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Up" and "ArrowUp".
KeyNameUpWarning=KeyboardEvent.key value "Up" is obsolete and will be renamed to "ArrowUp". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Crsel" and "CrSel".
KeyNameCrselWarning=KeyboardEvent.key value "Crsel" is obsolete and will be renamed to "CrSel". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Del" and "Delete".
KeyNameDelWarning=KeyboardEvent.key value "Del" is obsolete and will be renamed to "Delete". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Exsel" and "ExSel".
KeyNameExselWarning=KeyboardEvent.key value "Exsel" is obsolete and will be renamed to "ExSel". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Menu" and "ContextMenu".
KeyNameMenuWarning=KeyboardEvent.key value "Menu" is obsolete and will be renamed to "ContextMenu". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Esc" and "Escape".
KeyNameEscWarning=KeyboardEvent.key value "Esc" is obsolete and will be renamed to "Escape". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Nonconvert" and "NonConvert".
KeyNameNonconvertWarning=KeyboardEvent.key value "Nonconvert" is obsolete and will be renamed to "NonConvert". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "HalfWidth" and "Hankaku".
KeyNameHalfWidthWarning=KeyboardEvent.key value "HalfWidth" is obsolete and will be renamed to "Hankaku". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "RomanCharacters", "Romaji" and "Eisu".
KeyNameRomanCharactersWarning=KeyboardEvent.key value "RomanCharacters" is obsolete and will be renamed to "Romaji" or remapped to "Eisu". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "FullWith" and "Zenkaku".
KeyNameFullWidthWarning=KeyboardEvent.key value "FullWidth" is obsolete and will be renamed to "Zenkaku". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "SelectMedia" and "MediaSelect".
KeyNameSelectMediaWarning=KeyboardEvent.key value "SelectMedia" is obsolete and will be renamed to "MediaSelect". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "MediaNextTrack" and "MediaTrackNext".
KeyNameMediaNextTrackWarning=KeyboardEvent.key value "MediaNextTrack" is obsolete and will be renamed to "MediaTrackNext". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "MediaPreviousTrack" and "MediaTrackPrevious".
KeyNameMediaPreviousTrackWarning=KeyboardEvent.key value "MediaPreviousTrack" is obsolete and will be renamed to "MediaTrackPrevious". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Red" and "ColorF0Red".
KeyNameRedWarning=KeyboardEvent.key value "Red" is obsolete and will be renamed to "ColorF0Red". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Green" and "ColorF1Green".
KeyNameGreenWarning=KeyboardEvent.key value "Green" is obsolete and will be renamed to "ColorF1Green". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Yellow" and "ColorF2Yellow".
KeyNameYellowWarning=KeyboardEvent.key value "Yellow" is obsolete and will be renamed to "ColorF2Yellow". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Blue" and "ColorF3Blue".
KeyNameBlueWarning=KeyboardEvent.key value "Blue" is obsolete and will be renamed to "ColorF3Blue". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Live".
KeyNameLiveWarning=KeyboardEvent.key value "Live" is obsolete and will be removed. For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Apps".
KeyNameAppsWarning=KeyboardEvent.key value "Apps" is obsolete and will be removed. For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "FastFwd" and "MediaFastForward".
KeyNameFastFwdWarning=KeyboardEvent.key value "FastFwd" is obsolete and will be renamed to "MediaFastForward". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key", "Zoom" and "ZoomToggle".
KeyNameZoomWarning=KeyboardEvent.key value "Zoom" is obsolete and will be renamed to "ZoomToggle". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key
# LOCALIZATION NOTE: Do not translate "KeyboardEvent.key" and "Dead".
KeyNameDeadKeysWarning=KeyboardEvent.key values starting with "Dead" are obsolete and will be merged into just "Dead". For more help https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.key