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
parent 76db5111bb
commit 6cf432407d
2 changed files with 20 additions and 3 deletions

View File

@ -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 */

View File

@ -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()) {