Bug 855975 part.15 Use widget::NativeKey::mCommittedCharsAndModifiers directly in the methods of widget::NativeKey r=jimm

This commit is contained in:
Masayuki Nakano 2013-05-29 15:34:48 +09:00
Родитель 9b75f6917d
Коммит 60c98c8f62
3 изменённых файлов: 16 добавлений и 28 удалений

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

@ -1000,7 +1000,6 @@ NativeKey::RemoveMessageAndDispatchPluginEvent(UINT aFirstMsg,
bool
NativeKey::DispatchKeyPressEventsAndDiscardsCharMessages(
const UniCharsAndModifiers& aInputtingChars,
const EventFlags& aExtraFlags) const
{
MOZ_ASSERT(mMsg.message == WM_KEYDOWN || mMsg.message == WM_SYSKEYDOWN);
@ -1033,12 +1032,11 @@ NativeKey::DispatchKeyPressEventsAndDiscardsCharMessages(
RemoveMessageAndDispatchPluginEvent(WM_CHAR, WM_CHAR);
}
return DispatchKeyPressEventsWithKeyboardLayout(aInputtingChars, aExtraFlags);
return DispatchKeyPressEventsWithKeyboardLayout(aExtraFlags);
}
bool
NativeKey::DispatchKeyPressEventsWithKeyboardLayout(
const UniCharsAndModifiers& aInputtingChars,
const EventFlags& aExtraFlags) const
{
MOZ_ASSERT(mMsg.message == WM_KEYDOWN || mMsg.message == WM_SYSKEYDOWN);
@ -1046,7 +1044,7 @@ NativeKey::DispatchKeyPressEventsWithKeyboardLayout(
KeyboardLayout* keyboardLayout = KeyboardLayout::GetInstance();
UniCharsAndModifiers inputtingChars(aInputtingChars);
UniCharsAndModifiers inputtingChars(mCommittedCharsAndModifiers);
UniCharsAndModifiers shiftedChars;
UniCharsAndModifiers unshiftedChars;
uint32_t shiftedLatinChar = 0;
@ -1203,7 +1201,6 @@ NativeKey::DispatchKeyPressEventsWithKeyboardLayout(
bool
NativeKey::DispatchKeyPressEventForFollowingCharMessage(
const UniCharsAndModifiers& aInputtingChars,
const EventFlags& aExtraFlags) const
{
MOZ_ASSERT(mMsg.message == WM_KEYDOWN || mMsg.message == WM_SYSKEYDOWN);
@ -1216,17 +1213,20 @@ NativeKey::DispatchKeyPressEventForFollowingCharMessage(
#ifdef DEBUG
if (IsPrintableKey()) {
nsPrintfCString log(
"mOriginalVirtualKeyCode=0x%02X, aInputtingChars={ mChars=[ 0x%04X, "
"0x%04X, 0x%04X, 0x%04X, 0x%04X ], mLength=%d }, wParam=0x%04X",
mOriginalVirtualKeyCode, aInputtingChars.mChars[0],
aInputtingChars.mChars[1], aInputtingChars.mChars[2],
aInputtingChars.mChars[3], aInputtingChars.mChars[4],
aInputtingChars.mLength, msg.wParam);
if (aInputtingChars.IsEmpty()) {
"mOriginalVirtualKeyCode=0x%02X, mCommittedCharsAndModifiers={ "
"mChars=[ 0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X ], mLength=%d }, "
"wParam=0x%04X",
mOriginalVirtualKeyCode, mCommittedCharsAndModifiers.mChars[0],
mCommittedCharsAndModifiers.mChars[1],
mCommittedCharsAndModifiers.mChars[2],
mCommittedCharsAndModifiers.mChars[3],
mCommittedCharsAndModifiers.mChars[4],
mCommittedCharsAndModifiers.mLength, msg.wParam);
if (mCommittedCharsAndModifiers.IsEmpty()) {
log.Insert("length is zero: ", 0);
NS_ERROR(log.get());
NS_ABORT();
} else if (aInputtingChars.mChars[0] != msg.wParam) {
} else if (mCommittedCharsAndModifiers.mChars[0] != msg.wParam) {
log.Insert("character mismatch: ", 0);
NS_ERROR(log.get());
NS_ABORT();

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

@ -288,10 +288,6 @@ public:
uint32_t GetDOMKeyCode() const { return mDOMKeyCode; }
KeyNameIndex GetKeyNameIndex() const { return mKeyNameIndex; }
const UniCharsAndModifiers& GetCommittedCharsAndModifiers() const
{
return mCommittedCharsAndModifiers;
}
UINT GetMessage() const { return mMsg.message; }
bool IsKeyDownMessage() const
@ -353,7 +349,6 @@ public:
* with the information provided by KeyboardLayout class.
*/
bool DispatchKeyPressEventsWithKeyboardLayout(
const UniCharsAndModifiers& aInputtingChars,
const EventFlags& aExtraFlags) const;
/**
@ -363,7 +358,6 @@ public:
* false.
*/
bool DispatchKeyPressEventsAndDiscardsCharMessages(
const UniCharsAndModifiers& aInputtingChars,
const EventFlags& aExtraFlags) const;
/**
@ -372,7 +366,6 @@ public:
* Returns true if the event is consumed. Otherwise, false.
*/
bool DispatchKeyPressEventForFollowingCharMessage(
const UniCharsAndModifiers& aInputtingChars,
const EventFlags& aExtraFlags) const;
/**

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

@ -6359,8 +6359,6 @@ LRESULT nsWindow::OnKeyDown(const MSG &aMsg,
{
KeyboardLayout* keyboardLayout = KeyboardLayout::GetInstance();
NativeKey nativeKey(this, aMsg, aModKeyState, aFakeCharMessage);
UniCharsAndModifiers inputtingChars =
nativeKey.GetCommittedCharsAndModifiers();
uint32_t DOMKeyCode = nativeKey.GetDOMKeyCode();
static bool sRedirectedKeyDownEventPreventedDefault = false;
@ -6452,14 +6450,12 @@ LRESULT nsWindow::OnKeyDown(const MSG &aMsg,
extraFlags.mDefaultPrevented = noDefault;
if (nativeKey.NeedsToHandleWithoutFollowingCharMessages()) {
return nativeKey.DispatchKeyPressEventsAndDiscardsCharMessages(
inputtingChars, extraFlags);
return nativeKey.DispatchKeyPressEventsAndDiscardsCharMessages(extraFlags);
}
if (nativeKey.IsFollowedByCharMessage()) {
return static_cast<LRESULT>(
nativeKey.DispatchKeyPressEventForFollowingCharMessage(inputtingChars,
extraFlags));
nativeKey.DispatchKeyPressEventForFollowingCharMessage(extraFlags));
}
if (!aModKeyState.IsControl() && !aModKeyState.IsAlt() &&
@ -6475,8 +6471,7 @@ LRESULT nsWindow::OnKeyDown(const MSG &aMsg,
}
return static_cast<LRESULT>(
nativeKey.DispatchKeyPressEventsWithKeyboardLayout(inputtingChars,
extraFlags));
nativeKey.DispatchKeyPressEventsWithKeyboardLayout(extraFlags));
}
void