mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 11:01:40 +00:00
Bug 912858 part.1 WidgetKeyboardEvent should be able to store .key value as string if the key name isn't one of pre-defined key names r=smaug
This commit is contained in:
parent
47e89f5bad
commit
377b8b8c96
@ -107,6 +107,8 @@ public:
|
||||
bool mIsRepeat;
|
||||
// DOM KeyboardEvent.key
|
||||
KeyNameIndex mKeyNameIndex;
|
||||
// DOM KeyboardEvent.key only when mKeyNameIndex is KEY_NAME_INDEX_USE_STRING.
|
||||
nsString mKeyValue;
|
||||
// OS-specific native event can optionally be preserved
|
||||
void* mNativeKeyEvent;
|
||||
// Unique id associated with a keydown / keypress event. Used in identifing
|
||||
@ -117,6 +119,10 @@ public:
|
||||
|
||||
void GetDOMKeyName(nsAString& aKeyName)
|
||||
{
|
||||
if (mKeyNameIndex == KEY_NAME_INDEX_USE_STRING) {
|
||||
aKeyName = mKeyValue;
|
||||
return;
|
||||
}
|
||||
GetDOMKeyName(mKeyNameIndex, aKeyName);
|
||||
}
|
||||
|
||||
@ -147,6 +153,7 @@ public:
|
||||
isChar = aEvent.isChar;
|
||||
mIsRepeat = aEvent.mIsRepeat;
|
||||
mKeyNameIndex = aEvent.mKeyNameIndex;
|
||||
mKeyValue = aEvent.mKeyValue;
|
||||
// Don't copy mNativeKeyEvent because it may be referred after its instance
|
||||
// is destroyed.
|
||||
mNativeKeyEvent = nullptr;
|
||||
|
@ -297,6 +297,7 @@ struct ParamTraits<mozilla::WidgetKeyboardEvent>
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetInputEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<uint32_t>(aParam.mKeyNameIndex));
|
||||
WriteParam(aMsg, aParam.mKeyValue);
|
||||
WriteParam(aMsg, aParam.keyCode);
|
||||
WriteParam(aMsg, aParam.charCode);
|
||||
WriteParam(aMsg, aParam.isChar);
|
||||
@ -313,6 +314,7 @@ struct ParamTraits<mozilla::WidgetKeyboardEvent>
|
||||
if (ReadParam(aMsg, aIter,
|
||||
static_cast<mozilla::WidgetInputEvent*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter, &keyNameIndex) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mKeyValue) &&
|
||||
ReadParam(aMsg, aIter, &aResult->keyCode) &&
|
||||
ReadParam(aMsg, aIter, &aResult->charCode) &&
|
||||
ReadParam(aMsg, aIter, &aResult->isChar) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user