Bug 895274 part.194 Rename NS_COMPOSITION_COMMIT to eCompositionCommit r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 11 Sep 2015 21:21:27 +0900
changeset 284613 7cf9012735c6d2a6c7d814a33f1baa54af552c15
parent 284612 4802505f05ad9a02184bb5ffdd541057f51ebe28
child 284614 07176b6eeedf1c0b4304a75795c0f1747b051365
push idunknown
push userunknown
push dateunknown
reviewerssmaug
bugs895274
milestone43.0a1
Bug 895274 part.194 Rename NS_COMPOSITION_COMMIT to eCompositionCommit r=smaug
dom/events/IMEStateManager.cpp
dom/events/TextComposition.cpp
widget/ContentCache.cpp
widget/EventMessageList.h
widget/PuppetWidget.cpp
widget/TextEventDispatcher.cpp
widget/TextEvents.h
widget/WidgetEventImpl.cpp
widget/android/nsWindow.cpp
widget/cocoa/TextInputHandler.mm
widget/gtk/IMContextWrapper.cpp
widget/windows/IMMHandler.cpp
widget/windows/TSFTextStore.cpp
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -142,18 +142,18 @@ GetEventMessageName(EventMessage aMessag
     case eCompositionEnd:
       return "eCompositionEnd";
     case eCompositionUpdate:
       return "eCompositionUpdate";
     case eCompositionChange:
       return "eCompositionChange";
     case eCompositionCommitAsIs:
       return "eCompositionCommitAsIs";
-    case NS_COMPOSITION_COMMIT:
-      return "NS_COMPOSITION_COMMIT";
+    case eCompositionCommit:
+      return "eCompositionCommit";
     case eSetSelection:
       return "eSetSelection";
     default:
       return "unacceptable event message";
   }
 }
 
 static const char*
--- a/dom/events/TextComposition.cpp
+++ b/dom/events/TextComposition.cpp
@@ -243,19 +243,19 @@ TextComposition::DispatchCompositionEven
     if (mLastData == IDEOGRAPHIC_SPACE) {
       // If the last data is an ideographic space (FullWidth space), it must be
       // a placeholder character of some Chinese IME.  So, committing with
       // this data must not be expected by users.  Let's use empty string.
       aCompositionEvent->mData.Truncate();
     } else {
       aCompositionEvent->mData = mLastData;
     }
-  } else if (aCompositionEvent->mMessage == NS_COMPOSITION_COMMIT) {
+  } else if (aCompositionEvent->mMessage == eCompositionCommit) {
     NS_ASSERTION(!aCompositionEvent->mRanges,
-                 "mRanges of NS_COMPOSITION_COMMIT should be null");
+                 "mRanges of eCompositionCommit should be null");
     aCompositionEvent->mRanges = nullptr;
   }
 
   if (!IsValidStateForComposition(aCompositionEvent->widget)) {
     *aStatus = nsEventStatus_eConsumeNoDefault;
     return;
   }
 
@@ -282,17 +282,17 @@ TextComposition::DispatchCompositionEven
   //    data isn't IDEOGRAPHIC SPACE.
   // 2. non-empty string is committed at requesting cancel.
   if (!aIsSynthesized && (mIsRequestingCommit || mIsRequestingCancel)) {
     nsString* committingData = nullptr;
     switch (aCompositionEvent->mMessage) {
       case eCompositionEnd:
       case eCompositionChange:
       case eCompositionCommitAsIs:
-      case NS_COMPOSITION_COMMIT:
+      case eCompositionCommit:
         committingData = &aCompositionEvent->mData;
         break;
       default:
         NS_WARNING("Unexpected event comes during committing or "
                    "canceling composition");
         break;
     }
     if (committingData) {
@@ -488,17 +488,17 @@ TextComposition::RequestToCommit(nsIWidg
   }
 
   // Otherwise, synthesize the commit in content.
   nsAutoString data(aDiscard ? EmptyString() : lastData);
   if (data == mLastData) {
     DispatchCompositionEventRunnable(eCompositionCommitAsIs, EmptyString(),
                                      true);
   } else {
-    DispatchCompositionEventRunnable(NS_COMPOSITION_COMMIT, data, true);
+    DispatchCompositionEventRunnable(eCompositionCommit, data, true);
   }
   return NS_OK;
 }
 
 nsresult
 TextComposition::NotifyIME(IMEMessage aMessage)
 {
   NS_ENSURE_TRUE(mPresContext, NS_ERROR_NOT_AVAILABLE);
@@ -622,17 +622,17 @@ TextComposition::CompositionEventDispatc
         mTextComposition->IsSynthesizedForTests();
       IMEStateManager::DispatchCompositionEvent(mEventTarget, presContext,
                                                 &compStart, &status, nullptr,
                                                 mIsSynthesizedEvent);
       break;
     }
     case eCompositionChange:
     case eCompositionCommitAsIs:
-    case NS_COMPOSITION_COMMIT: {
+    case eCompositionCommit: {
       WidgetCompositionEvent compEvent(true, mEventMessage, widget);
       if (mEventMessage != eCompositionCommitAsIs) {
         compEvent.mData = mData;
       }
       compEvent.mFlags.mIsSynthesizedForTests =
         mTextComposition->IsSynthesizedForTests();
       IMEStateManager::DispatchCompositionEvent(mEventTarget, presContext,
                                                 &compEvent, &status, nullptr,
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -32,18 +32,18 @@ GetEventMessageName(EventMessage aMessag
     case eCompositionEnd:
       return "eCompositionEnd";
     case eCompositionUpdate:
       return "eCompositionUpdate";
     case eCompositionChange:
       return "eCompositionChange";
     case eCompositionCommitAsIs:
       return "eCompositionCommitAsIs";
-    case NS_COMPOSITION_COMMIT:
-      return "NS_COMPOSITION_COMMIT";
+    case eCompositionCommit:
+      return "eCompositionCommit";
     case eSetSelection:
       return "eSetSelection";
     default:
       return "unacceptable event message";
   }
 }
 
 static const char*
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -143,17 +143,17 @@ NS_EVENT_MESSAGE(eLegacyCharacterDataMod
 NS_EVENT_MESSAGE(eLegacyMutationEventLast,        eLegacyCharacterDataModified)
 
 NS_EVENT_MESSAGE(eUnidentifiedEvent,    2000)
  
 // composition events
 NS_EVENT_MESSAGE(eCompositionEventFirst, 2200)
 NS_EVENT_MESSAGE(eCompositionStart,      eCompositionEventFirst)
 // eCompositionEnd is the message for DOM compositionend event.
-// This event should NOT be dispatched from widget if NS_COMPOSITION_COMMIT
+// This event should NOT be dispatched from widget if eCompositionCommit
 // is available.
 NS_EVENT_MESSAGE(eCompositionEnd,        eCompositionEventFirst + 1)
 // eCompositionUpdate is the message for DOM compositionupdate event.
 // This event should NOT be dispatched from widget since it will be dispatched
 // by mozilla::TextComposition automatically if eCompositionChange event
 // will change composition string.
 NS_EVENT_MESSAGE(eCompositionUpdate,     eCompositionEventFirst + 2)
 // eCompositionChange is the message for representing a change of
@@ -163,22 +163,22 @@ NS_EVENT_MESSAGE(eCompositionUpdate,    
 NS_EVENT_MESSAGE(eCompositionChange,     eCompositionEventFirst + 3)
 // eCompositionCommitAsIs is the message for representing a commit of
 // composition string.  TextComposition will commit composition with the
 // last data.  TextComposition will dispatch this event to the DOM tree as
 // eCompositionChange without clause information.  After that,
 // eCompositionEnd will be dispatched automatically.
 // Its mData and mRanges should be empty and nullptr.
 NS_EVENT_MESSAGE(eCompositionCommitAsIs, eCompositionEventFirst + 4)
-// NS_COMPOSITION_COMMIT is the message for representing a commit of
+// eCompositionCommit is the message for representing a commit of
 // composition string with its mData value.  TextComposition will dispatch this
 // event to the DOM tree as eCompositionChange without clause information.
 // After that, eCompositionEnd will be dispatched automatically.
 // Its mRanges should be nullptr.
-NS_EVENT_MESSAGE(NS_COMPOSITION_COMMIT,  eCompositionEventFirst + 5)
+NS_EVENT_MESSAGE(eCompositionCommit,     eCompositionEventFirst + 5)
 
 // Following events are defined for deprecated DOM events which are using
 // InternalUIEvent class.
 NS_EVENT_MESSAGE(eLegacyUIEventFirst,   2500)
 // DOMActivate (mapped with the DOM event and used internally)
 NS_EVENT_MESSAGE(eLegacyDOMActivate,    eLegacyUIEventFirst)
 // DOMFocusIn (only mapped with the DOM event)
 NS_EVENT_MESSAGE(eLegacyDOMFocusIn,     eLegacyUIEventFirst + 1)
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -570,18 +570,17 @@ nsresult
 PuppetWidget::IMEEndComposition(bool aCancel)
 {
 #ifndef MOZ_CROSS_PROCESS_IME
   return NS_OK;
 #endif
 
   nsEventStatus status;
   bool noCompositionEvent = true;
-  WidgetCompositionEvent compositionCommitEvent(true, NS_COMPOSITION_COMMIT,
-                                                this);
+  WidgetCompositionEvent compositionCommitEvent(true, eCompositionCommit, this);
   InitEvent(compositionCommitEvent, nullptr);
   // SendEndIMEComposition is always called since ResetInputState
   // should always be called even if we aren't composing something.
   if (!mTabChild ||
       !mTabChild->SendEndIMEComposition(aCancel, &noCompositionEvent,
                                         &compositionCommitEvent.mData)) {
     return NS_ERROR_FAILURE;
   }
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -263,21 +263,21 @@ TextEventDispatcher::CommitComposition(n
   }
   if (aStatus == nsEventStatus_eConsumeNoDefault) {
     return NS_OK;
   }
 
   // End current composition and make this free for other IMEs.
   mIsComposing = false;
 
-  EventMessage message = aCommitString ? NS_COMPOSITION_COMMIT :
+  EventMessage message = aCommitString ? eCompositionCommit :
                                          eCompositionCommitAsIs;
   WidgetCompositionEvent compositionCommitEvent(true, message, widget);
   InitEvent(compositionCommitEvent);
-  if (message == NS_COMPOSITION_COMMIT) {
+  if (message == eCompositionCommit) {
     compositionCommitEvent.mData = *aCommitString;
   }
   rv = DispatchEvent(widget, compositionCommitEvent, aStatus);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return NS_OK;
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -430,30 +430,30 @@ public:
   uint32_t RangeCount() const
   {
     return mRanges ? mRanges->Length() : 0;
   }
 
   bool CausesDOMTextEvent() const
   {
     return mMessage == eCompositionChange ||
-           mMessage == NS_COMPOSITION_COMMIT ||
+           mMessage == eCompositionCommit ||
            mMessage == eCompositionCommitAsIs;
   }
 
   bool CausesDOMCompositionEndEvent() const
   {
     return mMessage == eCompositionEnd ||
-           mMessage == NS_COMPOSITION_COMMIT ||
+           mMessage == eCompositionCommit ||
            mMessage == eCompositionCommitAsIs;
   }
 
   bool IsFollowedByCompositionEnd() const
   {
-    return mOriginalMessage == NS_COMPOSITION_COMMIT ||
+    return mOriginalMessage == eCompositionCommit ||
            mOriginalMessage == eCompositionCommitAsIs;
   }
 };
 
 /******************************************************************************
  * mozilla::WidgetQueryContentEvent
  ******************************************************************************/
 
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -136,17 +136,17 @@ bool
 WidgetEvent::HasIMEEventMessage() const
 {
   switch (mMessage) {
     case eCompositionStart:
     case eCompositionEnd:
     case eCompositionUpdate:
     case eCompositionChange:
     case eCompositionCommitAsIs:
-    case NS_COMPOSITION_COMMIT:
+    case eCompositionCommit:
       return true;
     default:
       return false;
   }
 }
 
 bool
 WidgetEvent::HasPluginActivationEventMessage() const
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -2048,17 +2048,17 @@ nsWindow::NotifyIMEInternal(const IMENot
         case REQUEST_TO_CANCEL_COMPOSITION:
             ALOGIME("IME: REQUEST_TO_CANCEL_COMPOSITION");
 
             // Cancel composition on Gecko side
             if (!!GetIMEComposition()) {
                 nsRefPtr<nsWindow> kungFuDeathGrip(this);
 
                 WidgetCompositionEvent compositionCommitEvent(
-                                         true, NS_COMPOSITION_COMMIT, this);
+                                         true, eCompositionCommit, this);
                 InitEvent(compositionCommitEvent, nullptr);
                 // Dispatch it with empty mData value for canceling the
                 // composition
                 DispatchEvent(&compositionCommitEvent);
             }
 
             GeckoAppShell::NotifyIME(REQUEST_TO_CANCEL_COMPOSITION);
             return NS_OK;
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2735,17 +2735,17 @@ IMEInputHandler::DispatchCompositionComm
 
   if (NS_WARN_IF(Destroyed())) {
     return false;
   }
 
   nsRefPtr<IMEInputHandler> kungFuDeathGrip(this);
 
   EventMessage message =
-    aCommitString ? NS_COMPOSITION_COMMIT : eCompositionCommitAsIs;
+    aCommitString ? eCompositionCommit : eCompositionCommitAsIs;
   WidgetCompositionEvent compositionCommitEvent(true, message, mWidget);
   compositionCommitEvent.time = PR_IntervalNow();
   if (aCommitString) {
     compositionCommitEvent.mData = *aCommitString;
   }
   return DispatchEvent(compositionCommitEvent);
 }
 
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -1434,27 +1434,27 @@ IMContextWrapper::DispatchCompositionCom
         nsCOMPtr<nsIWidget> kungFuDeathGrip(mLastFocusedWindow);
         if (!DispatchCompositionStart(aContext)) {
             return false;
         }
     }
 
     nsRefPtr<nsWindow> lastFocusedWindow(mLastFocusedWindow);
 
-    EventMessage message = aCommitString ? NS_COMPOSITION_COMMIT :
+    EventMessage message = aCommitString ? eCompositionCommit :
                                            eCompositionCommitAsIs;
     mCompositionState = eCompositionState_NotComposing;
     mCompositionStart = UINT32_MAX;
     mCompositionTargetRange.Clear();
     mDispatchedCompositionString.Truncate();
 
     WidgetCompositionEvent compositionCommitEvent(true, message,
                                                   mLastFocusedWindow);
     InitEvent(compositionCommitEvent);
-    if (message == NS_COMPOSITION_COMMIT) {
+    if (message == eCompositionCommit) {
         compositionCommitEvent.mData = *aCommitString;
     }
 
     nsEventStatus status = nsEventStatus_eIgnore;
     mLastFocusedWindow->DispatchEvent(&compositionCommitEvent, status);
 
     if (lastFocusedWindow->IsDestroyed() ||
         lastFocusedWindow != mLastFocusedWindow) {
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -1520,17 +1520,17 @@ IMMHandler::HandleEndComposition(nsWindo
      aCommitString ? NS_ConvertUTF16toUTF8(*aCommitString).get() : ""));
 
   if (mNativeCaretIsCreated) {
     ::DestroyCaret();
     mNativeCaretIsCreated = false;
   }
 
   EventMessage message =
-    aCommitString ? NS_COMPOSITION_COMMIT : eCompositionCommitAsIs;
+    aCommitString ? eCompositionCommit : eCompositionCommitAsIs;
   WidgetCompositionEvent compositionCommitEvent(true, message, aWindow);
   nsIntPoint point(0, 0);
   aWindow->InitEvent(compositionCommitEvent, &point);
   if (aCommitString) {
     compositionCommitEvent.mData = *aCommitString;
   }
   aWindow->DispatchWindowEvent(&compositionCommitEvent);
   mIsComposing = false;
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -1793,21 +1793,21 @@ TSFTextStore::FlushPendingActions()
                 this, NS_ConvertUTF16toUTF8(action.mData).get()));
 
         action.mData.ReplaceSubstring(NS_LITERAL_STRING("\r\n"),
                                       NS_LITERAL_STRING("\n"));
 
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
                ("TSF: 0x%p   TSFTextStore::FlushPendingActions(), "
                 "dispatching compositioncommit event...", this));
-        WidgetCompositionEvent compositionCommit(true, NS_COMPOSITION_COMMIT,
+        WidgetCompositionEvent compositionCommit(true, eCompositionCommit,
                                                  mWidget);
         mWidget->InitEvent(compositionCommit);
         compositionCommit.mData = action.mData;
-        // When the NS_COMPOSITION_COMMIT causes a DOM text event,
+        // When the eCompositionCommit causes a DOM text event,
         // the IME will be notified of NOTIFY_IME_OF_COMPOSITION_UPDATE.  In
         // such case, we should not clear the locked content until we notify
         // the IME of the composition update.
         if (compositionCommit.CausesDOMTextEvent()) {
           mDeferClearingLockedContent = true;
         }
         DispatchEvent(compositionCommit);
         if (!mWidget || mWidget->Destroyed()) {