Bug 1254755 part.4 Rename WidgetKeyboardEvent::location to WidgetKeyboardEvent::mLocation r?smaug
MozReview-Commit-ID: CjT7izri6Vq
--- a/dom/base/TextInputProcessor.cpp
+++ b/dom/base/TextInputProcessor.cpp
@@ -733,23 +733,23 @@ TextInputProcessor::PrepareKeyboardEvent
aKeyboardEvent.mKeyNameIndex != KEY_NAME_INDEX_USE_STRING) {
aKeyboardEvent.GetDOMKeyName(aKeyboardEvent.mKeyValue);
aKeyboardEvent.mKeyNameIndex = KEY_NAME_INDEX_USE_STRING;
}
if (aKeyFlags & KEY_KEEP_KEY_LOCATION_STANDARD) {
// If .location is initialized with specific value, using
// KEY_KEEP_KEY_LOCATION_STANDARD must be a bug of the caller.
// Let's throw an exception for notifying the developer of this bug.
- if (NS_WARN_IF(aKeyboardEvent.location)) {
+ if (NS_WARN_IF(aKeyboardEvent.mLocation)) {
return NS_ERROR_INVALID_ARG;
}
- } else if (!aKeyboardEvent.location) {
- // If KeyboardEvent.location is 0, it may be uninitialized. If so, we
- // should compute proper location value from its .code value.
- aKeyboardEvent.location =
+ } else if (!aKeyboardEvent.mLocation) {
+ // If KeyboardEvent.mLocation is 0, it may be uninitialized. If so, we
+ // should compute proper mLocation value from its .code value.
+ aKeyboardEvent.mLocation =
WidgetKeyboardEvent::ComputeLocationFromCodeValue(
aKeyboardEvent.mCodeNameIndex);
}
if (aKeyFlags & KEY_KEEP_KEYCODE_ZERO) {
// If .keyCode is initialized with specific value, using
// KEY_KEEP_KEYCODE_ZERO must be a bug of the caller. Let's throw an
// exception for notifying the developer of such bug.
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7680,26 +7680,26 @@ nsContentUtils::SendKeyEvent(nsIWidget*
event.mCharCode = 0;
}
uint32_t locationFlag = (aAdditionalFlags &
(nsIDOMWindowUtils::KEY_FLAG_LOCATION_STANDARD | nsIDOMWindowUtils::KEY_FLAG_LOCATION_LEFT |
nsIDOMWindowUtils::KEY_FLAG_LOCATION_RIGHT | nsIDOMWindowUtils::KEY_FLAG_LOCATION_NUMPAD));
switch (locationFlag) {
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_STANDARD:
- event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
+ event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
break;
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_LEFT:
- event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
+ event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
break;
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_RIGHT:
- event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
+ event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
break;
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_NUMPAD:
- event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+ event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
break;
default:
if (locationFlag != 0) {
return NS_ERROR_INVALID_ARG;
}
// If location flag isn't set, choose the location from keycode.
switch (aKeyCode) {
case nsIDOMKeyEvent::DOM_VK_NUMPAD0:
@@ -7713,26 +7713,26 @@ nsContentUtils::SendKeyEvent(nsIWidget*
case nsIDOMKeyEvent::DOM_VK_NUMPAD8:
case nsIDOMKeyEvent::DOM_VK_NUMPAD9:
case nsIDOMKeyEvent::DOM_VK_MULTIPLY:
case nsIDOMKeyEvent::DOM_VK_ADD:
case nsIDOMKeyEvent::DOM_VK_SEPARATOR:
case nsIDOMKeyEvent::DOM_VK_SUBTRACT:
case nsIDOMKeyEvent::DOM_VK_DECIMAL:
case nsIDOMKeyEvent::DOM_VK_DIVIDE:
- event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+ event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
break;
case nsIDOMKeyEvent::DOM_VK_SHIFT:
case nsIDOMKeyEvent::DOM_VK_CONTROL:
case nsIDOMKeyEvent::DOM_VK_ALT:
case nsIDOMKeyEvent::DOM_VK_META:
- event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
+ event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
break;
default:
- event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
+ event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
break;
}
break;
}
event.mRefPoint = LayoutDeviceIntPoint(0, 0);
event.mTime = PR_IntervalNow();
if (!(aAdditionalFlags & nsIDOMWindowUtils::KEY_FLAG_NOT_SYNTHESIZED_FOR_TESTS)) {
--- a/dom/events/KeyboardEvent.cpp
+++ b/dom/events/KeyboardEvent.cpp
@@ -270,17 +270,17 @@ KeyboardEvent::GetLocation(uint32_t* aLo
*aLocation = Location();
return NS_OK;
}
uint32_t
KeyboardEvent::Location()
{
- return mEvent->AsKeyboardEvent()->location;
+ return mEvent->AsKeyboardEvent()->mLocation;
}
// static
already_AddRefed<KeyboardEvent>
KeyboardEvent::Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const KeyboardEventInit& aParam,
ErrorResult& aRv)
@@ -305,17 +305,17 @@ KeyboardEvent::InitWithKeyboardEventInit
aParam.mKeyCode, aParam.mCharCode);
InitModifiers(aParam);
SetTrusted(trusted);
mDetail = aParam.mDetail;
mInitializedByCtor = true;
mInitializedWhichValue = aParam.mWhich;
WidgetKeyboardEvent* internalEvent = mEvent->AsKeyboardEvent();
- internalEvent->location = aParam.mLocation;
+ internalEvent->mLocation = aParam.mLocation;
internalEvent->mIsRepeat = aParam.mRepeat;
internalEvent->mIsComposing = aParam.mIsComposing;
internalEvent->mKeyNameIndex =
WidgetKeyboardEvent::GetKeyNameIndex(aParam.mKey);
if (internalEvent->mKeyNameIndex == KEY_NAME_INDEX_USE_STRING) {
internalEvent->mKeyValue = aParam.mKey;
}
internalEvent->mCodeNameIndex =
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -508,18 +508,18 @@ TextEventDispatcher::DispatchKeyboardEve
if (listener) {
DebugOnly<WidgetKeyboardEvent> original(keyEvent);
listener->WillDispatchKeyboardEvent(this, keyEvent, aIndexOfKeypress,
aData);
MOZ_ASSERT(keyEvent.mMessage ==
static_cast<WidgetKeyboardEvent&>(original).mMessage);
MOZ_ASSERT(keyEvent.mKeyCode ==
static_cast<WidgetKeyboardEvent&>(original).mKeyCode);
- MOZ_ASSERT(keyEvent.location ==
- static_cast<WidgetKeyboardEvent&>(original).location);
+ MOZ_ASSERT(keyEvent.mLocation ==
+ static_cast<WidgetKeyboardEvent&>(original).mLocation);
MOZ_ASSERT(keyEvent.mIsRepeat ==
static_cast<WidgetKeyboardEvent&>(original).mIsRepeat);
MOZ_ASSERT(keyEvent.mIsComposing ==
static_cast<WidgetKeyboardEvent&>(original).mIsComposing);
MOZ_ASSERT(keyEvent.mKeyNameIndex ==
static_cast<WidgetKeyboardEvent&>(original).mKeyNameIndex);
MOZ_ASSERT(keyEvent.mCodeNameIndex ==
static_cast<WidgetKeyboardEvent&>(original).mCodeNameIndex);
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -100,17 +100,17 @@ private:
friend class dom::PBrowserParent;
friend class dom::PBrowserChild;
protected:
WidgetKeyboardEvent()
: mKeyCode(0)
, mCharCode(0)
, mPseudoCharCode(0)
- , location(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD)
+ , mLocation(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD)
, isChar(false)
, mIsRepeat(false)
, mIsComposing(false)
, mIsReserved(false)
, mAccessKeyForwardedToChild(false)
, mKeyNameIndex(mozilla::KEY_NAME_INDEX_Unidentified)
, mCodeNameIndex(CODE_NAME_INDEX_UNKNOWN)
, mNativeKeyEvent(nullptr)
@@ -129,17 +129,17 @@ public:
WidgetKeyboardEvent(bool aIsTrusted, EventMessage aMessage,
nsIWidget* aWidget,
EventClassID aEventClassID = eKeyboardEventClass)
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
, mKeyCode(0)
, mCharCode(0)
, mPseudoCharCode(0)
- , location(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD)
+ , mLocation(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD)
, isChar(false)
, mIsRepeat(false)
, mIsComposing(false)
, mIsReserved(false)
, mAccessKeyForwardedToChild(false)
, mKeyNameIndex(mozilla::KEY_NAME_INDEX_Unidentified)
, mCodeNameIndex(CODE_NAME_INDEX_UNKNOWN)
, mNativeKeyEvent(nullptr)
@@ -201,17 +201,17 @@ public:
// character when some modifiers are active. Then, this value should be an
// unmodified value except Shift and AltGr.
uint32_t mCharCode;
// mPseudoCharCode is valid only when mMessage is an eKeyDown event.
// This stores mCharCode value of keypress event which is fired with same
// key value and same modifier state.
uint32_t mPseudoCharCode;
// One of nsIDOMKeyEvent::DOM_KEY_LOCATION_*
- uint32_t location;
+ uint32_t mLocation;
// OS translated Unicode chars which are used for accesskey and accelkey
// handling. The handlers will try from first character to last character.
nsTArray<AlternativeCharCode> mAlternativeCharCodes;
// Indicates whether the event signifies a printable character
bool isChar;
// Indicates whether the event is generated by auto repeat or not.
// if this is keyup event, always false.
bool mIsRepeat;
@@ -327,17 +327,17 @@ public:
* @param aCandidates [out] the candidate access key list.
* the first item is most preferred.
*/
void GetAccessKeyCandidates(nsTArray<uint32_t>& aCandidates);
static void Shutdown();
/**
- * ComputeLocationFromCodeValue() returns one of .location value
+ * ComputeLocationFromCodeValue() returns one of .mLocation value
* (nsIDOMKeyEvent::DOM_KEY_LOCATION_*) which is the most preferred value
* for the specified specified code value.
*/
static uint32_t ComputeLocationFromCodeValue(CodeNameIndex aCodeNameIndex);
/**
* ComputeKeyCodeFromKeyNameIndex() return a .mKeyCode value which can be
* mapped from the specified key value. Note that this returns 0 if the
@@ -370,17 +370,17 @@ public:
void AssignKeyEventData(const WidgetKeyboardEvent& aEvent, bool aCopyTargets)
{
AssignInputEventData(aEvent, aCopyTargets);
mKeyCode = aEvent.mKeyCode;
mCharCode = aEvent.mCharCode;
mPseudoCharCode = aEvent.mPseudoCharCode;
- location = aEvent.location;
+ mLocation = aEvent.mLocation;
mAlternativeCharCodes = aEvent.mAlternativeCharCodes;
isChar = aEvent.isChar;
mIsRepeat = aEvent.mIsRepeat;
mIsComposing = aEvent.mIsComposing;
mIsReserved = aEvent.mIsReserved;
mAccessKeyForwardedToChild = aEvent.mAccessKeyForwardedToChild;
mKeyNameIndex = aEvent.mKeyNameIndex;
mCodeNameIndex = aEvent.mCodeNameIndex;
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -2507,17 +2507,17 @@ InitKeyEvent(WidgetKeyboardEvent& event,
keyCode, action, domPrintableKeyValue);
event.mCodeNameIndex = ConvertAndroidScanCodeToCodeNameIndex(scanCode);
if (event.mKeyNameIndex == KEY_NAME_INDEX_USE_STRING &&
domPrintableKeyValue) {
event.mKeyValue = char16_t(domPrintableKeyValue);
}
- event.location =
+ event.mLocation =
WidgetKeyboardEvent::ComputeLocationFromCodeValue(event.mCodeNameIndex);
event.mTime = time;
}
void
nsWindow::GeckoViewSupport::OnKeyEvent(int32_t aAction, int32_t aKeyCode,
int32_t aScanCode, int32_t aMetaState, int64_t aTime,
int32_t aUnicodeChar, int32_t aBaseUnicodeChar,
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -922,24 +922,24 @@ TISInputSourceWrapper::InitKeyEvent(NSEv
aKeyEvent.mKeyCode =
ComputeGeckoKeyCode(nativeKeyCode, kbType, aKeyEvent.IsMeta());
switch (nativeKeyCode) {
case kVK_Command:
case kVK_Shift:
case kVK_Option:
case kVK_Control:
- aKeyEvent.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
+ aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
break;
case kVK_RightCommand:
case kVK_RightShift:
case kVK_RightOption:
case kVK_RightControl:
- aKeyEvent.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
+ aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
break;
case kVK_ANSI_Keypad0:
case kVK_ANSI_Keypad1:
case kVK_ANSI_Keypad2:
case kVK_ANSI_Keypad3:
case kVK_ANSI_Keypad4:
case kVK_ANSI_Keypad5:
@@ -951,21 +951,21 @@ TISInputSourceWrapper::InitKeyEvent(NSEv
case kVK_ANSI_KeypadPlus:
case kVK_ANSI_KeypadMinus:
case kVK_ANSI_KeypadDecimal:
case kVK_ANSI_KeypadDivide:
case kVK_ANSI_KeypadEquals:
case kVK_ANSI_KeypadEnter:
case kVK_JIS_KeypadComma:
case kVK_Powerbook_KeypadEnter:
- aKeyEvent.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+ aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
break;
default:
- aKeyEvent.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
+ aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
break;
}
aKeyEvent.mIsRepeat =
([aNativeKeyEvent type] == NSKeyDown) ? [aNativeKeyEvent isARepeat] : false;
MOZ_LOG(gLog, LogLevel::Info,
("%p TISInputSourceWrapper::InitKeyEvent, "
--- a/widget/gonk/nsAppShell.cpp
+++ b/widget/gonk/nsAppShell.cpp
@@ -309,17 +309,17 @@ KeyEventDispatcher::DispatchKeyEventInte
event.isChar = !!event.mCharCode;
event.mIsRepeat = IsRepeat();
event.mKeyNameIndex = mDOMKeyNameIndex;
if (mDOMPrintableKeyValue) {
event.mKeyValue = mDOMPrintableKeyValue;
}
event.mCodeNameIndex = mDOMCodeNameIndex;
event.mModifiers = getDOMModifiers(mData.metaState);
- event.location = mDOMKeyLocation;
+ event.mLocation = mDOMKeyLocation;
event.mTime = mData.timeMs;
return nsWindow::DispatchKeyInput(event);
}
void
KeyEventDispatcher::Dispatch()
{
// XXX Even if unknown key is pressed, DOM key event should be
--- a/widget/gtk/nsGtkKeyUtils.cpp
+++ b/widget/gtk/nsGtkKeyUtils.cpp
@@ -917,26 +917,26 @@ KeymapWrapper::InitKeyEvent(WidgetKeyboa
switch (aGdkKeyEvent->keyval) {
case GDK_Shift_L:
case GDK_Control_L:
case GDK_Alt_L:
case GDK_Super_L:
case GDK_Hyper_L:
case GDK_Meta_L:
- aKeyEvent.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
+ aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
break;
case GDK_Shift_R:
case GDK_Control_R:
case GDK_Alt_R:
case GDK_Super_R:
case GDK_Hyper_R:
case GDK_Meta_R:
- aKeyEvent.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
+ aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
break;
case GDK_KP_0:
case GDK_KP_1:
case GDK_KP_2:
case GDK_KP_3:
case GDK_KP_4:
case GDK_KP_5:
@@ -964,21 +964,21 @@ KeymapWrapper::InitKeyEvent(WidgetKeyboa
case GDK_KP_Delete:
case GDK_KP_Equal:
case GDK_KP_Multiply:
case GDK_KP_Add:
case GDK_KP_Separator:
case GDK_KP_Subtract:
case GDK_KP_Decimal:
case GDK_KP_Divide:
- aKeyEvent.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+ aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
break;
default:
- aKeyEvent.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
+ aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
break;
}
MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
("KeymapWrapper(%p): InitKeyEvent, modifierState=0x%08X "
"aGdkKeyEvent={ type=%s, keyval=%s(0x%X), state=0x%08X, "
"hardware_keycode=0x%08X, is_modifier=%s } "
"aKeyEvent={ message=%s, isShift=%s, isControl=%s, "
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -397,17 +397,17 @@ struct ParamTraits<mozilla::WidgetKeyboa
WriteParam(aMsg, aParam.mKeyCode);
WriteParam(aMsg, aParam.mCharCode);
WriteParam(aMsg, aParam.mPseudoCharCode);
WriteParam(aMsg, aParam.mAlternativeCharCodes);
WriteParam(aMsg, aParam.isChar);
WriteParam(aMsg, aParam.mIsRepeat);
WriteParam(aMsg, aParam.mIsReserved);
WriteParam(aMsg, aParam.mAccessKeyForwardedToChild);
- WriteParam(aMsg, aParam.location);
+ WriteParam(aMsg, aParam.mLocation);
WriteParam(aMsg, aParam.mUniqueId);
WriteParam(aMsg, aParam.mIsSynthesizedByTIP);
WriteParam(aMsg,
static_cast<mozilla::WidgetKeyboardEvent::InputMethodAppStateType>
(aParam.mInputMethodAppState));
#ifdef XP_MACOSX
WriteParam(aMsg, aParam.mNativeKeyCode);
WriteParam(aMsg, aParam.mNativeModifierFlags);
@@ -433,17 +433,17 @@ struct ParamTraits<mozilla::WidgetKeyboa
ReadParam(aMsg, aIter, &aResult->mKeyCode) &&
ReadParam(aMsg, aIter, &aResult->mCharCode) &&
ReadParam(aMsg, aIter, &aResult->mPseudoCharCode) &&
ReadParam(aMsg, aIter, &aResult->mAlternativeCharCodes) &&
ReadParam(aMsg, aIter, &aResult->isChar) &&
ReadParam(aMsg, aIter, &aResult->mIsRepeat) &&
ReadParam(aMsg, aIter, &aResult->mIsReserved) &&
ReadParam(aMsg, aIter, &aResult->mAccessKeyForwardedToChild) &&
- ReadParam(aMsg, aIter, &aResult->location) &&
+ ReadParam(aMsg, aIter, &aResult->mLocation) &&
ReadParam(aMsg, aIter, &aResult->mUniqueId) &&
ReadParam(aMsg, aIter, &aResult->mIsSynthesizedByTIP) &&
ReadParam(aMsg, aIter, &inputMethodAppState)
#ifdef XP_MACOSX
&& ReadParam(aMsg, aIter, &aResult->mNativeKeyCode)
&& ReadParam(aMsg, aIter, &aResult->mNativeModifierFlags)
&& ReadParam(aMsg, aIter, &aResult->mNativeCharacters)
&& ReadParam(aMsg, aIter, &aResult->mNativeCharactersIgnoringModifiers)
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -1263,17 +1263,17 @@ NativeKey::InitKeyEvent(WidgetKeyboardEv
aKeyEvent.mIsRepeat = IsRepeat();
aKeyEvent.mKeyNameIndex = mKeyNameIndex;
if (mKeyNameIndex == KEY_NAME_INDEX_USE_STRING) {
aKeyEvent.mKeyValue = mCommittedCharsAndModifiers.ToString();
}
aKeyEvent.mCodeNameIndex = mCodeNameIndex;
MOZ_ASSERT(mCodeNameIndex != CODE_NAME_INDEX_USE_STRING);
- aKeyEvent.location = GetKeyLocation();
+ aKeyEvent.mLocation = GetKeyLocation();
aModKeyState.InitInputEvent(aKeyEvent);
NPEvent pluginEvent;
if (aMsgSentToPlugin &&
mWidget->GetInputContext().mIMEState.mEnabled == IMEState::PLUGIN) {
pluginEvent.event = aMsgSentToPlugin->message;
pluginEvent.wParam = aMsgSentToPlugin->wParam;
pluginEvent.lParam = aMsgSentToPlugin->lParam;