зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1083067 part.4 Use IMEContext::MaybeEditable() instead of nsGtkIMModule::IsEditable() r=m_kato
This commit is contained in:
Родитель
83a07ac4b6
Коммит
04082d22be
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -251,12 +251,6 @@ protected:
|
|||
// state. So, this means *current* IM context.
|
||||
GtkIMContext* GetContext();
|
||||
|
||||
// "Editable" means the users can input characters. They may be not able to
|
||||
// use IMEs but they can use dead keys.
|
||||
// I.e., the focus is in the normal editors or the password editors or
|
||||
// the |ime-mode: disabled;| editors.
|
||||
bool IsEditable();
|
||||
|
||||
// If the owner window and IM context have been destroyed, returns TRUE.
|
||||
bool IsDestroyed() { return !mOwnerWindow; }
|
||||
|
||||
|
|
|
@ -384,10 +384,21 @@ struct IMEState {
|
|||
{
|
||||
}
|
||||
|
||||
// Returns true if the user can input characters.
|
||||
// This means that a plain text editor, an HTML editor, a password editor or
|
||||
// a plain text editor whose ime-mode is "disabled".
|
||||
bool IsEditable() const
|
||||
{
|
||||
return mEnabled == ENABLED || mEnabled == PASSWORD;
|
||||
}
|
||||
// Returns true if the user might be able to input characters.
|
||||
// This means that a plain text editor, an HTML editor, a password editor,
|
||||
// a plain text editor whose ime-mode is "disabled" or a windowless plugin
|
||||
// has focus.
|
||||
bool MaybeEditable() const
|
||||
{
|
||||
return IsEditable() || mEnabled == PLUGIN;
|
||||
}
|
||||
};
|
||||
|
||||
struct InputContext {
|
||||
|
|
Загрузка…
Ссылка в новой задаче