Bug 835280 nsIMEStateManager::OnChangeFocus() for DOM document should be called only when designMode document gets focus r=enndeakin
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 02 Feb 2013 03:02:17 +0900
changeset 130484 0a072eb27f1d0687791faebffa5103b179455f8f
parent 130475 f3271987974111cb3c0629908417b45bf42049d7
child 130485 96302c19380fce2131b66687981b94c88ec9828a
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin
bugs835280
milestone21.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 835280 nsIMEStateManager::OnChangeFocus() for DOM document should be called only when designMode document gets focus r=enndeakin
dom/base/nsFocusManager.cpp
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -1734,19 +1734,24 @@ nsFocusManager::Focus(nsPIDOMWindow* aWi
       if (widget)
         widget->SetFocus(false);
     }
   }
 
   // if switching to a new document, first fire the focus event on the
   // document and then the window.
   if (aIsNewDocument) {
-    nsIMEStateManager::OnChangeFocus(presShell->GetPresContext(), nullptr,
-                                     GetFocusMoveActionCause(aFlags));
     nsIDocument* doc = aWindow->GetExtantDoc();
+    // The focus change should be notified to nsIMEStateManager from here if
+    // the focused content is a designMode editor since any content won't
+    // receive focus event.
+    if (doc && doc->HasFlag(NODE_IS_EDITABLE)) {
+      nsIMEStateManager::OnChangeFocus(presShell->GetPresContext(), nullptr,
+                                       GetFocusMoveActionCause(aFlags));
+    }
     if (doc)
       SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell, doc,
                            doc, aFlags & FOCUSMETHOD_MASK, aWindowRaised);
     if (mFocusedWindow == aWindow && mFocusedContent == nullptr)
       SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell, doc,
                            aWindow, aFlags & FOCUSMETHOD_MASK, aWindowRaised);
   }