Bug 1748128: Avoid sending 'search' input scope when ATOK is active. r=masayuki

When "search" is set to the input scope, there is a case ATOK stop their
suggestions depending on thire setting. To resolve the issue, we need to avoid
sending "search" input scope when ATOK is active. If using the touch keyboard
for touch screens, this change makes user cannot access some specific features
for a "search" input field. Therefore, we introduce a new pref
`intl.tsf.hack.atok.search_input_scope_disabled`, make user can control this
feature.

Differential Revision: https://phabricator.services.mozilla.com/D136448
This commit is contained in:
Daisuke Akatsuka 2022-01-20 07:54:55 +00:00
Родитель 23875862ae
Коммит 236b747761
5 изменённых файлов: 27 добавлений и 2 удалений

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

@ -2919,6 +2919,13 @@ pref("font.size.monospace.x-math", 13);
// available. Note that this is ignored if active ATOK is or older than
// 2016 and create_native_caret is true.
pref("intl.tsf.hack.atok.do_not_return_no_layout_error_of_composition_string", true);
// Whether disable "search" input scope when the ATOK is active on windows.
// When "search" is set to the input scope, ATOK may stop their suggestions.
// To avoid it, turn this pref on, or changing the settings in ATOK.
// Note that if you enable this pref and you use the touch keyboard for touch
// screens, you cannot access some specific features for a "search" input
// field.
pref("intl.tsf.hack.atok.search_input_scope_disabled", false);
// Whether use available composition string rect for result of
// ITextStoreACP::GetTextExt() even if the specified range is same as or is
// in the range of composition string but some character rects of them are

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

@ -7061,6 +7061,9 @@ bool TSFTextStore::IsGoogleJapaneseInputActive() {
return TSFStaticSink::IsGoogleJapaneseInputActive();
}
// static
bool TSFTextStore::IsATOKActive() { return TSFStaticSink::IsATOKActive(); }
/******************************************************************************
* TSFTextStore::Content
*****************************************************************************/

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

@ -268,6 +268,11 @@ class TSFTextStore final : public ITextStoreACP,
*/
static bool IsGoogleJapaneseInputActive();
/**
* Returns true if active TIP is ATOK.
*/
static bool IsATOKActive();
/**
* Returns true if active TIP or IME is a black listed one and we should
* set input scope of URL bar to IS_DEFAULT rather than IS_URL.

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

@ -661,7 +661,7 @@ void IMEHandler::AppendInputScopeFromInputmode(const nsAString& aInputmode,
return;
}
if (aInputmode.EqualsLiteral("search")) {
if (!aScopes.Contains(IS_SEARCH)) {
if (NeedsSearchInputScope() && !aScopes.Contains(IS_SEARCH)) {
aScopes.AppendElement(IS_SEARCH);
}
return;
@ -677,7 +677,9 @@ void IMEHandler::AppendInputScopeFromType(const nsAString& aHTMLInputType,
return;
}
if (aHTMLInputType.EqualsLiteral("search")) {
aScopes.AppendElement(IS_SEARCH);
if (NeedsSearchInputScope()) {
aScopes.AppendElement(IS_SEARCH);
}
return;
}
if (aHTMLInputType.EqualsLiteral("email")) {
@ -715,6 +717,13 @@ void IMEHandler::AppendInputScopeFromType(const nsAString& aHTMLInputType,
}
}
// static
bool IMEHandler::NeedsSearchInputScope() {
return !(Preferences::GetBool(
"intl.tsf.hack.atok.search_input_scope_disabled", false) &&
TSFTextStore::IsATOKActive());
}
// static
bool IMEHandler::IsOnScreenKeyboardSupported() {
#ifdef NIGHTLY_BUILD

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

@ -221,6 +221,7 @@ class IMEHandler final {
static bool IsInTabletMode();
static bool AutoInvokeOnScreenKeyboardInDesktopMode();
static bool NeedsToAssociateIMC();
static bool NeedsSearchInputScope();
/**
* Show the Windows on-screen keyboard. Only allowed for