Bug 895274 part.188 Rename NS_COMPOSITION_COMMIT_AS_IS to eCompositionCommitAsIs r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 11 Sep 2015 21:21:26 +0900
changeset 262005 6b29914363f3a7d104ec0d99c32e2b0abac0a8c9
parent 262004 c8d53164ac16956a6443bfefc71eae50001453d5
child 262006 9e8b629344d1b4a51369a5b1cea45649bead14ba
push idunknown
push userunknown
push dateunknown
reviewerssmaug
bugs895274
milestone43.0a1
Bug 895274 part.188 Rename NS_COMPOSITION_COMMIT_AS_IS to eCompositionCommitAsIs r=smaug
dom/events/IMEStateManager.cpp
dom/events/TextComposition.cpp
editor/libeditor/nsEditor.cpp
widget/ContentCache.cpp
widget/EventMessageList.h
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
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -140,18 +140,18 @@ GetEventMessageName(EventMessage aMessag
     case NS_COMPOSITION_START:
       return "NS_COMPOSITION_START";
     case NS_COMPOSITION_END:
       return "NS_COMPOSITION_END";
     case NS_COMPOSITION_UPDATE:
       return "NS_COMPOSITION_UPDATE";
     case NS_COMPOSITION_CHANGE:
       return "NS_COMPOSITION_CHANGE";
-    case NS_COMPOSITION_COMMIT_AS_IS:
-      return "NS_COMPOSITION_COMMIT_AS_IS";
+    case eCompositionCommitAsIs:
+      return "eCompositionCommitAsIs";
     case NS_COMPOSITION_COMMIT:
       return "NS_COMPOSITION_COMMIT";
     case eSetSelection:
       return "eSetSelection";
     default:
       return "unacceptable event message";
   }
 }
--- a/dom/events/TextComposition.cpp
+++ b/dom/events/TextComposition.cpp
@@ -229,22 +229,22 @@ TextComposition::DispatchCompositionEven
     }
     return;
   }
 
   if (!mAllowControlCharacters) {
     RemoveControlCharactersFrom(aCompositionEvent->mData,
                                 aCompositionEvent->mRanges);
   }
-  if (aCompositionEvent->mMessage == NS_COMPOSITION_COMMIT_AS_IS) {
+  if (aCompositionEvent->mMessage == eCompositionCommitAsIs) {
     NS_ASSERTION(!aCompositionEvent->mRanges,
-                 "mRanges of NS_COMPOSITION_COMMIT_AS_IS should be null");
+                 "mRanges of eCompositionCommitAsIs should be null");
     aCompositionEvent->mRanges = nullptr;
     NS_ASSERTION(aCompositionEvent->mData.IsEmpty(),
-                 "mData of NS_COMPOSITION_COMMIT_AS_IS should be empty string");
+                 "mData of eCompositionCommitAsIs should be empty string");
     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;
     }
@@ -281,17 +281,17 @@ TextComposition::DispatchCompositionEven
   // 1. committing string is empty string at requesting commit but the last
   //    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 NS_COMPOSITION_END:
       case NS_COMPOSITION_CHANGE:
-      case NS_COMPOSITION_COMMIT_AS_IS:
+      case eCompositionCommitAsIs:
       case NS_COMPOSITION_COMMIT:
         committingData = &aCompositionEvent->mData;
         break;
       default:
         NS_WARNING("Unexpected event comes during committing or "
                    "canceling composition");
         break;
     }
@@ -485,17 +485,17 @@ TextComposition::RequestToCommit(nsIWidg
   // If the request is performed synchronously, this must be already destroyed.
   if (Destroyed()) {
     return NS_OK;
   }
 
   // Otherwise, synthesize the commit in content.
   nsAutoString data(aDiscard ? EmptyString() : lastData);
   if (data == mLastData) {
-    DispatchCompositionEventRunnable(NS_COMPOSITION_COMMIT_AS_IS, EmptyString(),
+    DispatchCompositionEventRunnable(eCompositionCommitAsIs, EmptyString(),
                                      true);
   } else {
     DispatchCompositionEventRunnable(NS_COMPOSITION_COMMIT, data, true);
   }
   return NS_OK;
 }
 
 nsresult
@@ -621,20 +621,20 @@ TextComposition::CompositionEventDispatc
       compStart.mFlags.mIsSynthesizedForTests =
         mTextComposition->IsSynthesizedForTests();
       IMEStateManager::DispatchCompositionEvent(mEventTarget, presContext,
                                                 &compStart, &status, nullptr,
                                                 mIsSynthesizedEvent);
       break;
     }
     case NS_COMPOSITION_CHANGE:
-    case NS_COMPOSITION_COMMIT_AS_IS:
+    case eCompositionCommitAsIs:
     case NS_COMPOSITION_COMMIT: {
       WidgetCompositionEvent compEvent(true, mEventMessage, widget);
-      if (mEventMessage != NS_COMPOSITION_COMMIT_AS_IS) {
+      if (mEventMessage != eCompositionCommitAsIs) {
         compEvent.mData = mData;
       }
       compEvent.mFlags.mIsSynthesizedForTests =
         mTextComposition->IsSynthesizedForTests();
       IMEStateManager::DispatchCompositionEvent(mEventTarget, presContext,
                                                 &compEvent, &status, nullptr,
                                                 mIsSynthesizedEvent);
       break;
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -5158,17 +5158,17 @@ nsEditor::IsAcceptableInputEvent(nsIDOME
     case eUnidentifiedEvent:
       // If events are not created with proper event interface, their message
       // are initialized with eUnidentifiedEvent.  Let's ignore such event.
       return false;
     case NS_COMPOSITION_START:
     case NS_COMPOSITION_END:
     case NS_COMPOSITION_UPDATE:
     case NS_COMPOSITION_CHANGE:
-    case NS_COMPOSITION_COMMIT_AS_IS:
+    case eCompositionCommitAsIs:
       // Don't allow composition events whose internal event are not
       // WidgetCompositionEvent.
       widgetGUIEvent = aEvent->GetInternalNSEvent()->AsCompositionEvent();
       needsWidget = true;
       break;
     default:
       break;
   }
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -30,18 +30,18 @@ GetEventMessageName(EventMessage aMessag
     case NS_COMPOSITION_START:
       return "NS_COMPOSITION_START";
     case NS_COMPOSITION_END:
       return "NS_COMPOSITION_END";
     case NS_COMPOSITION_UPDATE:
       return "NS_COMPOSITION_UPDATE";
     case NS_COMPOSITION_CHANGE:
       return "NS_COMPOSITION_CHANGE";
-    case NS_COMPOSITION_COMMIT_AS_IS:
-      return "NS_COMPOSITION_COMMIT_AS_IS";
+    case eCompositionCommitAsIs:
+      return "eCompositionCommitAsIs";
     case NS_COMPOSITION_COMMIT:
       return "NS_COMPOSITION_COMMIT";
     case eSetSelection:
       return "eSetSelection";
     default:
       return "unacceptable event message";
   }
 }
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -156,23 +156,23 @@ NS_EVENT_MESSAGE(NS_COMPOSITION_END,    
 // by mozilla::TextComposition automatically if NS_COMPOSITION_CHANGE event
 // will change composition string.
 NS_EVENT_MESSAGE(NS_COMPOSITION_UPDATE,       NS_COMPOSITION_EVENT_START + 2)
 // NS_COMPOSITION_CHANGE is the message for representing a change of
 // composition string.  This should be dispatched from widget even if
 // composition string isn't changed but the ranges are changed.  This causes
 // a DOM "text" event which is a non-standard DOM event.
 NS_EVENT_MESSAGE(NS_COMPOSITION_CHANGE,       NS_COMPOSITION_EVENT_START + 3)
-// NS_COMPOSITION_COMMIT_AS_IS is the message for representing a commit of
+// 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
 // NS_COMPOSITION_CHANGE without clause information.  After that,
 // NS_COMPOSITION_END will be dispatched automatically.
 // Its mData and mRanges should be empty and nullptr.
-NS_EVENT_MESSAGE(NS_COMPOSITION_COMMIT_AS_IS, NS_COMPOSITION_EVENT_START + 4)
+NS_EVENT_MESSAGE(eCompositionCommitAsIs, NS_COMPOSITION_EVENT_START + 4)
 // NS_COMPOSITION_COMMIT is the message for representing a commit of
 // composition string with its mData value.  TextComposition will dispatch this
 // event to the DOM tree as NS_COMPOSITION_CHANGE without clause information.
 // After that, NS_COMPOSITION_END will be dispatched automatically.
 // Its mRanges should be nullptr.
 NS_EVENT_MESSAGE(NS_COMPOSITION_COMMIT,       NS_COMPOSITION_EVENT_START + 5)
 
 // Following events are defined for deprecated DOM events which are using
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -264,17 +264,17 @@ 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 :
-                                         NS_COMPOSITION_COMMIT_AS_IS;
+                                         eCompositionCommitAsIs;
   WidgetCompositionEvent compositionCommitEvent(true, message, widget);
   InitEvent(compositionCommitEvent);
   if (message == NS_COMPOSITION_COMMIT) {
     compositionCommitEvent.mData = *aCommitString;
   }
   rv = DispatchEvent(widget, compositionCommitEvent, aStatus);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -431,30 +431,30 @@ public:
   {
     return mRanges ? mRanges->Length() : 0;
   }
 
   bool CausesDOMTextEvent() const
   {
     return mMessage == NS_COMPOSITION_CHANGE ||
            mMessage == NS_COMPOSITION_COMMIT ||
-           mMessage == NS_COMPOSITION_COMMIT_AS_IS;
+           mMessage == eCompositionCommitAsIs;
   }
 
   bool CausesDOMCompositionEndEvent() const
   {
     return mMessage == NS_COMPOSITION_END ||
            mMessage == NS_COMPOSITION_COMMIT ||
-           mMessage == NS_COMPOSITION_COMMIT_AS_IS;
+           mMessage == eCompositionCommitAsIs;
   }
 
   bool IsFollowedByCompositionEnd() const
   {
     return mOriginalMessage == NS_COMPOSITION_COMMIT ||
-           mOriginalMessage == NS_COMPOSITION_COMMIT_AS_IS;
+           mOriginalMessage == eCompositionCommitAsIs;
   }
 };
 
 /******************************************************************************
  * mozilla::WidgetQueryContentEvent
  ******************************************************************************/
 
 class WidgetQueryContentEvent : public WidgetGUIEvent
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -135,17 +135,17 @@ WidgetEvent::HasKeyEventMessage() const
 bool
 WidgetEvent::HasIMEEventMessage() const
 {
   switch (mMessage) {
     case NS_COMPOSITION_START:
     case NS_COMPOSITION_END:
     case NS_COMPOSITION_UPDATE:
     case NS_COMPOSITION_CHANGE:
-    case NS_COMPOSITION_COMMIT_AS_IS:
+    case eCompositionCommitAsIs:
     case NS_COMPOSITION_COMMIT:
       return true;
     default:
       return false;
   }
 }
 
 bool
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1681,18 +1681,17 @@ nsWindow::RemoveIMEComposition()
     // Remove composition on Gecko side
     if (!GetIMEComposition()) {
         return;
     }
 
     nsRefPtr<nsWindow> kungFuDeathGrip(this);
     AutoIMEMask selMask(mIMEMaskSelectionUpdate);
 
-    WidgetCompositionEvent compositionCommitEvent(true,
-                                                  NS_COMPOSITION_COMMIT_AS_IS,
+    WidgetCompositionEvent compositionCommitEvent(true, eCompositionCommitAsIs,
                                                   this);
     InitEvent(compositionCommitEvent, nullptr);
     DispatchEvent(&compositionCommitEvent);
 }
 
 /*
  * Send dummy key events for pages that are unaware of input events,
  * to provide web compatibility for pages that depend on key events.
@@ -1859,17 +1858,17 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
                 event.mRanges->AppendElement(range);
 
                 DispatchEvent(&event);
             }
 
             // Don't end composition when composing text.
             if (ae->Action() != AndroidGeckoEvent::IME_COMPOSE_TEXT) {
                 WidgetCompositionEvent compositionCommitEvent(
-                        true, NS_COMPOSITION_COMMIT_AS_IS, this);
+                        true, eCompositionCommitAsIs, this);
                 InitEvent(compositionCommitEvent, nullptr);
                 DispatchEvent(&compositionCommitEvent);
             }
 
             if (mInputContext.mMayBeIMEUnaware) {
                 SendIMEDummyKeyEvents();
             }
 
--- 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 : NS_COMPOSITION_COMMIT_AS_IS;
+    aCommitString ? NS_COMPOSITION_COMMIT : 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
@@ -1435,17 +1435,17 @@ IMContextWrapper::DispatchCompositionCom
         if (!DispatchCompositionStart(aContext)) {
             return false;
         }
     }
 
     nsRefPtr<nsWindow> lastFocusedWindow(mLastFocusedWindow);
 
     EventMessage message = aCommitString ? NS_COMPOSITION_COMMIT :
-                                           NS_COMPOSITION_COMMIT_AS_IS;
+                                           eCompositionCommitAsIs;
     mCompositionState = eCompositionState_NotComposing;
     mCompositionStart = UINT32_MAX;
     mCompositionTargetRange.Clear();
     mDispatchedCompositionString.Truncate();
 
     WidgetCompositionEvent compositionCommitEvent(true, message,
                                                   mLastFocusedWindow);
     InitEvent(compositionCommitEvent);
--- 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 : NS_COMPOSITION_COMMIT_AS_IS;
+    aCommitString ? NS_COMPOSITION_COMMIT : eCompositionCommitAsIs;
   WidgetCompositionEvent compositionCommitEvent(true, message, aWindow);
   nsIntPoint point(0, 0);
   aWindow->InitEvent(compositionCommitEvent, &point);
   if (aCommitString) {
     compositionCommitEvent.mData = *aCommitString;
   }
   aWindow->DispatchWindowEvent(&compositionCommitEvent);
   mIsComposing = false;