Bug 1234120 part.1 IMEHandler should request all notifications which are requested by either IMMHander or TSFTextStore when IMM is available in TSF mode r=m_kato a=ritu
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 22 Dec 2015 14:58:48 +0900
changeset 310540 ebc0418a8110c06695b315c1c78aba96ad4a5c62
parent 310539 0786a97aee59b4d3f32c35351c92c4be858d7e55
child 310541 a68652738f3c0e1925287e4aff79e5afdeaf8aba
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato, ritu
bugs1234120
milestone45.0a2
Bug 1234120 part.1 IMEHandler should request all notifications which are requested by either IMMHander or TSFTextStore when IMM is available in TSF mode r=m_kato a=ritu
widget/IMEData.h
widget/windows/WinIMEHandler.cpp
--- a/widget/IMEData.h
+++ b/widget/IMEData.h
@@ -66,16 +66,21 @@ struct nsIMEUpdatePreference final
   {
   }
 
   explicit nsIMEUpdatePreference(Notifications aWantUpdates)
     : mWantUpdates(aWantUpdates | DEFAULT_CONDITIONS_OF_NOTIFYING_CHANGES)
   {
   }
 
+  nsIMEUpdatePreference operator|(const nsIMEUpdatePreference& aOther) const
+  {
+    return nsIMEUpdatePreference(aOther.mWantUpdates | mWantUpdates);
+  }
+
   void DontNotifyChangesCausedByComposition()
   {
     mWantUpdates &= ~DEFAULT_CONDITIONS_OF_NOTIFYING_CHANGES;
   }
 
   bool WantSelectionChange() const
   {
     return !!(mWantUpdates & NOTIFY_SELECTION_CHANGE);
--- a/widget/windows/WinIMEHandler.cpp
+++ b/widget/windows/WinIMEHandler.cpp
@@ -330,17 +330,26 @@ IMEHandler::GetUpdatePreference()
   // While a plugin has focus, neither TSFTextStore nor IMMHandler needs
   // notifications.
   if (sPluginHasFocus) {
     return nsIMEUpdatePreference();
   }
 
 #ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
-    return TSFTextStore::GetIMEUpdatePreference();
+    if (!sIsIMMEnabled) {
+      return TSFTextStore::GetIMEUpdatePreference();
+    }
+    // Even if TSF is available, the active IME may be an IMM-IME.
+    // Unfortunately, changing the result of GetUpdatePreference() while an
+    // editor has focus isn't supported by IMEContentObserver nor
+    // ContentCacheInParent.  Therefore, we need to request whole notifications
+    // which are necessary either IMMHandler or TSFTextStore.
+    return IMMHandler::GetIMEUpdatePreference() |
+             TSFTextStore::GetIMEUpdatePreference();
   }
 #endif //NS_ENABLE_TSF
 
   return IMMHandler::GetIMEUpdatePreference();
 }
 
 // static
 bool