зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1618759 - Part 6. Don't open on-screen keyboard when inputmode is none. r=masayuki
`inputmode=none` means that OSK is closed. `SetInputContext` doesn't call `DismissOnScreenKeyboard` directly since `DismissOnScreenKeyboard` has no hack of Firefox VR. Depends on D68316 Differential Revision: https://phabricator.services.mozilla.com/D68317 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
697c8ef8d4
Коммит
adc03fb040
|
@ -301,7 +301,8 @@ nsresult IMEHandler::NotifyIME(nsWindow* aWindow,
|
|||
nsresult rv = TSFTextStore::OnFocusChange(true, aWindow,
|
||||
aWindow->GetInputContext());
|
||||
MaybeCreateNativeCaret(aWindow);
|
||||
IMEHandler::MaybeShowOnScreenKeyboard(aWindow);
|
||||
IMEHandler::MaybeShowOnScreenKeyboard(aWindow,
|
||||
aWindow->GetInputContext());
|
||||
return rv;
|
||||
}
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
|
@ -361,7 +362,8 @@ nsresult IMEHandler::NotifyIME(nsWindow* aWindow,
|
|||
case NOTIFY_IME_OF_FOCUS:
|
||||
sFocusedWindow = aWindow;
|
||||
IMMHandler::OnFocusChange(true, aWindow);
|
||||
IMEHandler::MaybeShowOnScreenKeyboard(aWindow);
|
||||
IMEHandler::MaybeShowOnScreenKeyboard(aWindow,
|
||||
aWindow->GetInputContext());
|
||||
MaybeCreateNativeCaret(aWindow);
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
|
@ -476,8 +478,10 @@ void IMEHandler::SetInputContext(nsWindow* aWindow, InputContext& aInputContext,
|
|||
aWindow->DispatchPluginSettingEvents();
|
||||
}
|
||||
|
||||
if (aAction.UserMightRequestOpenVKB()) {
|
||||
IMEHandler::MaybeShowOnScreenKeyboard(aWindow);
|
||||
if (aInputContext.mHTMLInputInputmode.EqualsLiteral("none")) {
|
||||
IMEHandler::MaybeDismissOnScreenKeyboard(aWindow, Sync::Yes);
|
||||
} else if (aAction.UserMightRequestOpenVKB()) {
|
||||
IMEHandler::MaybeShowOnScreenKeyboard(aWindow, aInputContext);
|
||||
}
|
||||
|
||||
bool enable = WinUtils::IsIMEEnabled(aInputContext);
|
||||
|
@ -775,7 +779,11 @@ void IMEHandler::AppendInputScopeFromType(const nsAString& aHTMLInputType,
|
|||
}
|
||||
|
||||
// static
|
||||
void IMEHandler::MaybeShowOnScreenKeyboard(nsWindow* aWindow) {
|
||||
void IMEHandler::MaybeShowOnScreenKeyboard(nsWindow* aWindow,
|
||||
const InputContext& aInputContext) {
|
||||
if (aInputContext.mHTMLInputInputmode.EqualsLiteral("none")) {
|
||||
return;
|
||||
}
|
||||
#ifdef NIGHTLY_BUILD
|
||||
if (FxRWindowManager::GetInstance()->IsFxRWindow(sFocusedWindow)) {
|
||||
mozilla::gfx::VRShMem shmem(nullptr, true /*aRequiresMutex*/);
|
||||
|
@ -805,7 +813,7 @@ void IMEHandler::MaybeShowOnScreenKeyboard(nsWindow* aWindow) {
|
|||
}
|
||||
|
||||
// static
|
||||
void IMEHandler::MaybeDismissOnScreenKeyboard(nsWindow* aWindow) {
|
||||
void IMEHandler::MaybeDismissOnScreenKeyboard(nsWindow* aWindow, Sync aSync) {
|
||||
#ifdef NIGHTLY_BUILD
|
||||
if (FxRWindowManager::GetInstance()->IsFxRWindow(aWindow)) {
|
||||
mozilla::gfx::VRShMem shmem(nullptr, true /*aRequiresMutex*/);
|
||||
|
@ -817,6 +825,11 @@ void IMEHandler::MaybeDismissOnScreenKeyboard(nsWindow* aWindow) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (aSync == Sync::Yes) {
|
||||
DismissOnScreenKeyboard(aWindow);
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<nsWindow> window(aWindow);
|
||||
NS_DispatchToCurrentThreadQueue(
|
||||
NS_NewRunnableFunction("IMEHandler::MaybeDismissOnScreenKeyboard",
|
||||
|
|
|
@ -222,8 +222,11 @@ class IMEHandler final {
|
|||
static bool IsTSFAvailable() { return (sIsInTSFMode && !sPluginHasFocus); }
|
||||
static bool IsIMMActive();
|
||||
|
||||
static void MaybeShowOnScreenKeyboard(nsWindow* aWindow);
|
||||
static void MaybeDismissOnScreenKeyboard(nsWindow* aWindow);
|
||||
static void MaybeShowOnScreenKeyboard(nsWindow* aWindow,
|
||||
const InputContext& aInputContext);
|
||||
enum class Sync { Yes, No };
|
||||
static void MaybeDismissOnScreenKeyboard(nsWindow* aWindow,
|
||||
Sync aSync = Sync::No);
|
||||
static bool WStringStartsWithCaseInsensitive(const std::wstring& aHaystack,
|
||||
const std::wstring& aNeedle);
|
||||
static bool NeedOnScreenKeyboard();
|
||||
|
|
Загрузка…
Ссылка в новой задаче