Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 31 May 2016 11:39:15 +0900
changeset 374275 d3cd26e907c314899bec6367f9d2e863a8861840
parent 374267 f3f7a4271cff0e185aa6ad88d68b25ef673210c0
child 374276 40690ce53ad83b463ee3eef35f13b56b428c67bd
push id19973
push usermasayuki@d-toybox.com
push dateThu, 02 Jun 2016 04:17:43 +0000
reviewersm_kato
bugs1275906
milestone49.0a1
Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r?m_kato It's not clear to me what NOTIFY_IME_OF_COMPOSITION_UPDATE means only from the name. For making the name clearer, this patch renames it to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED and add some explanation to the definition. MozReview-Commit-ID: 8ySYCNJ1Ytz
dom/events/IMEContentObserver.cpp
dom/events/IMEStateManager.cpp
dom/events/TextComposition.cpp
widget/ContentCache.cpp
widget/IMEData.h
widget/PuppetWidget.cpp
widget/gtk/IMContextWrapper.cpp
widget/nsBaseWidget.cpp
widget/windows/IMMHandler.cpp
widget/windows/TSFTextStore.cpp
widget/windows/WinIMEHandler.cpp
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -43,45 +43,16 @@ using namespace widget;
 LazyLogModule sIMECOLog("IMEContentObserver");
 
 static const char*
 ToChar(bool aBool)
 {
   return aBool ? "true" : "false";
 }
 
-static const char*
-ToChar(IMEMessage aIMEMessage)
-{
-  switch (aIMEMessage) {
-    case NOTIFY_IME_OF_NOTHING:
-      return "NOTIFY_IME_OF_NOTHING";
-    case NOTIFY_IME_OF_FOCUS:
-      return "NOTIFY_IME_OF_FOCUS";
-    case NOTIFY_IME_OF_BLUR:
-      return "NOTIFY_IME_OF_BLUR";
-    case NOTIFY_IME_OF_SELECTION_CHANGE:
-      return "NOTIFY_IME_OF_SELECTION_CHANGE";
-    case NOTIFY_IME_OF_TEXT_CHANGE:
-      return "NOTIFY_IME_OF_TEXT_CHANGE";
-    case NOTIFY_IME_OF_COMPOSITION_UPDATE:
-      return "NOTIFY_IME_OF_COMPOSITION_UPDATE";
-    case NOTIFY_IME_OF_POSITION_CHANGE:
-      return "NOTIFY_IME_OF_POSITION_CHANGE";
-    case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
-      return "NOTIFY_IME_OF_MOUSE_BUTTON_EVENT";
-    case REQUEST_TO_COMMIT_COMPOSITION:
-      return "REQUEST_TO_COMMIT_COMPOSITION";
-    case REQUEST_TO_CANCEL_COMPOSITION:
-      return "REQUEST_TO_CANCEL_COMPOSITION";
-    default:
-      return "Unexpected value";
-  }
-}
-
 class WritingModeToString final : public nsAutoCString
 {
 public:
   explicit WritingModeToString(const WritingMode& aWritingMode)
   {
     if (!aWritingMode.IsVertical()) {
       AssignLiteral("Horizontal");
       return;
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -130,43 +130,16 @@ GetIMEStateSetOpenName(IMEState::Open aO
       return "OPEN";
     case IMEState::CLOSED:
       return "CLOSED";
     default:
       return "illegal value";
   }
 }
 
-static const char*
-GetNotifyIMEMessageName(IMEMessage aMessage)
-{
-  switch (aMessage) {
-    case NOTIFY_IME_OF_FOCUS:
-      return "NOTIFY_IME_OF_FOCUS";
-    case NOTIFY_IME_OF_BLUR:
-      return "NOTIFY_IME_OF_BLUR";
-    case NOTIFY_IME_OF_SELECTION_CHANGE:
-      return "NOTIFY_IME_OF_SELECTION_CHANGE";
-    case NOTIFY_IME_OF_TEXT_CHANGE:
-      return "NOTIFY_IME_OF_TEXT_CHANGE";
-    case NOTIFY_IME_OF_COMPOSITION_UPDATE:
-      return "NOTIFY_IME_OF_COMPOSITION_UPDATE";
-    case NOTIFY_IME_OF_POSITION_CHANGE:
-      return "NOTIFY_IME_OF_POSITION_CHANGE";
-    case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
-      return "NOTIFY_IME_OF_MOUSE_BUTTON_EVENT";
-    case REQUEST_TO_COMMIT_COMPOSITION:
-      return "REQUEST_TO_COMMIT_COMPOSITION";
-    case REQUEST_TO_CANCEL_COMPOSITION:
-      return "REQUEST_TO_CANCEL_COMPOSITION";
-    default:
-      return "unacceptable IME notification message";
-  }
-}
-
 StaticRefPtr<nsIContent> IMEStateManager::sContent;
 nsPresContext* IMEStateManager::sPresContext = nullptr;
 nsIWidget* IMEStateManager::sFocusedIMEWidget = nullptr;
 nsIWidget* IMEStateManager::sActiveInputContextWidget = nullptr;
 StaticRefPtr<TabParent> IMEStateManager::sActiveTabParent;
 StaticRefPtr<IMEContentObserver> IMEStateManager::sActiveIMEContentObserver;
 TextCompositionArray* IMEStateManager::sTextCompositions = nullptr;
 bool IMEStateManager::sInstalledMenuKeyboardListener = false;
@@ -1311,17 +1284,17 @@ nsresult
 IMEStateManager::NotifyIME(const IMENotification& aNotification,
                            nsIWidget* aWidget,
                            bool aOriginIsRemote)
 {
   MOZ_LOG(sISMLog, LogLevel::Info,
     ("ISM: IMEStateManager::NotifyIME(aNotification={ mMessage=%s }, "
      "aWidget=0x%p, aOriginIsRemote=%s), sFocusedIMEWidget=0x%p, "
      "sRemoteHasFocus=%s",
-     GetNotifyIMEMessageName(aNotification.mMessage), aWidget,
+     ToChar(aNotification.mMessage), aWidget,
      GetBoolName(aOriginIsRemote), sFocusedIMEWidget,
      GetBoolName(sRemoteHasFocus)));
 
   if (NS_WARN_IF(!aWidget)) {
     MOZ_LOG(sISMLog, LogLevel::Error,
       ("ISM:   IMEStateManager::NotifyIME(), FAILED due to no widget"));
     return NS_ERROR_INVALID_ARG;
   }
@@ -1435,17 +1408,17 @@ IMEStateManager::NotifyIME(const IMENoti
 
   switch (aNotification.mMessage) {
     case REQUEST_TO_COMMIT_COMPOSITION:
       return composition ?
         composition->RequestToCommit(aWidget, false) : NS_OK;
     case REQUEST_TO_CANCEL_COMPOSITION:
       return composition ?
         composition->RequestToCommit(aWidget, true) : NS_OK;
-    case NOTIFY_IME_OF_COMPOSITION_UPDATE:
+    case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
       if (!aOriginIsRemote && (!composition || isSynthesizedForTests)) {
         MOZ_LOG(sISMLog, LogLevel::Info,
           ("ISM:   IMEStateManager::NotifyIME(), FAILED, received content "
            "change notification from this process but there is no compostion"));
         return NS_OK;
       }
       if (!sRemoteHasFocus && aOriginIsRemote) {
         MOZ_LOG(sISMLog, LogLevel::Info,
@@ -1466,18 +1439,17 @@ IMEStateManager::NotifyIME(const IMENoti
 nsresult
 IMEStateManager::NotifyIME(IMEMessage aMessage,
                            nsPresContext* aPresContext,
                            bool aOriginIsRemote)
 {
   MOZ_LOG(sISMLog, LogLevel::Info,
     ("ISM: IMEStateManager::NotifyIME(aMessage=%s, aPresContext=0x%p, "
      "aOriginIsRemote=%s)",
-     GetNotifyIMEMessageName(aMessage), aPresContext,
-     GetBoolName(aOriginIsRemote)));
+     ToChar(aMessage), aPresContext, GetBoolName(aOriginIsRemote)));
 
   NS_ENSURE_TRUE(aPresContext, NS_ERROR_INVALID_ARG);
 
   nsIWidget* widget = aPresContext->GetRootWidget();
   if (NS_WARN_IF(!widget)) {
     MOZ_LOG(sISMLog, LogLevel::Error,
       ("ISM:   IMEStateManager::NotifyIME(), FAILED due to no widget for the "
        "nsPresContext"));
--- a/dom/events/TextComposition.cpp
+++ b/dom/events/TextComposition.cpp
@@ -451,17 +451,17 @@ TextComposition::NotityUpdateComposition
     mCompositionTargetOffset = mCompositionStartOffset;
   } else if (aCompositionEvent->CausesDOMTextEvent()) {
     mCompositionTargetOffset =
       mCompositionStartOffset + aCompositionEvent->TargetClauseOffset();
   } else {
     return;
   }
 
-  NotifyIME(NOTIFY_IME_OF_COMPOSITION_UPDATE);
+  NotifyIME(NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED);
 }
 
 void
 TextComposition::DispatchCompositionEventRunnable(EventMessage aEventMessage,
                                                   const nsAString& aData,
                                                   bool aIsSynthesizingCommit)
 {
   nsContentUtils::AddScriptRunner(
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -24,38 +24,17 @@ GetBoolName(bool aBool)
 }
 
 static const char*
 GetNotificationName(const IMENotification* aNotification)
 {
   if (!aNotification) {
     return "Not notification";
   }
-  switch (aNotification->mMessage) {
-    case NOTIFY_IME_OF_FOCUS:
-      return "NOTIFY_IME_OF_FOCUS";
-    case NOTIFY_IME_OF_BLUR:
-      return "NOTIFY_IME_OF_BLUR";
-    case NOTIFY_IME_OF_SELECTION_CHANGE:
-      return "NOTIFY_IME_OF_SELECTION_CHANGE";
-    case NOTIFY_IME_OF_TEXT_CHANGE:
-      return "NOTIFY_IME_OF_TEXT_CHANGE";
-    case NOTIFY_IME_OF_COMPOSITION_UPDATE:
-      return "NOTIFY_IME_OF_COMPOSITION_UPDATE";
-    case NOTIFY_IME_OF_POSITION_CHANGE:
-      return "NOTIFY_IME_OF_POSITION_CHANGE";
-    case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
-      return "NOTIFY_IME_OF_MOUSE_BUTTON_EVENT";
-    case REQUEST_TO_COMMIT_COMPOSITION:
-      return "REQUEST_TO_COMMIT_COMPOSITION";
-    case REQUEST_TO_CANCEL_COMPOSITION:
-      return "REQUEST_TO_CANCEL_COMPOSITION";
-    default:
-      return "Unsupported notification";
-  }
+  return ToChar(aNotification->mMessage);
 }
 
 class GetRectText : public nsAutoCString
 {
 public:
   explicit GetRectText(const LayoutDeviceIntRect& aRect)
   {
     Assign("{ x=");
@@ -986,17 +965,17 @@ ContentCacheInParent::MaybeNotifyIME(nsI
       mPendingSelectionChange.MergeWith(aNotification);
       break;
     case NOTIFY_IME_OF_TEXT_CHANGE:
       mPendingTextChange.MergeWith(aNotification);
       break;
     case NOTIFY_IME_OF_POSITION_CHANGE:
       mPendingLayoutChange.MergeWith(aNotification);
       break;
-    case NOTIFY_IME_OF_COMPOSITION_UPDATE:
+    case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
       mPendingCompositionUpdate.MergeWith(aNotification);
       break;
     default:
       MOZ_CRASH("Unsupported notification");
       break;
   }
 }
 
--- a/widget/IMEData.h
+++ b/widget/IMEData.h
@@ -436,30 +436,38 @@ enum IMEMessage : IMEMessageType
   // An editable content is getting focus
   NOTIFY_IME_OF_FOCUS,
   // An editable content is losing focus
   NOTIFY_IME_OF_BLUR,
   // Selection in the focused editable content is changed
   NOTIFY_IME_OF_SELECTION_CHANGE,
   // Text in the focused editable content is changed
   NOTIFY_IME_OF_TEXT_CHANGE,
-  // Composition string has been updated
-  NOTIFY_IME_OF_COMPOSITION_UPDATE,
+  // Notified when a dispatched composition event is handled by the
+  // contents.  This must be notified after the other notifications.
+  // Note that if a remote process has focus, this is notified only once when
+  // all dispatched events are handled completely.  So, the receiver shouldn't
+  // count number of received this notification for comparing with the number
+  // of dispatched events.
+  NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED,
   // Position or size of focused element may be changed.
   NOTIFY_IME_OF_POSITION_CHANGE,
   // Mouse button event is fired on a character in focused editor
   NOTIFY_IME_OF_MOUSE_BUTTON_EVENT,
   // Request to commit current composition to IME
   // (some platforms may not support)
   REQUEST_TO_COMMIT_COMPOSITION,
   // Request to cancel current composition to IME
   // (some platforms may not support)
   REQUEST_TO_CANCEL_COMPOSITION
 };
 
+// FYI: Implemented in nsBaseWidget.cpp
+const char* ToChar(IMEMessage aIMEMessage);
+
 struct IMENotification final
 {
   IMENotification()
     : mMessage(NOTIFY_IME_OF_NOTHING)
   {
   }
 
   IMENotification(const IMENotification& aOther)
@@ -555,17 +563,17 @@ struct IMENotification final
         MOZ_ASSERT(aNotification.mMessage == NOTIFY_IME_OF_SELECTION_CHANGE);
         mSelectionChangeData.Assign(aNotification.mSelectionChangeData);
         break;
       case NOTIFY_IME_OF_TEXT_CHANGE:
         MOZ_ASSERT(aNotification.mMessage == NOTIFY_IME_OF_TEXT_CHANGE);
         mTextChangeData += aNotification.mTextChangeData;
         break;
       case NOTIFY_IME_OF_POSITION_CHANGE:
-      case NOTIFY_IME_OF_COMPOSITION_UPDATE:
+      case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
         MOZ_ASSERT(aNotification.mMessage == mMessage);
         break;
       default:
         MOZ_CRASH("Merging notification isn't supported");
         break;
     }
   }
 
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -636,17 +636,17 @@ PuppetWidget::NotifyIMEInternal(const IM
       return RequestIMEToCommitComposition(true);
     case NOTIFY_IME_OF_FOCUS:
     case NOTIFY_IME_OF_BLUR:
       return NotifyIMEOfFocusChange(aIMENotification);
     case NOTIFY_IME_OF_SELECTION_CHANGE:
       return NotifyIMEOfSelectionChange(aIMENotification);
     case NOTIFY_IME_OF_TEXT_CHANGE:
       return NotifyIMEOfTextChange(aIMENotification);
-    case NOTIFY_IME_OF_COMPOSITION_UPDATE:
+    case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
       return NotifyIMEOfCompositionUpdate(aIMENotification);
     case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
       return NotifyIMEOfMouseButtonEvent(aIMENotification);
     case NOTIFY_IME_OF_POSITION_CHANGE:
       return NotifyIMEOfPositionChange(aIMENotification);
     default:
       return NS_ERROR_NOT_IMPLEMENTED;
   }
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -296,17 +296,17 @@ IMContextWrapper::NotifyIME(TextEventDis
             OnFocusChangeInGecko(true);
             return NS_OK;
         case NOTIFY_IME_OF_BLUR:
             OnFocusChangeInGecko(false);
             return NS_OK;
         case NOTIFY_IME_OF_POSITION_CHANGE:
             OnLayoutChange();
             return NS_OK;
-        case NOTIFY_IME_OF_COMPOSITION_UPDATE:
+        case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
             OnUpdateComposition();
             return NS_OK;
         case NOTIFY_IME_OF_SELECTION_CHANGE: {
             nsWindow* window =
                 static_cast<nsWindow*>(aTextEventDispatcher->GetWidget());
             OnSelectionChange(window, aNotification);
             return NS_OK;
         }
@@ -984,17 +984,18 @@ IMContextWrapper::OnSelectionChange(nsWi
             ("GTKIM: %p   OnSelectionChange(), FAILED, "
              "the caller isn't focused window, mLastFocusedWindow=%p",
              this, mLastFocusedWindow));
         return;
     }
 
     if (!IsComposing()) {
         // Now we have no composition (mostly situation on calling this method)
-        // If we have it, it will set by NOTIFY_IME_OF_COMPOSITION_UPDATE.
+        // If we have it, it will set by
+        // NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED.
         mSetCursorPositionOnKeyEvent = true;
     }
 
     // The focused editor might have placeholder text with normal text node.
     // In such case, the text node must be removed from a compositionstart
     // event handler.  So, we're dispatching eCompositionStart,
     // we should ignore selection change notification.
     if (mCompositionState == eCompositionState_CompositionStartDispatched) {
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -2141,16 +2141,45 @@ nsIWidget::OnWindowedPluginKeyEvent(cons
                                     nsIKeyEventInPluginCallback* aCallback)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 namespace mozilla {
 namespace widget {
 
+const char*
+ToChar(IMEMessage aIMEMessage)
+{
+  switch (aIMEMessage) {
+    case NOTIFY_IME_OF_NOTHING:
+      return "NOTIFY_IME_OF_NOTHING";
+    case NOTIFY_IME_OF_FOCUS:
+      return "NOTIFY_IME_OF_FOCUS";
+    case NOTIFY_IME_OF_BLUR:
+      return "NOTIFY_IME_OF_BLUR";
+    case NOTIFY_IME_OF_SELECTION_CHANGE:
+      return "NOTIFY_IME_OF_SELECTION_CHANGE";
+    case NOTIFY_IME_OF_TEXT_CHANGE:
+      return "NOTIFY_IME_OF_TEXT_CHANGE";
+    case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
+      return "NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED";
+    case NOTIFY_IME_OF_POSITION_CHANGE:
+      return "NOTIFY_IME_OF_POSITION_CHANGE";
+    case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
+      return "NOTIFY_IME_OF_MOUSE_BUTTON_EVENT";
+    case REQUEST_TO_COMMIT_COMPOSITION:
+      return "REQUEST_TO_COMMIT_COMPOSITION";
+    case REQUEST_TO_CANCEL_COMPOSITION:
+      return "REQUEST_TO_CANCEL_COMPOSITION";
+    default:
+      return "Unexpected value";
+  }
+}
+
 void
 NativeIMEContext::Init(nsIWidget* aWidget)
 {
   if (!aWidget) {
     mRawNativeIMEContext = reinterpret_cast<uintptr_t>(nullptr);
     mOriginProcessID = static_cast<uint64_t>(-1);
     return;
   }
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -1967,18 +1967,18 @@ IMMHandler::DispatchCompositionChangeEve
     MOZ_LOG(gIMMLog, LogLevel::Error,
       ("IMM: DispatchCompositionChangeEvent, FAILED due to "
        "TextEventDispatcher::BeginNativeInputTransaction() failure"));
     return;
   }
 
   // NOTE: Calling SetIMERelatedWindowsPos() from this method will be failure
   //       in e10s mode.  compositionchange event will notify this of
-  //       NOTIFY_IME_OF_COMPOSITION_UPDATE, then SetIMERelatedWindowsPos()
-  //       will be called.
+  //       NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED, then
+  //       SetIMERelatedWindowsPos() will be called.
 
   // XXX Sogou (Simplified Chinese IME) returns contradictory values:
   //     The cursor position is actual cursor position. However, other values
   //     (composition string and attributes) are empty.
 
   if (mCompositionString.IsEmpty()) {
     // Don't append clause information if composition string is empty.
   } else if (mClauseArray.IsEmpty()) {
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -1616,19 +1616,19 @@ TSFTextStore::FlushPendingActions()
           if (!selectionSet.mSucceeded) {
             MOZ_LOG(sTextStoreLog, LogLevel::Error,
                    ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                     "FAILED due to eSetSelection failure", this));
             break;
           }
         }
 
-        // eCompositionStart always causes NOTIFY_IME_OF_COMPOSITION_UPDATE.
-        // Therefore, we should wait to clear the locked content until it's
-        // notified.
+        // eCompositionStart always causes
+        // NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED.  Therefore, we should
+        // wait to clear the locked content until it's notified.
         mDeferClearingLockedContent = true;
 
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
                ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                 "dispatching compositionstart event...", this));
         WidgetEventTime eventTime = mWidget->CurrentMessageWidgetEventTime();
         nsEventStatus status;
         rv = mDispatcher->StartComposition(status, &eventTime);
@@ -1647,19 +1647,19 @@ TSFTextStore::FlushPendingActions()
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
                ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                 "flushing COMPOSITION_UPDATE={ mData=\"%s\", "
                 "mRanges=0x%p, mRanges->Length()=%d }",
                 this, NS_ConvertUTF16toUTF8(action.mData).get(), action.mRanges.get(),
                 action.mRanges ? action.mRanges->Length() : 0));
 
         // eCompositionChange causes a DOM text event, the IME will be notified
-        // of NOTIFY_IME_OF_COMPOSITION_UPDATE.  In this case, we should not
-        // clear the locked content until we notify the IME of the composition
-        // update.
+        // of NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED.  In this case, we
+        // should not clear the locked content until we notify the IME of the
+        // composition update.
         mDeferClearingLockedContent = true;
 
         rv = mDispatcher->SetPendingComposition(action.mData,
                                                 action.mRanges);
         if (NS_WARN_IF(NS_FAILED(rv))) {
           MOZ_LOG(sTextStoreLog, LogLevel::Error,
             ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
              "FAILED to setting pending composition...", this));
@@ -1683,18 +1683,18 @@ TSFTextStore::FlushPendingActions()
       }
       case PendingAction::COMPOSITION_END: {
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
                ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                 "flushing COMPOSITION_END={ mData=\"%s\" }",
                 this, NS_ConvertUTF16toUTF8(action.mData).get()));
 
         // Dispatching eCompositionCommit causes a DOM text event, then,
-        // the IME will be notified of NOTIFY_IME_OF_COMPOSITION_UPDATE.  In
-        // this case, we should not clear the locked content until we notify
+        // the IME will be notified of NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED.
+        // In this case, we should not clear the locked content until we notify
         // the IME of the composition update.
         mDeferClearingLockedContent = true;
 
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
                ("TSF: 0x%p   TSFTextStore::FlushPendingActions(), "
                 "dispatching compositioncommit event...", this));
         WidgetEventTime eventTime = mWidget->CurrentMessageWidgetEventTime();
         nsEventStatus status;
--- a/widget/windows/WinIMEHandler.cpp
+++ b/widget/windows/WinIMEHandler.cpp
@@ -234,17 +234,17 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
         // composition window position.
         bool isIMMActive = IsIMMActive();
         if (isIMMActive) {
           IMMHandler::OnUpdateComposition(aWindow);
         }
         IMMHandler::OnSelectionChange(aWindow, aIMENotification, isIMMActive);
         return rv;
       }
-      case NOTIFY_IME_OF_COMPOSITION_UPDATE:
+      case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
         // If IMM IME is active, we need to notify IMMHandler of updating
         // composition change.  It will adjust candidate window position or
         // composition window position.
         if (IsIMMActive()) {
           IMMHandler::OnUpdateComposition(aWindow);
         } else {
           TSFTextStore::OnUpdateComposition();
         }
@@ -297,17 +297,17 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
   switch (aIMENotification.mMessage) {
     case REQUEST_TO_COMMIT_COMPOSITION:
       IMMHandler::CommitComposition(aWindow);
       return NS_OK;
     case REQUEST_TO_CANCEL_COMPOSITION:
       IMMHandler::CancelComposition(aWindow);
       return NS_OK;
     case NOTIFY_IME_OF_POSITION_CHANGE:
-    case NOTIFY_IME_OF_COMPOSITION_UPDATE:
+    case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
       IMMHandler::OnUpdateComposition(aWindow);
       return NS_OK;
     case NOTIFY_IME_OF_SELECTION_CHANGE:
       IMMHandler::OnSelectionChange(aWindow, aIMENotification, true);
       return NS_OK;
     case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
       return IMMHandler::OnMouseButtonEvent(aWindow, aIMENotification);
     case NOTIFY_IME_OF_FOCUS: