Bug 1729402 - Changing inputmode might not set input-purpose on GTK. r=masayuki

I have to consider that we have to set input-purpose even if inputmode only
is changed.

Differential Revision: https://phabricator.services.mozilla.com/D125209
This commit is contained in:
Makoto Kato 2021-09-14 14:35:17 +00:00
Родитель 76db5111bb
Коммит 6cf432407d
2 изменённых файлов: 20 добавлений и 3 удалений

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

@ -410,6 +410,25 @@ struct InputContext final {
!mHTMLInputType.EqualsLiteral("email");
}
bool IsInputAttributeChanged(const InputContext& aOldContext) const {
return mIMEState.mEnabled != aOldContext.mIMEState.mEnabled ||
#if defined(ANDROID) || defined(MOZ_WIDGET_GTK) || defined(XP_WIN)
// input type and inputmode are supported by Windows IME API, GTK
// IME API and Android IME API
mHTMLInputType != aOldContext.mHTMLInputType ||
mHTMLInputInputmode != aOldContext.mHTMLInputInputmode ||
#endif
#if defined(ANDROID) || defined(MOZ_WIDGET_GTK)
// autocapitalize is supported by Android IME API and GTK IME API
mAutocapitalize != aOldContext.mAutocapitalize ||
#endif
#if defined(ANDROID)
// enterkeyhint is only supported by Android IME API.
mActionHint != aOldContext.mActionHint ||
#endif
false;
}
IMEState mIMEState;
/* The type of the input if the input is a html input field */

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

@ -1275,9 +1275,7 @@ void IMContextWrapper::SetInputContext(nsWindow* aCaller,
return;
}
bool changingEnabledState =
aContext->mIMEState.mEnabled != mInputContext.mIMEState.mEnabled ||
aContext->mHTMLInputType != mInputContext.mHTMLInputType;
bool changingEnabledState = aContext->IsInputAttributeChanged(mInputContext);
// Release current IME focus if IME is enabled.
if (changingEnabledState && mInputContext.mIMEState.IsEditable()) {