Bug 1381732 - IMEStateManager::OnChangeFocusInternal() shouldn't set IME state when focus is not being changed, input context of the widget was already set by a remote process and our process is being activated r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 25 Jul 2017 16:34:07 +0900
changeset 615162 2e74c382c4938939ea842bc7744dd4ad7814bae2
parent 615161 fb3a5ea376b2526c421b4118eede50e4984e7a1e
child 639086 1269889c2d0ad08099b94292b25e3f8ce4aa2887
push id70250
push usermasayuki@d-toybox.com
push dateTue, 25 Jul 2017 14:30:53 +0000
reviewersm_kato
bugs1381732
milestone56.0a1
Bug 1381732 - IMEStateManager::OnChangeFocusInternal() shouldn't set IME state when focus is not being changed, input context of the widget was already set by a remote process and our process is being activated r?m_kato This patch fixes a simple mistake which was written when we support IME in e10s mode. IMEStateManager::OnChangeFocusInternal() already has code which makes the method doesn't set IME state again when focus is not being changed, input context of the widget was already set by a remote process and our process is being activated. However, the condition of checking if input context of the widget was set by which process is reversed. MozReview-Commit-ID: 61ZH0VnKqPq
dom/events/IMEStateManager.cpp
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -529,16 +529,17 @@ IMEStateManager::OnChangeFocusInternal(n
   // process actually gets focus because if user types keys before that they
   // are handled by IME.
   IMEState newState =
     newTabParent ? IMEState(IMEState::DISABLED) :
                    GetNewIMEState(aPresContext, aContent);
   bool setIMEState = true;
 
   if (newTabParent) {
+    MOZ_ASSERT(XRE_IsParentProcess());
     if (aAction.mFocusChange == InputContextAction::MENU_GOT_PSEUDO_FOCUS ||
         aAction.mFocusChange == InputContextAction::MENU_LOST_PSEUDO_FOCUS) {
       // XXX When menu keyboard listener is being uninstalled, IME state needs
       //     to be restored by the child process asynchronously.  Therefore,
       //     some key events which are fired immediately after closing menu
       //     may not be handled by IME.
       Unused << newTabParent->
         SendMenuKeyboardListenerInstalled(sInstalledMenuKeyboardListener);
@@ -554,17 +555,17 @@ IMEStateManager::OnChangeFocusInternal(n
            "and the IME state is already disabled by a remote process"));
       } else {
         MOZ_LOG(sISMLog, LogLevel::Debug,
           ("  OnChangeFocusInternal(), will disable IME "
            "until new focused element (or document) in the child process "
            "will get focus actually"));
       }
     } else if (newWidget->GetInputContext().mOrigin !=
-                 InputContext::ORIGIN_CONTENT) {
+                 InputContext::ORIGIN_MAIN) {
       // When focus is NOT changed actually, we shouldn't set IME state if
       // current input context was set by a remote process since that means
       // that the window is being activated and the child process may have
       // composition.  Then, we shouldn't commit the composition with making
       // IME state disabled.
       setIMEState = false;
       MOZ_LOG(sISMLog, LogLevel::Debug,
         ("  OnChangeFocusInternal(), doesn't set IME "