Bug 1083067 part.4 Use IMEContext::MaybeEditable() instead of nsGtkIMModule::IsEditable() r=m_kato

This commit is contained in:
Masayuki Nakano
2014-11-10 18:07:43 +09:00
parent 07f6d63dda
commit 480f575eaf
3 changed files with 15 additions and 17 deletions

View File

@@ -306,7 +306,8 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent,
{
NS_PRECONDITION(aEvent, "aEvent must be non-null");
if (!IsEditable() || MOZ_UNLIKELY(IsDestroyed())) {
if (!mInputContext.mIMEState.MaybeEditable() ||
MOZ_UNLIKELY(IsDestroyed())) {
return false;
}
@@ -495,7 +496,7 @@ nsGtkIMModule::SetInputContext(nsWindow* aCaller,
aContext->mHTMLInputType != mInputContext.mHTMLInputType;
// Release current IME focus if IME is enabled.
if (changingEnabledState && IsEditable()) {
if (changingEnabledState && mInputContext.mIMEState.MaybeEditable()) {
EndIMEComposition(mLastFocusedWindow);
Blur();
}
@@ -505,7 +506,7 @@ nsGtkIMModule::SetInputContext(nsWindow* aCaller,
if (changingEnabledState) {
#if (MOZ_WIDGET_GTK == 3)
static bool sInputPurposeSupported = !gtk_check_version(3, 6, 0);
if (sInputPurposeSupported && IsEditable()) {
if (sInputPurposeSupported && mInputContext.mIMEState.MaybeEditable()) {
GtkIMContext* context = GetContext();
if (context) {
GtkInputPurpose purpose = GTK_INPUT_PURPOSE_FREE_FORM;
@@ -602,14 +603,6 @@ nsGtkIMModule::IsEnabled()
mInputContext.mIMEState.mEnabled == IMEState::PASSWORD);
}
bool
nsGtkIMModule::IsEditable()
{
return mInputContext.mIMEState.mEnabled == IMEState::ENABLED ||
mInputContext.mIMEState.mEnabled == IMEState::PLUGIN ||
mInputContext.mIMEState.mEnabled == IMEState::PASSWORD;
}
void
nsGtkIMModule::Focus()
{