Bug 891316 part.8 Refactor other nsIMM32Handler::On*() r=jimm

This commit is contained in:
Masayuki Nakano 2013-07-18 17:12:31 +09:00
Родитель d7330fa349
Коммит 0e0d6169b5
2 изменённых файлов: 27 добавлений и 21 удалений

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

@ -246,8 +246,7 @@ nsIMM32Handler::ProcessInputLangChangeMessage(nsWindow* aWindow,
aResult.mConsumed = false;
// We don't need to create the instance of the handler here.
if (gIMM32Handler) {
aResult.mConsumed =
gIMM32Handler->OnInputLangChange(aWindow, wParam, lParam);
gIMM32Handler->OnInputLangChange(aWindow, wParam, lParam, aResult);
}
InitKeyboardLayout(reinterpret_cast<HKL>(lParam));
// We can release the instance here, because the instance may be never
@ -316,11 +315,7 @@ nsIMM32Handler::ProcessMessage(nsWindow* aWindow, UINT msg,
if (!gIMM32Handler) {
return false;
}
aResult.mConsumed = gIMM32Handler->OnChar(aWindow, wParam, lParam);
// If we consume this message, we should return "processed", otherwise,
// the message should be handled on nsWindow, so, we should return
// "not processed" at that time.
return aResult.mConsumed;
return gIMM32Handler->OnChar(aWindow, wParam, lParam, aResult);
default:
return false;
};
@ -359,9 +354,7 @@ nsIMM32Handler::ProcessMessageForPlugin(nsWindow* aWindow, UINT msg,
if (!gIMM32Handler) {
return false;
}
aResult.mConsumed =
gIMM32Handler->OnCharOnPlugin(aWindow, wParam, lParam);
return false; // is going to be handled by nsWindow.
return gIMM32Handler->OnCharOnPlugin(aWindow, wParam, lParam, aResult);
case WM_IME_COMPOSITIONFULL:
case WM_IME_CONTROL:
case WM_IME_KEYDOWN:
@ -379,10 +372,11 @@ nsIMM32Handler::ProcessMessageForPlugin(nsWindow* aWindow, UINT msg,
* message handlers
****************************************************************************/
bool
void
nsIMM32Handler::OnInputLangChange(nsWindow* aWindow,
WPARAM wParam,
LPARAM lParam)
LPARAM lParam,
MSGResult& aResult)
{
PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
("IMM32: OnInputLangChange, hWnd=%08x, wParam=%08x, lParam=%08x\n",
@ -395,7 +389,7 @@ nsIMM32Handler::OnInputLangChange(nsWindow* aWindow,
HandleEndComposition(aWindow);
}
return false;
aResult.mConsumed = false;
}
bool
@ -718,10 +712,15 @@ nsIMM32Handler::OnIMESetContext(nsWindow* aWindow,
bool
nsIMM32Handler::OnChar(nsWindow* aWindow,
WPARAM wParam,
LPARAM lParam)
LPARAM lParam,
MSGResult& aResult)
{
// The return value must be same as aResult.mConsumed because only when we
// consume the message, the caller shouldn't do anything anymore but
// otherwise, the caller should handle the message.
aResult.mConsumed = false;
if (IsIMECharRecordsEmpty()) {
return false;
return aResult.mConsumed;
}
WPARAM recWParam;
LPARAM recLParam;
@ -736,12 +735,13 @@ nsIMM32Handler::OnChar(nsWindow* aWindow,
// of course, this shouldn't happen.
if (recWParam != wParam || recLParam != lParam) {
ResetIMECharRecords();
return false;
return aResult.mConsumed;
}
// Eat the char message which is caused by WM_IME_CHAR because we should
// have processed the IME messages, so, this message could be come from
// a windowless plug-in.
return true;
aResult.mConsumed = true;
return aResult.mConsumed;
}
/****************************************************************************
@ -877,8 +877,11 @@ nsIMM32Handler::OnIMESetContextOnPlugin(nsWindow* aWindow,
bool
nsIMM32Handler::OnCharOnPlugin(nsWindow* aWindow,
WPARAM wParam,
LPARAM lParam)
LPARAM lParam,
MSGResult& aResult)
{
// We should never consume char message on windowless plugin.
aResult.mConsumed = false;
if (IsIMECharRecordsEmpty()) {
return false;
}

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

@ -192,9 +192,12 @@ protected:
MSGResult& aResult);
bool OnIMECharOnPlugin(nsWindow* aWindow, WPARAM wParam, LPARAM lParam,
MSGResult& aResult);
bool OnChar(nsWindow* aWindow, WPARAM wParam, LPARAM lParam);
bool OnCharOnPlugin(nsWindow* aWindow, WPARAM wParam, LPARAM lParam);
bool OnInputLangChange(nsWindow* aWindow, WPARAM wParam, LPARAM lParam);
bool OnChar(nsWindow* aWindow, WPARAM wParam, LPARAM lParam,
MSGResult& aResult);
bool OnCharOnPlugin(nsWindow* aWindow, WPARAM wParam, LPARAM lParam,
MSGResult& aResult);
void OnInputLangChange(nsWindow* aWindow, WPARAM wParam, LPARAM lParam,
MSGResult& aResult);
// These message handlers don't use instance members, we should not create
// the instance by the messages. So, they should be static.