Bug 1379997 - part2: Remove "intl.tsf.hack.ms_japanese_ime.do_not_associate_imc_on_win10" pref completely r?m_kato
"intl.tsf.hack.ms_japanese_ime.do_not_associate_imc_on_win10" should be unnecessary anymore because it failed to avoid the crash of MS-IME for Japanese but causing other regression. Therefore, this patch removes it completely.
MozReview-Commit-ID: 91jjxfIYReW
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3829,23 +3829,16 @@ pref("intl.tsf.hack.free_chang_jie.do_no
// For Microsoft Pinyin and Microsoft Wubi
pref("intl.tsf.hack.ms_simplified_chinese.do_not_return_no_layout_error", true);
// For Microsoft ChangJie and Microsoft Quick
pref("intl.tsf.hack.ms_traditional_chinese.do_not_return_no_layout_error", true);
// Whether use previous character rect for the result of
// ITfContextView::GetTextExt() if the specified range is the first character
// of selected clause of composition string.
pref("intl.tsf.hack.ms_japanese_ime.do_not_return_no_layout_error_at_first_char", true);
-// Whether default IMC should be associated with focused window when MS-IME
-// for Japanese on Win10 is active. MS-IME for Japanese on Win10 has a crash
-// bug. While restoring default IMC when MS-IME for Japanese is active,
-// it sometimes crashes after Creators Update. This pref avoid the crash.
-// Note that making this true causes bug 1379997 and cannot prevent the crash
-// mentioned above.
-pref("intl.tsf.hack.ms_japanese_ime.do_not_associate_imc_on_win10", false);
// Whether use previous character rect for the result of
// ITfContextView::GetTextExt() if the specified range is the caret of
// composition string.
pref("intl.tsf.hack.ms_japanese_ime.do_not_return_no_layout_error_at_caret", true);
// Whether hack ITextStoreACP::QueryInsert() or not. The method should return
// new selection after specified length text is inserted at specified range.
// However, Microsoft's some Chinese TIPs expect that the result is same as
// specified range. If following prefs are true, ITextStoreACP::QueryInsert()
--- a/widget/windows/WinIMEHandler.cpp
+++ b/widget/windows/WinIMEHandler.cpp
@@ -416,29 +416,17 @@ IMEHandler::OnDestroyWindow(nsWindow* aW
AssociateIMEContext(aWindow, true);
}
#ifdef NS_ENABLE_TSF
// static
bool
IMEHandler::NeedsToAssociateIMC()
{
- if (sAssociateIMCOnlyWhenIMM_IMEActive) {
- return IsIMMActive();
- }
-
- // Even if IMC should be associated with focused widget with non-IMM-IME,
- // we need to avoid crash bug of MS-IME for Japanese on Win10. It crashes
- // while we're associating default IME to a window when it's active.
- static const bool sDoNotAssociateIMCWhenMSJapaneseIMEActiveOnWin10 =
- IsWin10OrLater() &&
- Preferences::GetBool(
- "intl.tsf.hack.ms_japanese_ime.do_not_associate_imc_on_win10", true);
- return !sDoNotAssociateIMCWhenMSJapaneseIMEActiveOnWin10 ||
- !TSFTextStore::IsMSJapaneseIMEActive();
+ return !sAssociateIMCOnlyWhenIMM_IMEActive || !IsIMMActive();
}
#endif // #ifdef NS_ENABLE_TSF
// static
void
IMEHandler::SetInputContext(nsWindow* aWindow,
InputContext& aInputContext,
const InputContextAction& aAction)
@@ -561,16 +549,23 @@ IMEHandler::OnKeyboardLayoutChanged()
// observe active TIP change. If you need to be notified of this, you
// need to create TSFStaticSink::Observe() or something and call it
// TSFStaticSink::EnsureInitActiveTIPKeyboard() forcibly.
if (!sIsIMMEnabled || !IsTSFAvailable()) {
return;
}
+ // We don't need to do anything when sAssociateIMCOnlyWhenIMM_IMEActive is
+ // false because IMContext won't be associated/disassociated when changing
+ // active keyboard layout/IME.
+ if (!sAssociateIMCOnlyWhenIMM_IMEActive) {
+ return;
+ }
+
// If there is no TSFTextStore which has focus, i.e., no editor has focus,
// nothing to do here.
nsWindowBase* windowBase = TSFTextStore::GetEnabledWindowBase();
if (!windowBase) {
return;
}
// If IME isn't available, nothing to do here.