Bug 1379997 - part2: Remove "intl.tsf.hack.ms_japanese_ime.do_not_associate_imc_on_win10" pref completely r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 01 Aug 2017 00:13:57 +0900
changeset 423280 1b823be2a09f602ee8d2121f2d3f3cfbe980407e
parent 423279 5c312f2c6e58e87f3ec0504ace592ef9d71b9079
child 423281 d000d7961749d393a3521c2c13e6a0744ec4aa4e
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1379997
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
modules/libpref/init/all.js
widget/windows/WinIMEHandler.cpp
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3830,23 +3830,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.