Bug 895274 part.149 Rename NS_USER_DEFINED_EVENT to eUnidentifiedEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 10 Sep 2015 10:40:04 +0900
changeset 261696 4cdae41b9305f75ac82226a52f860ecd512c547c
parent 261695 7f6201ff997f763e3e6aff0689b742c043244a39
child 261697 4557cfecc20d65bc48fe43b6460038473fd4ed7d
push id29355
push usercbook@mozilla.com
push dateFri, 11 Sep 2015 14:37:04 +0000
treeherdermozilla-central@19f806034f67 [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.149 Rename NS_USER_DEFINED_EVENT to eUnidentifiedEvent r=smaug
dom/base/FragmentOrElement.cpp
dom/base/TextInputProcessor.cpp
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
dom/events/Event.cpp
dom/events/EventListenerManager.cpp
dom/events/EventListenerManager.h
editor/libeditor/nsEditor.cpp
widget/EventMessageList.h
widget/MiscEvents.h
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -811,17 +811,17 @@ nsIContent::PreHandleEvent(EventChainPre
       case eFormSelect:
       case eFormChange:
       case eLoad:
       case eFormReset:
       case eResize:
       case eScroll:
         stopEvent = true;
         break;
-      case NS_USER_DEFINED_EVENT:
+      case eUnidentifiedEvent:
         if (aVisitor.mDOMEvent) {
           nsAutoString eventType;
           aVisitor.mDOMEvent->GetType(eventType);
           if (eventType.EqualsLiteral("abort") ||
               eventType.EqualsLiteral("error") ||
               eventType.EqualsLiteral("select") ||
               eventType.EqualsLiteral("change") ||
               eventType.EqualsLiteral("load") ||
--- a/dom/base/TextInputProcessor.cpp
+++ b/dom/base/TextInputProcessor.cpp
@@ -247,17 +247,17 @@ TextInputProcessor::IsValidStateForCompo
 bool
 TextInputProcessor::IsValidEventTypeForComposition(
                       const WidgetKeyboardEvent& aKeyboardEvent) const
 {
   // The key event type of composition methods must be "" or "keydown".
   if (aKeyboardEvent.mMessage == eKeyDown) {
     return true;
   }
-  if (aKeyboardEvent.mMessage == NS_USER_DEFINED_EVENT &&
+  if (aKeyboardEvent.mMessage == eUnidentifiedEvent &&
       aKeyboardEvent.userType &&
       nsDependentAtomString(aKeyboardEvent.userType).EqualsLiteral("on")) {
     return true;
   }
   return false;
 }
 
 TextInputProcessor::EventDispatcherResult
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -3677,17 +3677,17 @@ nsContentUtils::GetEventMessage(nsIAtom*
 {
   if (aName) {
     EventNameMapping mapping;
     if (sAtomEventTable->Get(aName, &mapping)) {
       return mapping.mMessage;
     }
   }
 
-  return NS_USER_DEFINED_EVENT;
+  return eUnidentifiedEvent;
 }
 
 // static
 mozilla::EventClassID
 nsContentUtils::GetEventClassID(const nsAString& aName)
 {
   EventNameMapping mapping;
   if (sStringEventTable->Get(aName, &mapping))
@@ -3700,34 +3700,34 @@ nsIAtom*
 nsContentUtils::GetEventMessageAndAtom(const nsAString& aName,
                                        mozilla::EventClassID aEventClassID,
                                        EventMessage* aEventMessage)
 {
   EventNameMapping mapping;
   if (sStringEventTable->Get(aName, &mapping)) {
     *aEventMessage =
       mapping.mEventClassID == aEventClassID ? mapping.mMessage :
-                                               NS_USER_DEFINED_EVENT;
+                                               eUnidentifiedEvent;
     return mapping.mAtom;
   }
 
   // If we have cached lots of user defined event names, clear some of them.
   if (sUserDefinedEvents->Count() > 127) {
     while (sUserDefinedEvents->Count() > 64) {
       nsIAtom* first = sUserDefinedEvents->ObjectAt(0);
       sStringEventTable->Remove(Substring(nsDependentAtomString(first), 2));
       sUserDefinedEvents->RemoveObjectAt(0);
     }
   }
 
-  *aEventMessage = NS_USER_DEFINED_EVENT;
+  *aEventMessage = eUnidentifiedEvent;
   nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aName);
   sUserDefinedEvents->AppendObject(atom);
   mapping.mAtom = atom;
-  mapping.mMessage = NS_USER_DEFINED_EVENT;
+  mapping.mMessage = eUnidentifiedEvent;
   mapping.mType = EventNameType_None;
   mapping.mEventClassID = eBasicEventClass;
   sStringEventTable->Put(aName, mapping);
   return mapping.mAtom;
 }
 
 static
 nsresult GetEventAndTarget(nsIDocument* aDoc, nsISupports* aTarget,
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -1096,17 +1096,17 @@ public:
    *
    * @param aName the event name to look up
    * @param aType the type of content
    */
   static bool IsEventAttributeName(nsIAtom* aName, int32_t aType);
 
   /**
    * Return the event message for the event with the given name. The name is
-   * the event name with the 'on' prefix. Returns NS_USER_DEFINED_EVENT if the
+   * the event name with the 'on' prefix. Returns eUnidentifiedEvent if the
    * event doesn't match a known event name.
    *
    * @param aName the event name to look up
    */
   static mozilla::EventMessage GetEventMessage(nsIAtom* aName);
 
   /**
    * Return the EventClassID for the event with the given name. The name is the
@@ -1115,17 +1115,17 @@ public:
    *
    * @param aName the event name to look up
    */
   static mozilla::EventClassID GetEventClassID(const nsAString& aName);
 
   /**
    * Return the event message and atom for the event with the given name.
    * The name is the event name *without* the 'on' prefix.
-   * Returns NS_USER_DEFINED_EVENT on the aEventID if the
+   * Returns eUnidentifiedEvent on the aEventID if the
    * event doesn't match a known event name in the category.
    *
    * @param aName the event name to look up
    * @param aEventClassID only return event id for aEventClassID
    */
   static nsIAtom* GetEventMessageAndAtom(const nsAString& aName,
                                          mozilla::EventClassID aEventClassID,
                                          mozilla::EventMessage* aEventMessage);
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -265,17 +265,17 @@ Event::GetType(nsAString& aType)
     aType = mEvent->typeString;
     return NS_OK;
   }
   const char* name = GetEventName(mEvent->mMessage);
 
   if (name) {
     CopyASCIItoUTF16(name, aType);
     return NS_OK;
-  } else if (mEvent->mMessage == NS_USER_DEFINED_EVENT && mEvent->userType) {
+  } else if (mEvent->mMessage == eUnidentifiedEvent && mEvent->userType) {
     aType = Substring(nsDependentAtomString(mEvent->userType), 2); // Remove "on"
     mEvent->typeString = aType;
     return NS_OK;
   }
 
   aType.Truncate();
   return NS_OK;
 }
@@ -562,17 +562,17 @@ Event::SetEventType(const nsAString& aEv
 {
   if (mIsMainThreadEvent) {
     mEvent->typeString.Truncate();
     mEvent->userType =
       nsContentUtils::GetEventMessageAndAtom(aEventTypeArg, mEvent->mClass,
                                              &(mEvent->mMessage));
   } else {
     mEvent->userType = nullptr;
-    mEvent->mMessage = NS_USER_DEFINED_EVENT;
+    mEvent->mMessage = eUnidentifiedEvent;
     mEvent->typeString = aEventTypeArg;
   }
 }
 
 NS_IMETHODIMP
 Event::InitEvent(const nsAString& aEventTypeArg,
                  bool aCanBubbleArg,
                  bool aCancelableArg)
--- a/dom/events/EventListenerManager.cpp
+++ b/dom/events/EventListenerManager.cpp
@@ -50,17 +50,17 @@
 
 namespace mozilla {
 
 using namespace dom;
 using namespace hal;
 
 #define EVENT_TYPE_EQUALS(ls, message, userType, typeString, allEvents) \
   ((ls->mEventMessage == message &&                                     \
-    (ls->mEventMessage != NS_USER_DEFINED_EVENT ||                      \
+    (ls->mEventMessage != eUnidentifiedEvent ||                         \
     (mIsMainThreadELM && ls->mTypeAtom == userType) ||                  \
     (!mIsMainThreadELM && ls->mTypeString.Equals(typeString)))) ||      \
    (allEvents && ls->mAllEvents))
 
 static const uint32_t kAllMutationBits =
   NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED |
   NS_EVENT_BITS_MUTATION_NODEINSERTED |
   NS_EVENT_BITS_MUTATION_NODEREMOVED |
@@ -564,23 +564,23 @@ EventListenerManager::RemoveEventListene
   }
 }
 
 bool
 EventListenerManager::ListenerCanHandle(Listener* aListener,
                                         WidgetEvent* aEvent)
 {
   // This is slightly different from EVENT_TYPE_EQUALS in that it returns
-  // true even when aEvent->mMessage == NS_USER_DEFINED_EVENT and
-  // aListener=>mEventMessage != NS_USER_DEFINED_EVENT as long as the atoms are
+  // true even when aEvent->mMessage == eUnidentifiedEvent and
+  // aListener=>mEventMessage != eUnidentifiedEvent as long as the atoms are
   // the same
   if (aListener->mAllEvents) {
     return true;
   }
-  if (aEvent->mMessage == NS_USER_DEFINED_EVENT) {
+  if (aEvent->mMessage == eUnidentifiedEvent) {
     if (mIsMainThreadELM) {
       return aListener->mTypeAtom == aEvent->userType;
     }
     return aListener->mTypeString.Equals(aEvent->typeString);
   }
   MOZ_ASSERT(mIsMainThreadELM);
   return aListener->mEventMessage == aEvent->mMessage;
 }
--- a/dom/events/EventListenerManager.h
+++ b/dom/events/EventListenerManager.h
@@ -337,17 +337,17 @@ public:
     }
 
     if (!mMayHaveSystemGroupListeners && aEvent->mFlags.mInSystemGroup) {
       return;
     }
 
     // Check if we already know that there is no event listener for the event.
     if (mNoListenerForEvent == aEvent->mMessage &&
-        (mNoListenerForEvent != NS_USER_DEFINED_EVENT ||
+        (mNoListenerForEvent != eUnidentifiedEvent ||
          mNoListenerForEventAtom == aEvent->userType)) {
       return;
     }
     HandleEventInternal(aPresContext, aEvent, aDOMEvent, aCurrentTarget,
                         aEventStatus);
   }
 
   /**
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -5150,19 +5150,19 @@ nsEditor::IsAcceptableInputEvent(nsIDOME
   // If a composition event isn't dispatched via widget, we need to ignore them
   // since they cannot be managed by TextComposition. E.g., the event was
   // created by chrome JS.
   // Note that if we allow to handle such events, editor may be confused by
   // strange event order.
   bool needsWidget = false;
   WidgetGUIEvent* widgetGUIEvent = nullptr;
   switch (widgetEvent->mMessage) {
-    case NS_USER_DEFINED_EVENT:
+    case eUnidentifiedEvent:
       // If events are not created with proper event interface, their message
-      // are initialized with NS_USER_DEFINED_EVENT.  Let's ignore such event.
+      // 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:
       // Don't allow composition events whose internal event are not
       // WidgetCompositionEvent.
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -137,17 +137,17 @@ NS_EVENT_MESSAGE(eLegacySubtreeModified,
 NS_EVENT_MESSAGE(eLegacyNodeInserted,             eLegacyMutationEventFirst + 1)
 NS_EVENT_MESSAGE(eLegacyNodeRemoved,              eLegacyMutationEventFirst + 2)
 NS_EVENT_MESSAGE(eLegacyNodeRemovedFromDocument,  eLegacyMutationEventFirst + 3)
 NS_EVENT_MESSAGE(eLegacyNodeInsertedIntoDocument, eLegacyMutationEventFirst + 4)
 NS_EVENT_MESSAGE(eLegacyAttrModified,             eLegacyMutationEventFirst + 5)
 NS_EVENT_MESSAGE(eLegacyCharacterDataModified,    eLegacyMutationEventFirst + 6)
 NS_EVENT_MESSAGE(eLegacyMutationEventLast,        eLegacyCharacterDataModified)
 
-NS_EVENT_MESSAGE(NS_USER_DEFINED_EVENT, 2000)
+NS_EVENT_MESSAGE(eUnidentifiedEvent,    2000)
  
 // composition events
 NS_EVENT_MESSAGE(NS_COMPOSITION_EVENT_START,  2200)
 NS_EVENT_MESSAGE(NS_COMPOSITION_START,        NS_COMPOSITION_EVENT_START)
 // 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,          NS_COMPOSITION_EVENT_START + 1)
--- a/widget/MiscEvents.h
+++ b/widget/MiscEvents.h
@@ -98,17 +98,17 @@ public:
 
 class WidgetCommandEvent : public WidgetGUIEvent
 {
 public:
   virtual WidgetCommandEvent* AsCommandEvent() override { return this; }
 
   WidgetCommandEvent(bool aIsTrusted, nsIAtom* aEventType,
                      nsIAtom* aCommand, nsIWidget* aWidget)
-    : WidgetGUIEvent(aIsTrusted, NS_USER_DEFINED_EVENT, aWidget,
+    : WidgetGUIEvent(aIsTrusted, eUnidentifiedEvent, aWidget,
                      eCommandEventClass)
     , command(aCommand)
   {
     userType = aEventType;
   }
 
   virtual WidgetEvent* Duplicate() const override
   {