Bug 1543578 - Avoid synthetizing BrowserParent IME focus change when opening a menu. r=masayuki
authorHenri Sivonen <hsivonen@hsivonen.fi>
Thu, 09 May 2019 13:42:22 +0000
changeset 535232 adb37249163ee7243b14417e5771faa8564c985e
parent 535231 dd4958dfdea0a3d5bd2181500ed6d8958061e723
child 535233 b661a2bf1626fcf9cef6915dffbff50a6c6dc289
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1543578
milestone68.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 1543578 - Avoid synthetizing BrowserParent IME focus change when opening a menu. r=masayuki Differential Revision: https://phabricator.services.mozilla.com/D28470
dom/events/IMEStateManager.cpp
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -459,17 +459,19 @@ nsresult IMEStateManager::OnChangeFocusI
     aContent = nullptr;
   }
 
   nsCOMPtr<nsIWidget> oldWidget = sWidget;
   nsCOMPtr<nsIWidget> newWidget =
       aPresContext ? aPresContext->GetRootWidget() : nullptr;
   bool focusActuallyChanging =
       (sContent != aContent || sPresContext != aPresContext ||
-       oldWidget != newWidget || remoteHasFocus);
+       oldWidget != newWidget ||
+       (remoteHasFocus &&
+        (aAction.mFocusChange != InputContextAction::MENU_GOT_PSEUDO_FOCUS)));
 
   // If old widget has composition, we may need to commit composition since
   // a native IME context is shared on all editors on some widgets or all
   // widgets (it depends on platforms).
   if (oldWidget && focusActuallyChanging && sTextCompositions) {
     RefPtr<TextComposition> composition =
         sTextCompositions->GetCompositionFor(oldWidget);
     if (composition) {
@@ -669,24 +671,16 @@ void IMEStateManager::OnInstalledMenuKey
        GetBoolName(sActiveChildInputContext.mInPrivateBrowsing)));
 
   sInstalledMenuKeyboardListener = aInstalling;
 
   InputContextAction action(InputContextAction::CAUSE_UNKNOWN,
                             aInstalling
                                 ? InputContextAction::MENU_GOT_PSEUDO_FOCUS
                                 : InputContextAction::MENU_LOST_PSEUDO_FOCUS);
-  BrowserParent* focused = BrowserParent::GetFocused();
-  if (focused) {
-    if (aInstalling) {
-      OnFocusMovedBetweenBrowsers(focused, nullptr);
-    } else {
-      OnFocusMovedBetweenBrowsers(nullptr, focused);
-    }
-  }
   OnChangeFocusInternal(sPresContext, sContent, action);
 }
 
 // static
 bool IMEStateManager::OnMouseButtonEventInEditor(
     nsPresContext* aPresContext, nsIContent* aContent,
     WidgetMouseEvent* aMouseEvent) {
   MOZ_LOG(sISMLog, LogLevel::Info,