Bug 1276406 Remove "ime-enabled-state-changed" notification completely r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 31 May 2016 18:39:43 +0900
changeset 373647 e846b9268825c3208280fde8d1a296be48ca65f4
parent 373646 c1fb512d8497e7f5a02cf553b16cb830859fcae7
child 522440 61fa1afee88c8cf7bc6960530311a8e6095d2cce
push id19804
push usermasayuki@d-toybox.com
push dateWed, 01 Jun 2016 01:40:55 +0000
reviewerssmaug
bugs1276406, 603848
milestone49.0a1
Bug 1276406 Remove "ime-enabled-state-changed" notification completely r?smaug "ime-enabled-state-changed" notification was implemented for Android in bug 603848 but nobody currently observes this notification. Therefore, we can stop notify the observer service of this. MozReview-Commit-ID: 3TNHf1xWo2l
dom/events/IMEStateManager.cpp
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -889,44 +889,16 @@ IMEStateManager::GetNewIMEState(nsPresCo
   MOZ_LOG(sISMLog, LogLevel::Debug,
     ("ISM:   IMEStateManager::GetNewIMEState() returns { mEnabled=%s, "
      "mOpen=%s }",
      GetIMEStateEnabledName(newIMEState.mEnabled),
      GetIMEStateSetOpenName(newIMEState.mOpen)));
   return newIMEState;
 }
 
-// Helper class, used for IME enabled state change notification
-class IMEEnabledStateChangedEvent : public Runnable {
-public:
-  explicit IMEEnabledStateChangedEvent(uint32_t aState)
-    : mState(aState)
-  {
-  }
-
-  NS_IMETHOD Run()
-  {
-    nsCOMPtr<nsIObserverService> observerService =
-      services::GetObserverService();
-    if (observerService) {
-      MOZ_LOG(sISMLog, LogLevel::Info,
-        ("ISM: IMEEnabledStateChangedEvent::Run(), notifies observers of "
-         "\"ime-enabled-state-changed\""));
-      nsAutoString state;
-      state.AppendInt(mState);
-      observerService->NotifyObservers(nullptr, "ime-enabled-state-changed",
-                                       state.get());
-    }
-    return NS_OK;
-  }
-
-private:
-  uint32_t mState;
-};
-
 static bool
 MayBeIMEUnawareWebApp(nsINode* aNode)
 {
   bool haveKeyEventsListener = false;
 
   while (aNode) {
     EventListenerManager* const mgr = aNode->GetExistingListenerManager();
     if (mgr) {
@@ -1108,25 +1080,16 @@ IMEStateManager::SetInputContext(nsIWidg
      GetActionCauseName(aAction.mCause),
      GetActionFocusChangeName(aAction.mFocusChange),
      sActiveTabParent.get()));
 
   MOZ_RELEASE_ASSERT(aWidget);
 
   aWidget->SetInputContext(aInputContext, aAction);
   sActiveInputContextWidget = aWidget;
-
-  // Don't compare with old IME enabled state for reducing the count of
-  // notifying observers since in a remote process, nsIWidget::GetInputContext()
-  // call here may cause synchronous IPC, it's much more expensive than
-  // notifying observes.
-
-  // XXX Looks like nobody is observing this.
-  nsContentUtils::AddScriptRunner(
-    new IMEEnabledStateChangedEvent(aInputContext.mIMEState.mEnabled));
 }
 
 // static
 void
 IMEStateManager::EnsureTextCompositionArray()
 {
   if (sTextCompositions) {
     return;