Bug 895274 part.190 Rename NS_COMPOSITION_START to eCompositionStart r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 11 Sep 2015 21:21:27 +0900
changeset 261944 094135c410a51de44a0080a904e01928021e3a3f
parent 261943 9e8b629344d1b4a51369a5b1cea45649bead14ba
child 261945 e6420651e2c9ae7f21b03ac38c1424776c8f2179
push id64887
push usermasayuki@d-toybox.com
push dateFri, 11 Sep 2015 12:21:40 +0000
treeherdermozilla-inbound@f49b4cddbc85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs895274
milestone43.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 895274 part.190 Rename NS_COMPOSITION_START to eCompositionStart r=smaug
dom/events/EventNameList.h
dom/events/EventStateManager.cpp
dom/events/IMEStateManager.cpp
dom/events/TextComposition.cpp
editor/libeditor/nsEditor.cpp
editor/libeditor/nsEditorEventListener.cpp
widget/ContentCache.cpp
widget/EventMessageList.h
widget/TextEventDispatcher.cpp
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/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -671,17 +671,17 @@ NON_IDL_EVENT(speakerforcedchange,
  // "text" event is legacy event for modifying composition string in nsEditor.
  // This shouldn't be used by web/xul apps.  "compositionupdate" should be
  // used instead.
 NON_IDL_EVENT(text,
               NS_COMPOSITION_CHANGE,
               EventNameType_XUL,
               eCompositionEventClass)
 NON_IDL_EVENT(compositionstart,
-              NS_COMPOSITION_START,
+              eCompositionStart,
               EventNameType_XUL,
               eCompositionEventClass)
 NON_IDL_EVENT(compositionupdate,
               NS_COMPOSITION_UPDATE,
               EventNameType_XUL,
               eCompositionEventClass)
 NON_IDL_EVENT(compositionend,
               NS_COMPOSITION_END,
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -754,17 +754,17 @@ EventStateManager::PreHandleEvent(nsPres
   case eContentCommandUndo:
   case eContentCommandRedo:
   case eContentCommandPasteTransferable:
     DoContentCommandEvent(aEvent->AsContentCommandEvent());
     break;
   case eContentCommandScroll:
     DoContentCommandScrollEvent(aEvent->AsContentCommandEvent());
     break;
-  case NS_COMPOSITION_START:
+  case eCompositionStart:
     if (aEvent->mFlags.mIsTrusted) {
       // If the event is trusted event, set the selected text to data of
       // composition event.
       WidgetCompositionEvent* compositionEvent = aEvent->AsCompositionEvent();
       WidgetQueryContentEvent selectedText(true, eQuerySelectedText,
                                            compositionEvent->widget);
       HandleQueryContentEvent(&selectedText);
       NS_ASSERTION(selectedText.mSucceeded, "Failed to get selected text");
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -132,18 +132,18 @@ GetIMEStateSetOpenName(IMEState::Open aO
       return "illegal value";
   }
 }
 
 static const char*
 GetEventMessageName(EventMessage aMessage)
 {
   switch (aMessage) {
-    case NS_COMPOSITION_START:
-      return "NS_COMPOSITION_START";
+    case eCompositionStart:
+      return "eCompositionStart";
     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 eCompositionCommitAsIs:
       return "eCompositionCommitAsIs";
@@ -1158,25 +1158,25 @@ IMEStateManager::DispatchCompositionEven
     // If synthesized event comes after delayed native composition events
     // for request of commit or cancel, we should ignore it.
     if (NS_WARN_IF(aIsSynthesized)) {
       return;
     }
     MOZ_LOG(sISMLog, LogLevel::Debug,
       ("ISM:   IMEStateManager::DispatchCompositionEvent(), "
        "adding new TextComposition to the array"));
-    MOZ_ASSERT(aCompositionEvent->mMessage == NS_COMPOSITION_START);
+    MOZ_ASSERT(aCompositionEvent->mMessage == eCompositionStart);
     composition =
       new TextComposition(aPresContext, aEventTargetNode, tabParent,
                           aCompositionEvent);
     sTextCompositions->AppendElement(composition);
   }
 #ifdef DEBUG
   else {
-    MOZ_ASSERT(aCompositionEvent->mMessage != NS_COMPOSITION_START);
+    MOZ_ASSERT(aCompositionEvent->mMessage != eCompositionStart);
   }
 #endif // #ifdef DEBUG
 
   // Dispatch the event on composing target.
   composition->DispatchCompositionEvent(aCompositionEvent, aStatus, aCallBack,
                                         aIsSynthesized);
 
   // WARNING: the |composition| might have been destroyed already.
@@ -1272,17 +1272,17 @@ IMEStateManager::OnCompositionEventDisca
      GetBoolName(aCompositionEvent->mFlags.mIsTrusted)));
 
   if (!aCompositionEvent->mFlags.mIsTrusted) {
     return;
   }
 
   // Ignore compositionstart for now because sTextCompositions may not have
   // been created yet.
-  if (aCompositionEvent->mMessage == NS_COMPOSITION_START) {
+  if (aCompositionEvent->mMessage == eCompositionStart) {
     return;
   }
 
   nsRefPtr<TextComposition> composition =
     sTextCompositions->GetCompositionFor(aCompositionEvent->widget);
   if (!composition) {
     // If the PresShell has been being destroyed during composition,
     // a TextComposition instance for the composition was already removed from
--- a/dom/events/TextComposition.cpp
+++ b/dom/events/TextComposition.cpp
@@ -407,17 +407,17 @@ TextComposition::NotityUpdateComposition
 {
   MOZ_RELEASE_ASSERT(!mTabParent);
 
   nsEventStatus status;
 
   // When compositon start, notify the rect of first offset character.
   // When not compositon start, notify the rect of selected composition
   // string if compositionchange event.
-  if (aCompositionEvent->mMessage == NS_COMPOSITION_START) {
+  if (aCompositionEvent->mMessage == eCompositionStart) {
     nsCOMPtr<nsIWidget> widget = mPresContext->GetRootWidget();
     // Update composition start offset
     WidgetQueryContentEvent selectedTextEvent(true, eQuerySelectedText, widget);
     widget->DispatchEvent(&selectedTextEvent, status);
     if (selectedTextEvent.mSucceeded) {
       mCompositionStartOffset = selectedTextEvent.mReply.mOffset;
     } else {
       // Unknown offset
@@ -606,18 +606,18 @@ TextComposition::CompositionEventDispatc
   nsCOMPtr<nsIWidget> widget(mTextComposition->GetWidget());
   if (!mTextComposition->IsValidStateForComposition(widget)) {
     return NS_OK; // cannot dispatch any events anymore
   }
 
   nsRefPtr<nsPresContext> presContext = mTextComposition->mPresContext;
   nsEventStatus status = nsEventStatus_eIgnore;
   switch (mEventMessage) {
-    case NS_COMPOSITION_START: {
-      WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, widget);
+    case eCompositionStart: {
+      WidgetCompositionEvent compStart(true, eCompositionStart, widget);
       WidgetQueryContentEvent selectedText(true, eQuerySelectedText, widget);
       ContentEventHandler handler(presContext);
       handler.OnQuerySelectedText(&selectedText);
       NS_ASSERTION(selectedText.mSucceeded, "Failed to get selected text");
       compStart.mData = selectedText.mReply.mString;
       compStart.mFlags.mIsSynthesizedForTests =
         mTextComposition->IsSynthesizedForTests();
       IMEStateManager::DispatchCompositionEvent(mEventTarget, presContext,
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -5154,17 +5154,17 @@ nsEditor::IsAcceptableInputEvent(nsIDOME
   // strange event order.
   bool needsWidget = false;
   WidgetGUIEvent* widgetGUIEvent = nullptr;
   switch (widgetEvent->mMessage) {
     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 eCompositionStart:
     case NS_COMPOSITION_END:
     case NS_COMPOSITION_UPDATE:
     case NS_COMPOSITION_CHANGE:
     case eCompositionCommitAsIs:
       // Don't allow composition events whose internal event are not
       // WidgetCompositionEvent.
       widgetGUIEvent = aEvent->GetInternalNSEvent()->AsCompositionEvent();
       needsWidget = true;
--- a/editor/libeditor/nsEditorEventListener.cpp
+++ b/editor/libeditor/nsEditorEventListener.cpp
@@ -458,17 +458,17 @@ nsEditorEventListener::HandleEvent(nsIDO
       return Focus(aEvent);
     // blur
     case eBlur:
       return Blur(aEvent);
     // text
     case NS_COMPOSITION_CHANGE:
       return HandleText(aEvent);
     // compositionstart
-    case NS_COMPOSITION_START:
+    case eCompositionStart:
       return HandleStartComposition(aEvent);
     // compositionend
     case NS_COMPOSITION_END:
       HandleEndComposition(aEvent);
       return NS_OK;
     default:
       break;
   }
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -22,18 +22,18 @@ GetBoolName(bool aBool)
 {
   return aBool ? "true" : "false";
 }
 
 static const char*
 GetEventMessageName(EventMessage aMessage)
 {
   switch (aMessage) {
-    case NS_COMPOSITION_START:
-      return "NS_COMPOSITION_START";
+    case eCompositionStart:
+      return "eCompositionStart";
     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 eCompositionCommitAsIs:
       return "eCompositionCommitAsIs";
@@ -853,17 +853,17 @@ ContentCacheInParent::OnCompositionEvent
      "mRequestedToCommitOrCancelComposition=%s",
      this, GetEventMessageName(aEvent.mMessage),
      NS_ConvertUTF16toUTF8(aEvent.mData).get(), aEvent.mData.Length(),
      aEvent.mRanges ? aEvent.mRanges->Length() : 0, mPendingEventsNeedingAck,
      GetBoolName(mIsComposing),
      GetBoolName(mRequestedToCommitOrCancelComposition)));
 
   if (!aEvent.CausesDOMTextEvent()) {
-    MOZ_ASSERT(aEvent.mMessage == NS_COMPOSITION_START);
+    MOZ_ASSERT(aEvent.mMessage == eCompositionStart);
     mIsComposing = !aEvent.CausesDOMCompositionEndEvent();
     mCompositionStart = mSelection.StartOffset();
     // XXX What's this case??
     if (mRequestedToCommitOrCancelComposition) {
       mCommitStringByRequest = aEvent.mData;
       mCompositionEventsDuringRequest++;
       return false;
     }
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -141,17 +141,17 @@ NS_EVENT_MESSAGE(eLegacyNodeInsertedInto
 NS_EVENT_MESSAGE(eLegacyAttrModified,             eLegacyMutationEventFirst + 5)
 NS_EVENT_MESSAGE(eLegacyCharacterDataModified,    eLegacyMutationEventFirst + 6)
 NS_EVENT_MESSAGE(eLegacyMutationEventLast,        eLegacyCharacterDataModified)
 
 NS_EVENT_MESSAGE(eUnidentifiedEvent,    2000)
  
 // composition events
 NS_EVENT_MESSAGE(eCompositionEventFirst, 2200)
-NS_EVENT_MESSAGE(NS_COMPOSITION_START,   eCompositionEventFirst)
+NS_EVENT_MESSAGE(eCompositionStart,      eCompositionEventFirst)
 // NS_COMPOSITION_END is the message for DOM compositionend event.
 // This event should NOT be dispatched from widget if NS_COMPOSITION_COMMIT
 // is available.
 NS_EVENT_MESSAGE(NS_COMPOSITION_END,     eCompositionEventFirst + 1)
 // NS_COMPOSITION_UPDATE 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 NS_COMPOSITION_CHANGE event
 // will change composition string.
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -186,17 +186,17 @@ TextEventDispatcher::StartComposition(ns
     return rv;
   }
 
   if (NS_WARN_IF(mIsComposing)) {
     return NS_ERROR_FAILURE;
   }
 
   mIsComposing = true;
-  WidgetCompositionEvent compositionStartEvent(true, NS_COMPOSITION_START,
+  WidgetCompositionEvent compositionStartEvent(true, eCompositionStart,
                                                mWidget);
   InitEvent(compositionStartEvent);
   rv = DispatchEvent(mWidget, compositionStartEvent, aStatus);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return NS_OK;
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -131,17 +131,17 @@ WidgetEvent::HasKeyEventMessage() const
       return false;
   }
 }
 
 bool
 WidgetEvent::HasIMEEventMessage() const
 {
   switch (mMessage) {
-    case NS_COMPOSITION_START:
+    case eCompositionStart:
     case NS_COMPOSITION_END:
     case NS_COMPOSITION_UPDATE:
     case NS_COMPOSITION_CHANGE:
     case eCompositionCommitAsIs:
     case NS_COMPOSITION_COMMIT:
       return true;
     default:
       return false;
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1822,18 +1822,17 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
                     mIMEKeyEvents.Clear();
                     FlushIMEChanges();
                     GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
                     // Break out of the switch block
                     break;
                 }
 
                 {
-                    WidgetCompositionEvent event(
-                        true, NS_COMPOSITION_START, this);
+                    WidgetCompositionEvent event(true, eCompositionStart, this);
                     InitEvent(event, nullptr);
                     DispatchEvent(&event);
                 }
 
             } else if (composition->String().Equals(ae->Characters())) {
                 /* If the new text is the same as the existing composition text,
                  * the NS_COMPOSITION_CHANGE event does not generate a text
                  * change notification. However, the Java side still expects
@@ -1978,18 +1977,17 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
                                                        this);
                     InitEvent(queryEvent, nullptr);
                     DispatchEvent(&queryEvent);
                     MOZ_ASSERT(queryEvent.mSucceeded);
                     event.mData = queryEvent.mReply.mString;
                 }
 
                 {
-                    WidgetCompositionEvent event(
-                        true, NS_COMPOSITION_START, this);
+                    WidgetCompositionEvent event(true, eCompositionStart, this);
                     InitEvent(event, nullptr);
                     DispatchEvent(&event);
                 }
 
             } else {
                 // If the new composition matches the existing composition,
                 // reuse the old composition.
                 event.mData = composition->String();
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2808,17 +2808,17 @@ IMEInputHandler::InsertTextAsCommittingC
     // range as selection.
     if (aReplacementRange && aReplacementRange->location != NSNotFound &&
         !NSEqualRanges(SelectedRange(), *aReplacementRange)) {
       NS_ENSURE_TRUE_VOID(SetSelection(*aReplacementRange));
     }
 
     // XXXmnakano Probably, we shouldn't emulate composition in this case.
     // I think that we should just fire DOM3 textInput event if we implement it.
-    WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
+    WidgetCompositionEvent compStart(true, eCompositionStart, mWidget);
     InitCompositionEvent(compStart);
 
     DispatchEvent(compStart);
     if (Destroyed()) {
       MOZ_LOG(gLog, LogLevel::Info,
         ("%p IMEInputHandler::InsertTextAsCommittingComposition, "
          "destroyed by compositionstart event", this));
       return;
@@ -2898,17 +2898,17 @@ IMEInputHandler::SetMarkedText(NSAttribu
     // range as selection.
     if (aReplacementRange && aReplacementRange->location != NSNotFound &&
         !NSEqualRanges(SelectedRange(), *aReplacementRange)) {
       NS_ENSURE_TRUE_VOID(SetSelection(*aReplacementRange));
     }
 
     mMarkedRange.location = SelectedRange().location;
 
-    WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
+    WidgetCompositionEvent compStart(true, eCompositionStart, mWidget);
     InitCompositionEvent(compStart);
 
     DispatchEvent(compStart);
     if (Destroyed()) {
       MOZ_LOG(gLog, LogLevel::Info,
         ("%p IMEInputHandler::SetMarkedText, "
          "destroyed by compositionstart event", this));
       return;
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -910,17 +910,17 @@ IMContextWrapper::OnSelectionChange(nsWi
     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.
         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 NS_COMPOSITION_START,
+    // event handler.  So, we're dispatching eCompositionStart,
     // we should ignore selection change notification.
     if (mCompositionState == eCompositionState_CompositionStartDispatched) {
         if (NS_WARN_IF(!mSelection.IsValid())) {
             MOZ_LOG(gGtkIMLog, LogLevel::Error,
                 ("GTKIM: %p   OnSelectionChange(), FAILED, "
                  "new offset is too large, cannot keep composing",
                  this));
         } else {
@@ -1298,17 +1298,17 @@ IMContextWrapper::DispatchCompositionSta
             return false;
         }
     }
 
     MOZ_LOG(gGtkIMLog, LogLevel::Debug,
         ("GTKIM: %p   DispatchCompositionStart(), FAILED, mCompositionStart=%u",
          this, mCompositionStart));
     mCompositionState = eCompositionState_CompositionStartDispatched;
-    WidgetCompositionEvent compEvent(true, NS_COMPOSITION_START,
+    WidgetCompositionEvent compEvent(true, eCompositionStart,
                                      mLastFocusedWindow);
     InitEvent(compEvent);
     nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
     nsEventStatus status;
     mLastFocusedWindow->DispatchEvent(&compEvent, status);
     if (static_cast<nsWindow*>(kungFuDeathGrip.get())->IsDestroyed() ||
         kungFuDeathGrip != mLastFocusedWindow) {
         MOZ_LOG(gGtkIMLog, LogLevel::Error,
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -1245,17 +1245,17 @@ IMMHandler::HandleStartComposition(nsWin
     return;
   }
 
   AdjustCompositionFont(aContext, selection.mWritingMode);
 
   mCompositionStart = selection.mOffset;
   mCursorPosition = NO_IME_CARET;
 
-  WidgetCompositionEvent event(true, NS_COMPOSITION_START, aWindow);
+  WidgetCompositionEvent event(true, eCompositionStart, aWindow);
   nsIntPoint point(0, 0);
   aWindow->InitEvent(event, &point);
   aWindow->DispatchWindowEvent(&event);
 
   mIsComposing = true;
   mComposingWindow = aWindow;
 
   MOZ_LOG(gIMMLog, LogLevel::Info,
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -1700,20 +1700,20 @@ TSFTextStore::FlushPendingActions()
                    ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                     "FAILED due to eSetSelection failure", this));
             break;
           }
         }
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
                ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                 "dispatching compositionstart event...", this));
-        WidgetCompositionEvent compositionStart(true, NS_COMPOSITION_START,
+        WidgetCompositionEvent compositionStart(true, eCompositionStart,
                                                 mWidget);
         mWidget->InitEvent(compositionStart);
-        // NS_COMPOSITION_START always causes NOTIFY_IME_OF_COMPOSITION_UPDATE.
+        // eCompositionStart always causes NOTIFY_IME_OF_COMPOSITION_UPDATE.
         // Therefore, we should wait to clear the locked content until it's
         // notified.
         mDeferClearingLockedContent = true;
         DispatchEvent(compositionStart);
         if (!mWidget || mWidget->Destroyed()) {
           break;
         }
         break;