зеркало из 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");
|
NS_PRECONDITION(aEvent, "aEvent must be non-null");
|
||||||
|
|
||||||
if (!IsEditable() || MOZ_UNLIKELY(IsDestroyed())) {
|
if (!mInputContext.mIMEState.MaybeEditable() ||
|
||||||
|
MOZ_UNLIKELY(IsDestroyed())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +496,7 @@ nsGtkIMModule::SetInputContext(nsWindow* aCaller,
|
||||||
aContext->mHTMLInputType != mInputContext.mHTMLInputType;
|
aContext->mHTMLInputType != mInputContext.mHTMLInputType;
|
||||||
|
|
||||||
// Release current IME focus if IME is enabled.
|
// Release current IME focus if IME is enabled.
|
||||||
if (changingEnabledState && IsEditable()) {
|
if (changingEnabledState && mInputContext.mIMEState.MaybeEditable()) {
|
||||||
EndIMEComposition(mLastFocusedWindow);
|
EndIMEComposition(mLastFocusedWindow);
|
||||||
Blur();
|
Blur();
|
||||||
}
|
}
|
||||||
|
@ -505,7 +506,7 @@ nsGtkIMModule::SetInputContext(nsWindow* aCaller,
|
||||||
if (changingEnabledState) {
|
if (changingEnabledState) {
|
||||||
#if (MOZ_WIDGET_GTK == 3)
|
#if (MOZ_WIDGET_GTK == 3)
|
||||||
static bool sInputPurposeSupported = !gtk_check_version(3, 6, 0);
|
static bool sInputPurposeSupported = !gtk_check_version(3, 6, 0);
|
||||||
if (sInputPurposeSupported && IsEditable()) {
|
if (sInputPurposeSupported && mInputContext.mIMEState.MaybeEditable()) {
|
||||||
GtkIMContext* context = GetContext();
|
GtkIMContext* context = GetContext();
|
||||||
if (context) {
|
if (context) {
|
||||||
GtkInputPurpose purpose = GTK_INPUT_PURPOSE_FREE_FORM;
|
GtkInputPurpose purpose = GTK_INPUT_PURPOSE_FREE_FORM;
|
||||||
|
@ -602,14 +603,6 @@ nsGtkIMModule::IsEnabled()
|
||||||
mInputContext.mIMEState.mEnabled == IMEState::PASSWORD);
|
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
|
void
|
||||||
nsGtkIMModule::Focus()
|
nsGtkIMModule::Focus()
|
||||||
{
|
{
|
||||||
|
|
|
@ -251,12 +251,6 @@ protected:
|
||||||
// state. So, this means *current* IM context.
|
// state. So, this means *current* IM context.
|
||||||
GtkIMContext* GetContext();
|
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.
|
// If the owner window and IM context have been destroyed, returns TRUE.
|
||||||
bool IsDestroyed() { return !mOwnerWindow; }
|
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
|
bool IsEditable() const
|
||||||
{
|
{
|
||||||
return mEnabled == ENABLED || mEnabled == PASSWORD;
|
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 {
|
struct InputContext {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче