Bug 895274 part.27 Rename NS_MOUSE_BUTTON_DOWN to eMouseDown r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 29 Aug 2015 08:58:30 +0900
changeset 259895 e637f3ff6f3e3add6aa4ac4b7325e3983504cef7
parent 259894 ae625cd90875c0f939e83fc58c9e40fb3b6fd75f
child 259896 389f60113c0c037c562eb46f4dfa23feab74a20e
push id64364
push usermasayuki@d-toybox.com
push dateFri, 28 Aug 2015 23:58:47 +0000
treeherdermozilla-inbound@5899c44ed9ce [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.27 Rename NS_MOUSE_BUTTON_DOWN to eMouseDown r=smaug
accessible/base/nsCoreUtils.cpp
accessible/generic/Accessible.cpp
dom/base/Element.cpp
dom/base/nsContentUtils.cpp
dom/base/nsGlobalWindow.cpp
dom/events/Event.cpp
dom/events/EventNameList.h
dom/events/EventStateManager.cpp
dom/events/IMEContentObserver.cpp
dom/events/WheelHandlingHelper.cpp
dom/html/HTMLButtonElement.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLLabelElement.cpp
dom/ipc/TabChild.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/xul/nsXULElement.cpp
editor/libeditor/nsEditorEventListener.cpp
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/util/APZCCallbackHelper.cpp
layout/base/AccessibleCaretEventHub.cpp
layout/base/SelectionCarets.cpp
layout/base/TouchCaret.cpp
layout/base/gtest/TestAccessibleCaretEventHub.cpp
layout/base/nsPresShell.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsPluginFrame.cpp
layout/xul/nsMenuFrame.cpp
layout/xul/nsResizerFrame.cpp
layout/xul/nsScrollbarButtonFrame.cpp
layout/xul/nsSliderFrame.cpp
layout/xul/nsTitleBarFrame.cpp
widget/EventMessageList.h
widget/InputData.cpp
widget/WidgetEventImpl.cpp
widget/cocoa/nsChildView.mm
widget/gtk/nsWindow.cpp
widget/nsBaseWidget.cpp
widget/qt/nsWindow.cpp
widget/uikit/nsWindow.mm
widget/windows/IMMHandler.cpp
widget/windows/TSFTextStore.cpp
widget/windows/WinUtils.cpp
widget/windows/nsWindow.cpp
--- a/accessible/base/nsCoreUtils.cpp
+++ b/accessible/base/nsCoreUtils.cpp
@@ -105,17 +105,17 @@ nsCoreUtils::DispatchClickEvent(nsITreeB
   nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
 
   int32_t cnvdX = presContext->CSSPixelsToDevPixels(tcX + x + 1) +
     presContext->AppUnitsToDevPixels(offset.x);
   int32_t cnvdY = presContext->CSSPixelsToDevPixels(tcY + y + 1) +
     presContext->AppUnitsToDevPixels(offset.y);
 
   // XUL is just desktop, so there is no real reason for senfing touch events.
-  DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, cnvdX, cnvdY,
+  DispatchMouseEvent(eMouseDown, cnvdX, cnvdY,
                      tcContent, tcFrame, presShell, rootWidget);
 
   DispatchMouseEvent(eMouseUp, cnvdX, cnvdY,
                      tcContent, tcFrame, presShell, rootWidget);
 }
 
 void
 nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX, int32_t aY,
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -1830,17 +1830,18 @@ Accessible::DispatchClickEvent(nsIConten
   nsSize size = frame->GetSize();
 
   nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
   int32_t x = presContext->AppUnitsToDevPixels(point.x + size.width / 2);
   int32_t y = presContext->AppUnitsToDevPixels(point.y + size.height / 2);
 
   // Simulate a touch interaction by dispatching touch events with mouse events.
   nsCoreUtils::DispatchTouchEvent(NS_TOUCH_START, x, y, aContent, frame, presShell, widget);
-  nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, x, y, aContent, frame, presShell, widget);
+  nsCoreUtils::DispatchMouseEvent(eMouseDown, x, y, aContent, frame,
+                                  presShell, widget);
   nsCoreUtils::DispatchTouchEvent(NS_TOUCH_END, x, y, aContent, frame, presShell, widget);
   nsCoreUtils::DispatchMouseEvent(eMouseUp, x, y, aContent, frame,
                                   presShell, widget);
 }
 
 void
 Accessible::ScrollToPoint(uint32_t aCoordinateType, int32_t aX, int32_t aY)
 {
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -2924,17 +2924,17 @@ Element::PreHandleEventForLinks(EventCha
 }
 
 nsresult
 Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
 {
   // Optimisation: return early if this event doesn't interest us.
   // IMPORTANT: this switch and the switch below it must be kept in sync!
   switch (aVisitor.mEvent->mMessage) {
-  case NS_MOUSE_BUTTON_DOWN:
+  case eMouseDown:
   case NS_MOUSE_CLICK:
   case NS_UI_ACTIVATE:
   case eKeyPress:
     break;
   default:
     return NS_OK;
   }
 
@@ -2942,17 +2942,17 @@ Element::PostHandleEventForLinks(EventCh
   nsCOMPtr<nsIURI> absURI;
   if (!CheckHandleEventForLinksPrecondition(aVisitor, getter_AddRefs(absURI))) {
     return NS_OK;
   }
 
   nsresult rv = NS_OK;
 
   switch (aVisitor.mEvent->mMessage) {
-  case NS_MOUSE_BUTTON_DOWN:
+  case eMouseDown:
     {
       if (aVisitor.mEvent->AsMouseEvent()->button ==
             WidgetMouseEvent::eLeftButton) {
         // don't make the link grab the focus if there is no link handler
         nsILinkHandler *handler = aVisitor.mPresContext->GetLinkHandler();
         nsIDocument *document = GetComposedDoc();
         if (handler && document) {
           nsIFocusManager* fm = nsFocusManager::GetFocusManager();
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7833,17 +7833,17 @@ nsContentUtils::SendMouseEvent(nsCOMPtr<
   nsPoint offset;
   nsCOMPtr<nsIWidget> widget = GetWidget(aPresShell, &offset);
   if (!widget)
     return NS_ERROR_FAILURE;
 
   EventMessage msg;
   bool contextMenuKey = false;
   if (aType.EqualsLiteral("mousedown"))
-    msg = NS_MOUSE_BUTTON_DOWN;
+    msg = eMouseDown;
   else if (aType.EqualsLiteral("mouseup"))
     msg = eMouseUp;
   else if (aType.EqualsLiteral("mousemove"))
     msg = eMouseMove;
   else if (aType.EqualsLiteral("mouseover"))
     msg = NS_MOUSE_ENTER_WIDGET;
   else if (aType.EqualsLiteral("mouseout"))
     msg = NS_MOUSE_EXIT_WIDGET;
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -3079,18 +3079,17 @@ nsGlobalWindow::PreHandleEvent(EventChai
   } else if (msg == eResize && aVisitor.mEvent->mFlags.mIsTrusted) {
     // QIing to window so that we can keep the old behavior also in case
     // a child window is handling resize.
     nsCOMPtr<nsPIDOMWindow> window =
       do_QueryInterface(aVisitor.mEvent->originalTarget);
     if (window) {
       mIsHandlingResizeEvent = true;
     }
-  } else if (msg == NS_MOUSE_BUTTON_DOWN &&
-             aVisitor.mEvent->mFlags.mIsTrusted) {
+  } else if (msg == eMouseDown && aVisitor.mEvent->mFlags.mIsTrusted) {
     gMouseDown = true;
   } else if ((msg == eMouseUp || msg == NS_DRAGDROP_END) &&
              aVisitor.mEvent->mFlags.mIsTrusted) {
     gMouseDown = false;
     if (gDragServiceDisabled) {
       nsCOMPtr<nsIDragService> ds =
         do_GetService("@mozilla.org/widget/dragservice;1");
       if (ds) {
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -818,17 +818,17 @@ Event::GetEventPopupControlState(WidgetE
     if (aEvent->mFlags.mIsTrusted &&
         aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) {
       switch(aEvent->mMessage) {
       case eMouseUp:
         if (PopupAllowedForEvent("mouseup")) {
           abuse = openControlled;
         }
         break;
-      case NS_MOUSE_BUTTON_DOWN :
+      case eMouseDown:
         if (PopupAllowedForEvent("mousedown")) {
           abuse = openControlled;
         }
         break;
       case NS_MOUSE_CLICK :
         /* Click events get special treatment because of their
            historical status as a more legitimate event handler. If
            click popups are enabled in the prefs, clear the popup
--- a/dom/events/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -262,17 +262,17 @@ EVENT(loadedmetadata,
       NS_LOADEDMETADATA,
       EventNameType_HTML,
       eBasicEventClass)
 EVENT(loadstart,
       NS_LOADSTART,
       EventNameType_HTML,
       eBasicEventClass)
 EVENT(mousedown,
-      NS_MOUSE_BUTTON_DOWN,
+      eMouseDown,
       EventNameType_All,
       eMouseEventClass)
 EVENT(mouseenter,
       NS_MOUSEENTER,
       EventNameType_All,
       eMouseEventClass)
 EVENT(mouseleave,
       NS_MOUSELEAVE,
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -543,17 +543,17 @@ EventStateManager::PreHandleEvent(nsPres
   *aStatus = nsEventStatus_eIgnore;
 
   switch (aEvent->mMessage) {
   case NS_CONTEXTMENU:
     if (sIsPointerLocked) {
       return NS_ERROR_DOM_INVALID_STATE_ERR;
     }
     break;
-  case NS_MOUSE_BUTTON_DOWN: {
+  case eMouseDown: {
     switch (mouseEvent->button) {
     case WidgetMouseEvent::eLeftButton:
       BeginTrackingDragGesture(aPresContext, mouseEvent, aTargetFrame);
       mLClickCount = mouseEvent->clickCount;
       SetClickCount(aPresContext, mouseEvent, aStatus);
       sNormalLMouseEventInProcess = true;
       break;
     case WidgetMouseEvent::eMiddleButton:
@@ -1165,17 +1165,17 @@ bool
 CrossProcessSafeEvent(const WidgetEvent& aEvent)
 {
   switch (aEvent.mClass) {
   case eKeyboardEventClass:
   case eWheelEventClass:
     return true;
   case eMouseEventClass:
     switch (aEvent.mMessage) {
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
     case eMouseUp:
     case eMouseMove:
     case NS_CONTEXTMENU:
     case NS_MOUSE_ENTER_WIDGET:
     case NS_MOUSE_EXIT_WIDGET:
       return true;
     default:
       return false;
@@ -2791,26 +2791,26 @@ EventStateManager::PostHandleEvent(nsPre
                                                             aStatus);
 
   mCurrentTarget = aTargetFrame;
   mCurrentTargetContent = nullptr;
 
   // Most of the events we handle below require a frame.
   // Add special cases here.
   if (!mCurrentTarget && aEvent->mMessage != eMouseUp &&
-      aEvent->mMessage != NS_MOUSE_BUTTON_DOWN) {
+      aEvent->mMessage != eMouseDown) {
     return NS_OK;
   }
 
   //Keep the prescontext alive, we might need it after event dispatch
   nsRefPtr<nsPresContext> presContext = aPresContext;
   nsresult ret = NS_OK;
 
   switch (aEvent->mMessage) {
-  case NS_MOUSE_BUTTON_DOWN:
+  case eMouseDown:
     {
       WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
       if (mouseEvent->button == WidgetMouseEvent::eLeftButton &&
           !sNormalLMouseEventInProcess) {
         // We got a mouseup event while a mousedown event was being processed.
         // Make sure that the capturing content is cleared.
         nsIPresShell::SetCapturingContent(nullptr, 0);
         break;
@@ -4433,17 +4433,17 @@ EventStateManager::SetClickCount(nsPresC
     }
     if (mouseContent && mouseContent->IsRootOfNativeAnonymousSubtree()) {
       mouseContentParent = mouseContent->GetParent();
     }
   }
 
   switch (aEvent->button) {
   case WidgetMouseEvent::eLeftButton:
-    if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
+    if (aEvent->mMessage == eMouseDown) {
       mLastLeftMouseDownContent = mouseContent;
       mLastLeftMouseDownContentParent = mouseContentParent;
     } else if (aEvent->mMessage == eMouseUp) {
       if (mLastLeftMouseDownContent == mouseContent ||
           mLastLeftMouseDownContentParent == mouseContent ||
           mLastLeftMouseDownContent == mouseContentParent) {
         aEvent->clickCount = mLClickCount;
         mLClickCount = 0;
@@ -4451,17 +4451,17 @@ EventStateManager::SetClickCount(nsPresC
         aEvent->clickCount = 0;
       }
       mLastLeftMouseDownContent = nullptr;
       mLastLeftMouseDownContentParent = nullptr;
     }
     break;
 
   case WidgetMouseEvent::eMiddleButton:
-    if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
+    if (aEvent->mMessage == eMouseDown) {
       mLastMiddleMouseDownContent = mouseContent;
       mLastMiddleMouseDownContentParent = mouseContentParent;
     } else if (aEvent->mMessage == eMouseUp) {
       if (mLastMiddleMouseDownContent == mouseContent ||
           mLastMiddleMouseDownContentParent == mouseContent ||
           mLastMiddleMouseDownContent == mouseContentParent) {
         aEvent->clickCount = mMClickCount;
         mMClickCount = 0;
@@ -4469,17 +4469,17 @@ EventStateManager::SetClickCount(nsPresC
         aEvent->clickCount = 0;
       }
       mLastMiddleMouseDownContent = nullptr;
       mLastMiddleMouseDownContentParent = nullptr;
     }
     break;
 
   case WidgetMouseEvent::eRightButton:
-    if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
+    if (aEvent->mMessage == eMouseDown) {
       mLastRightMouseDownContent = mouseContent;
       mLastRightMouseDownContentParent = mouseContentParent;
     } else if (aEvent->mMessage == eMouseUp) {
       if (mLastRightMouseDownContent == mouseContent ||
           mLastRightMouseDownContentParent == mouseContent ||
           mLastRightMouseDownContent == mouseContentParent) {
         aEvent->clickCount = mRClickCount;
         mRClickCount = 0;
@@ -4955,17 +4955,17 @@ EventStateManager::ContentRemoved(nsIDoc
   ResetLastOverForContent(0, mMouseEnterLeaveHelper, aContent);
   mPointersEnterLeaveHelper.Enumerate(
     &EventStateManager::ResetLastOverForContent, aContent);
 }
 
 bool
 EventStateManager::EventStatusOK(WidgetGUIEvent* aEvent)
 {
-  return !(aEvent->mMessage == NS_MOUSE_BUTTON_DOWN &&
+  return !(aEvent->mMessage == eMouseDown &&
            aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton &&
            !sNormalLMouseEventInProcess);
 }
 
 //-------------------------------------------
 // Access Key Registration
 //-------------------------------------------
 void
@@ -5744,33 +5744,32 @@ EventStateManager::Prefs::GetAccessModif
 /* mozilla::AutoHandlingUserInputStatePusher                      */
 /******************************************************************/
 
 AutoHandlingUserInputStatePusher::AutoHandlingUserInputStatePusher(
                                     bool aIsHandlingUserInput,
                                     WidgetEvent* aEvent,
                                     nsIDocument* aDocument) :
   mIsHandlingUserInput(aIsHandlingUserInput),
-  mIsMouseDown(aEvent && aEvent->mMessage == NS_MOUSE_BUTTON_DOWN),
+  mIsMouseDown(aEvent && aEvent->mMessage == eMouseDown),
   mResetFMMouseButtonHandlingState(false)
 {
   if (!aIsHandlingUserInput) {
     return;
   }
   EventStateManager::StartHandlingUserInput();
   if (mIsMouseDown) {
     nsIPresShell::SetCapturingContent(nullptr, 0);
     nsIPresShell::AllowMouseCapture(true);
   }
   if (!aDocument || !aEvent || !aEvent->mFlags.mIsTrusted) {
     return;
   }
   mResetFMMouseButtonHandlingState =
-    (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN ||
-     aEvent->mMessage == eMouseUp);
+    (aEvent->mMessage == eMouseDown || aEvent->mMessage == eMouseUp);
   if (mResetFMMouseButtonHandlingState) {
     nsFocusManager* fm = nsFocusManager::GetFocusManager();
     NS_ENSURE_TRUE_VOID(fm);
     // If it's in modal state, mouse button event handling may be nested.
     // E.g., a modal dialog is opened at mousedown or mouseup event handler
     // and the dialog is clicked.  Therefore, we should store current
     // mouse button event handling document if nsFocusManager already has it.
     mMouseButtonEventHandlingDocument =
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -453,17 +453,17 @@ IMEContentObserver::OnMouseButtonEvent(n
   if (!aMouseEvent->mFlags.mIsTrusted ||
       aMouseEvent->mFlags.mDefaultPrevented ||
       !aMouseEvent->widget) {
     return false;
   }
   // Now, we need to notify only mouse down and mouse up event.
   switch (aMouseEvent->mMessage) {
     case eMouseUp:
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
       break;
     default:
       return false;
   }
   if (NS_WARN_IF(!mWidget) || NS_WARN_IF(mWidget->Destroyed())) {
     return false;
   }
 
--- a/dom/events/WheelHandlingHelper.cpp
+++ b/dom/events/WheelHandlingHelper.cpp
@@ -206,17 +206,17 @@ WheelTransaction::OnEvent(WidgetEvent* a
         }
       }
       return;
     }
     case eKeyPress:
     case eKeyUp:
     case eKeyDown:
     case eMouseUp:
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
     case NS_MOUSE_DOUBLECLICK:
     case NS_MOUSE_CLICK:
     case NS_CONTEXTMENU:
     case NS_DRAGDROP_DROP:
       EndTransaction();
       return;
     default:
       break;
--- a/dom/html/HTMLButtonElement.cpp
+++ b/dom/html/HTMLButtonElement.cpp
@@ -301,17 +301,17 @@ HTMLButtonElement::PostHandleEvent(Event
             EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
                                       aVisitor.mPresContext, &event, nullptr,
                                       &status);
             aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
           }
         }
         break;
 
-      case NS_MOUSE_BUTTON_DOWN:
+      case eMouseDown:
         {
           WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
           if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
             if (mouseEvent->mFlags.mIsTrusted) {
               EventStateManager* esm =
                 aVisitor.mPresContext->EventStateManager();
               EventStateManager::SetActiveManager(
                 static_cast<EventStateManager*>(esm), this);
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -3933,17 +3933,17 @@ HTMLInputElement::PostHandleEvent(EventC
               }
               SetValueOfRangeForUserEvent(newValue);
               aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
             }
           }
 
         } break; // eKeyPress || eKeyUp
 
-        case NS_MOUSE_BUTTON_DOWN:
+        case eMouseDown:
         case eMouseUp:
         case NS_MOUSE_DOUBLECLICK:
         {
           // cancel all of these events for buttons
           //XXXsmaug Why?
           WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
           if (mouseEvent->button == WidgetMouseEvent::eMiddleButton ||
               mouseEvent->button == WidgetMouseEvent::eRightButton) {
@@ -3962,17 +3962,17 @@ HTMLInputElement::PostHandleEvent(EventC
             if (mouseEvent->button == WidgetMouseEvent::eLeftButton &&
                 !(mouseEvent->IsShift() || mouseEvent->IsControl() ||
                   mouseEvent->IsAlt() || mouseEvent->IsMeta() ||
                   mouseEvent->IsAltGraph() || mouseEvent->IsFn() ||
                   mouseEvent->IsOS())) {
               nsNumberControlFrame* numberControlFrame =
                 do_QueryFrame(GetPrimaryFrame());
               if (numberControlFrame) {
-                if (aVisitor.mEvent->mMessage == NS_MOUSE_BUTTON_DOWN && 
+                if (aVisitor.mEvent->mMessage == eMouseDown && 
                     IsMutable()) {
                   switch (numberControlFrame->GetSpinButtonForPointerEvent(
                             aVisitor.mEvent->AsMouseEvent())) {
                   case nsNumberControlFrame::eSpinButtonUp:
                     StepNumberControlForUserEvent(1);
                     mNumberControlSpinnerSpinsUp = true;
                     StartNumberControlSpinnerSpin();
                     aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
@@ -4081,32 +4081,32 @@ HTMLInputElement::PostHandleEventForRang
   nsRangeFrame* rangeFrame = do_QueryFrame(GetPrimaryFrame());
   if (!rangeFrame && mIsDraggingRange) {
     CancelRangeThumbDrag();
     return;
   }
 
   switch (aVisitor.mEvent->mMessage)
   {
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
     case NS_TOUCH_START: {
       if (mIsDraggingRange) {
         break;
       }
       if (nsIPresShell::GetCapturingContent()) {
         break; // don't start drag if someone else is already capturing
       }
       WidgetInputEvent* inputEvent = aVisitor.mEvent->AsInputEvent();
       if (inputEvent->IsShift() || inputEvent->IsControl() ||
           inputEvent->IsAlt() || inputEvent->IsMeta() ||
           inputEvent->IsAltGraph() || inputEvent->IsFn() ||
           inputEvent->IsOS()) {
         break; // ignore
       }
-      if (aVisitor.mEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
+      if (aVisitor.mEvent->mMessage == eMouseDown) {
         if (aVisitor.mEvent->AsMouseEvent()->buttons ==
               WidgetMouseEvent::eLeftButtonFlag) {
           StartRangeThumbDrag(inputEvent);
         } else if (mIsDraggingRange) {
           CancelRangeThumbDrag();
         }
       } else {
         if (aVisitor.mEvent->AsTouchEvent()->touches.Length() == 1) {
--- a/dom/html/HTMLLabelElement.cpp
+++ b/dom/html/HTMLLabelElement.cpp
@@ -99,17 +99,17 @@ InInteractiveHTMLContent(nsIContent* aCo
 }
 
 nsresult
 HTMLLabelElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
 {
   WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
   if (mHandlingEvent ||
       (!(mouseEvent && mouseEvent->IsLeftClickEvent()) &&
-       aVisitor.mEvent->mMessage != NS_MOUSE_BUTTON_DOWN) ||
+       aVisitor.mEvent->mMessage != eMouseDown) ||
       aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault ||
       !aVisitor.mPresContext ||
       // Don't handle the event if it's already been handled by another label
       aVisitor.mEvent->mFlags.mMultipleActionsPrevented) {
     return NS_OK;
   }
 
   nsCOMPtr<nsIContent> target = do_QueryInterface(aVisitor.mEvent->target);
@@ -118,17 +118,17 @@ HTMLLabelElement::PostHandleEvent(EventC
   }
 
   // Strong ref because event dispatch is going to happen.
   nsRefPtr<Element> content = GetLabeledElement();
 
   if (content) {
     mHandlingEvent = true;
     switch (aVisitor.mEvent->mMessage) {
-      case NS_MOUSE_BUTTON_DOWN:
+      case eMouseDown:
         if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
           // We reset the mouse-down point on every event because there is
           // no guarantee we will reach the NS_MOUSE_CLICK code below.
           LayoutDeviceIntPoint* curPoint =
             new LayoutDeviceIntPoint(mouseEvent->refPoint);
           SetProperty(nsGkAtoms::labelMouseDownPtProperty,
                       static_cast<void*>(curPoint),
                       nsINode::DeleteProperty<LayoutDeviceIntPoint>);
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2052,17 +2052,17 @@ TabChild::UpdateTapState(const WidgetTou
     }
     return;
 
   case NS_TOUCH_END:
     if (!TouchManager::gPreventMouseEvents) {
       APZCCallbackHelper::DispatchSynthesizedMouseEvent(
         eMouseMove, time, currentPoint, 0, mPuppetWidget);
       APZCCallbackHelper::DispatchSynthesizedMouseEvent(
-        NS_MOUSE_BUTTON_DOWN, time, currentPoint, 0, mPuppetWidget);
+        eMouseDown, time, currentPoint, 0, mPuppetWidget);
       APZCCallbackHelper::DispatchSynthesizedMouseEvent(
         eMouseUp, time, currentPoint, 0, mPuppetWidget);
     }
     // fall through
   case NS_TOUCH_CANCEL:
     CancelTapTracking();
     return;
 
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1817,17 +1817,17 @@ CocoaEventTypeForEvent(const WidgetGUIEv
       // we're dragging. The widget code just generates mouse move events from native
       // drag events. If anybody is capturing, this is a drag event.
       if (nsIPresShell::GetCapturingContent()) {
         return NPCocoaEventMouseDragged;
       }
 
       return NPCocoaEventMouseMoved;
     }
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
       return NPCocoaEventMouseDown;
     case eMouseUp:
       return NPCocoaEventMouseUp;
     case eKeyDown:
       return NPCocoaEventKeyDown;
     case eKeyUp:
       return NPCocoaEventKeyUp;
     case NS_FOCUS_CONTENT:
@@ -1843,17 +1843,17 @@ CocoaEventTypeForEvent(const WidgetGUIEv
 static NPCocoaEvent
 TranslateToNPCocoaEvent(WidgetGUIEvent* anEvent, nsIFrame* aObjectFrame)
 {
   NPCocoaEvent cocoaEvent;
   InitializeNPCocoaEvent(&cocoaEvent);
   cocoaEvent.type = CocoaEventTypeForEvent(*anEvent, aObjectFrame);
 
   if (anEvent->mMessage == eMouseMove ||
-      anEvent->mMessage == NS_MOUSE_BUTTON_DOWN ||
+      anEvent->mMessage == eMouseDown ||
       anEvent->mMessage == eMouseUp ||
       anEvent->mMessage == NS_MOUSE_SCROLL ||
       anEvent->mMessage == NS_MOUSE_OVER ||
       anEvent->mMessage == NS_MOUSE_OUT)
   {
     nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(anEvent, aObjectFrame) -
                  aObjectFrame->GetContentRectRelativeToSelf().TopLeft();
     nsPresContext* presContext = aObjectFrame->PresContext();
@@ -1864,17 +1864,17 @@ TranslateToNPCocoaEvent(WidgetGUIEvent* 
     size_t intScaleFactor = ceil(scaleFactor);
     nsIntPoint ptPx(presContext->AppUnitsToDevPixels(pt.x) / intScaleFactor,
                     presContext->AppUnitsToDevPixels(pt.y) / intScaleFactor);
     cocoaEvent.data.mouse.pluginX = double(ptPx.x);
     cocoaEvent.data.mouse.pluginY = double(ptPx.y);
   }
 
   switch (anEvent->mMessage) {
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
     case eMouseUp: {
       WidgetMouseEvent* mouseEvent = anEvent->AsMouseEvent();
       if (mouseEvent) {
         switch (mouseEvent->button) {
           case WidgetMouseEvent::eLeftButton:
             cocoaEvent.data.mouse.buttonNumber = 0;
             break;
           case WidgetMouseEvent::eRightButton:
@@ -2035,17 +2035,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
         textEvent.type = NPCocoaEventTextInput;
         textEvent.data.text.text = (NPNSString*)cfString;
         mInstance->HandleEvent(&textEvent, nullptr);
       }
     }
   }
 
   bool handled = (response == kNPEventHandled || response == kNPEventStartIME);
-  bool leftMouseButtonDown = (anEvent.mMessage == NS_MOUSE_BUTTON_DOWN) &&
+  bool leftMouseButtonDown = (anEvent.mMessage == eMouseDown) &&
                              (anEvent.AsMouseEvent()->button == WidgetMouseEvent::eLeftButton);
   if (handled && !(leftMouseButtonDown && !mContentFocused)) {
     rv = nsEventStatus_eConsumeNoDefault;
   }
 #endif
 
 #ifdef XP_WIN
   // this code supports windowless plugins
@@ -2058,17 +2058,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
       // XXX Should extend this list to synthesize events for more event
       // types
       pluginEvent.event = 0;
       const WidgetMouseEvent* mouseEvent = anEvent.AsMouseEvent();
       switch (anEvent.mMessage) {
       case eMouseMove:
         pluginEvent.event = WM_MOUSEMOVE;
         break;
-      case NS_MOUSE_BUTTON_DOWN: {
+      case eMouseDown: {
         static const int downMsgs[] =
           { WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN };
         static const int dblClickMsgs[] =
           { WM_LBUTTONDBLCLK, WM_MBUTTONDBLCLK, WM_RBUTTONDBLCLK };
         if (mouseEvent->clickCount == 2) {
           pluginEvent.event = dblClickMsgs[mouseEvent->button];
         } else {
           pluginEvent.event = downMsgs[mouseEvent->button];
@@ -2099,17 +2099,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
           (::GetKeyState(VK_XBUTTON2) ? MK_XBUTTON2 : 0);
       }
     }
     if (pPluginEvent) {
       // Make event coordinates relative to our enclosing widget,
       // not the widget they were received on.
       // See use of NPEvent in widget/windows/nsWindow.cpp
       // for why this assert should be safe
-      NS_ASSERTION(anEvent.mMessage == NS_MOUSE_BUTTON_DOWN ||
+      NS_ASSERTION(anEvent.mMessage == eMouseDown ||
                    anEvent.mMessage == eMouseUp ||
                    anEvent.mMessage == NS_MOUSE_DOUBLECLICK ||
                    anEvent.mMessage == NS_MOUSE_OVER ||
                    anEvent.mMessage == NS_MOUSE_OUT ||
                    anEvent.mMessage == eMouseMove,
                    "Incorrect event type for coordinate translation");
       nsPoint pt =
         nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mPluginFrame) -
@@ -2230,21 +2230,21 @@ nsEventStatus nsPluginInstanceOwner::Pro
               event.y_root = rootPoint.y;
               event.state = XInputEventState(mouseEvent);
               // information lost
               event.subwindow = None;
               event.is_hint = NotifyNormal;
               event.same_screen = True;
             }
             break;
-          case NS_MOUSE_BUTTON_DOWN:
+          case eMouseDown:
           case eMouseUp:
             {
               XButtonEvent& event = pluginEvent.xbutton;
-              event.type = anEvent.mMessage == NS_MOUSE_BUTTON_DOWN ?
+              event.type = anEvent.mMessage == eMouseDown ?
                 ButtonPress : ButtonRelease;
               event.root = root;
               event.time = anEvent.time;
               event.x = pluginPoint.x;
               event.y = pluginPoint.y;
               event.x_root = rootPoint.x;
               event.y_root = rootPoint.y;
               event.state = XInputEventState(mouseEvent);
@@ -2393,17 +2393,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
         switch (anEvent.mMessage) {
           case eMouseMove:
             {
               // are these going to be touch events?
               // pluginPoint.x;
               // pluginPoint.y;
             }
             break;
-          case NS_MOUSE_BUTTON_DOWN:
+          case eMouseDown:
             {
               ANPEvent event;
               event.inSize = sizeof(ANPEvent);
               event.eventType = kMouse_ANPEventType;
               event.data.mouse.action = kDown_ANPMouseAction;
               event.data.mouse.x = pluginPoint.x;
               event.data.mouse.y = pluginPoint.y;
               mInstance->HandleEvent(&event, nullptr, NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -1735,17 +1735,17 @@ nsXULElement::ClickWithInputSource(uint1
     if (doc) {
         nsCOMPtr<nsIPresShell> shell = doc->GetShell();
         if (shell) {
             // strong ref to PresContext so events don't destroy it
             nsRefPtr<nsPresContext> context = shell->GetPresContext();
 
             bool isCallerChrome = nsContentUtils::IsCallerChrome();
 
-            WidgetMouseEvent eventDown(isCallerChrome, NS_MOUSE_BUTTON_DOWN,
+            WidgetMouseEvent eventDown(isCallerChrome, eMouseDown,
                                        nullptr, WidgetMouseEvent::eReal);
             WidgetMouseEvent eventUp(isCallerChrome, eMouseUp,
                                      nullptr, WidgetMouseEvent::eReal);
             WidgetMouseEvent eventClick(isCallerChrome, NS_MOUSE_CLICK, nullptr,
                                         WidgetMouseEvent::eReal);
             eventDown.inputSource = eventUp.inputSource = eventClick.inputSource
                                   = aInputSource;
 
--- a/editor/libeditor/nsEditorEventListener.cpp
+++ b/editor/libeditor/nsEditorEventListener.cpp
@@ -403,43 +403,43 @@ nsEditorEventListener::HandleEvent(nsIDO
     }
 #endif // #ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
     // keypress
     case eKeyPress: {
       nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
       return KeyPress(keyEvent);
     }
     // mousedown
-    case NS_MOUSE_BUTTON_DOWN: {
+    case eMouseDown: {
       nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
       NS_ENSURE_TRUE(mouseEvent, NS_OK);
       // nsEditorEventListener may receive (1) all mousedown, mouseup and click
       // events, (2) only mousedown event or (3) only mouseup event.
       // mMouseDownOrUpConsumedByIME is used only for ignoring click event if
       // preceding mousedown and/or mouseup event is consumed by IME.
       // Therefore, even if case #2 or case #3 occurs,
       // mMouseDownOrUpConsumedByIME is true here.  Therefore, we should always
       // overwrite it here.
       mMouseDownOrUpConsumedByIME = NotifyIMEOfMouseButtonEvent(mouseEvent);
       return mMouseDownOrUpConsumedByIME ? NS_OK : MouseDown(mouseEvent);
     }
     // mouseup
     case eMouseUp: {
       nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
       NS_ENSURE_TRUE(mouseEvent, NS_OK);
-      // See above comment in the NS_MOUSE_BUTTON_DOWN case, first.
+      // See above comment in the eMouseDown case, first.
       // This code assumes that case #1 is occuring.  However, if case #3 may
       // occurs after case #2 and the mousedown is consumed,
       // mMouseDownOrUpConsumedByIME is true even though nsEditorEventListener
       // has not received the preceding mousedown event of this mouseup event.
       // So, mMouseDownOrUpConsumedByIME may be invalid here.  However,
       // this is not a matter because mMouseDownOrUpConsumedByIME is referred
       // only by NS_MOUSE_CLICK case but click event is fired only in case #1.
       // So, before a click event is fired, mMouseDownOrUpConsumedByIME is
-      // always initialized in the NS_MOUSE_BUTTON_DOWN case if it's referred.
+      // always initialized in the eMouseDown case if it's referred.
       if (NotifyIMEOfMouseButtonEvent(mouseEvent)) {
         mMouseDownOrUpConsumedByIME = true;
       }
       return mMouseDownOrUpConsumedByIME ? NS_OK : MouseUp(mouseEvent);
     }
     // click
     case NS_MOUSE_CLICK: {
       nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -885,17 +885,17 @@ APZCTreeManager::UpdateWheelTransaction(
        ViewAs<ScreenPixel>(aEvent.refPoint, PixelCastJustification::LayoutDeviceToScreenForUntransformedEvent);
      txn->OnMouseMove(point);
      return;
    }
    case eKeyPress:
    case eKeyUp:
    case eKeyDown:
    case eMouseUp:
-   case NS_MOUSE_BUTTON_DOWN:
+   case eMouseDown:
    case NS_MOUSE_DOUBLECLICK:
    case NS_MOUSE_CLICK:
    case NS_CONTEXTMENU:
    case NS_DRAGDROP_DROP:
      txn->EndTransaction();
      return;
    default:
      break;
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -491,17 +491,17 @@ APZCCallbackHelper::DispatchWidgetEvent(
 
 nsEventStatus
 APZCCallbackHelper::DispatchSynthesizedMouseEvent(EventMessage aMsg,
                                                   uint64_t aTime,
                                                   const LayoutDevicePoint& aRefPoint,
                                                   Modifiers aModifiers,
                                                   nsIWidget* aWidget)
 {
-  MOZ_ASSERT(aMsg == eMouseMove || aMsg == NS_MOUSE_BUTTON_DOWN ||
+  MOZ_ASSERT(aMsg == eMouseMove || aMsg == eMouseDown ||
              aMsg == eMouseUp || aMsg == NS_MOUSE_MOZLONGTAP);
 
   WidgetMouseEvent event(true, aMsg, nullptr,
                          WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
   event.refPoint = LayoutDeviceIntPoint(aRefPoint.x, aRefPoint.y);
   event.time = aTime;
   event.button = WidgetMouseEvent::eLeftButton;
   event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
@@ -542,17 +542,17 @@ APZCCallbackHelper::FireSingleTapEvent(c
 {
   if (aWidget->Destroyed()) {
     return;
   }
   APZCCH_LOG("Dispatching single-tap component events to %s\n",
     Stringify(aPoint).c_str());
   int time = 0;
   DispatchSynthesizedMouseEvent(eMouseMove, time, aPoint, aModifiers, aWidget);
-  DispatchSynthesizedMouseEvent(NS_MOUSE_BUTTON_DOWN, time, aPoint, aModifiers, aWidget);
+  DispatchSynthesizedMouseEvent(eMouseDown, time, aPoint, aModifiers, aWidget);
   DispatchSynthesizedMouseEvent(eMouseUp, time, aPoint, aModifiers, aWidget);
 }
 
 static nsIScrollableFrame*
 GetScrollableAncestorFrame(nsIFrame* aTarget)
 {
   uint32_t flags = nsLayoutUtils::SCROLLABLE_ALWAYS_MATCH_ROOT
                  | nsLayoutUtils::SCROLLABLE_ONLY_ASYNC_SCROLLABLE;
--- a/layout/base/AccessibleCaretEventHub.cpp
+++ b/layout/base/AccessibleCaretEventHub.cpp
@@ -496,20 +496,20 @@ AccessibleCaretEventHub::HandleMouseEven
     return rv;
   }
 
   int32_t id = (mActiveTouchId == kInvalidTouchId ?
                 kDefaultTouchId : mActiveTouchId);
   nsPoint point = GetMouseEventPosition(aEvent);
 
   switch (aEvent->mMessage) {
-  case NS_MOUSE_BUTTON_DOWN:
-    AC_LOGV("Before NS_MOUSE_BUTTON_DOWN, state: %s", mState->Name());
+  case eMouseDown:
+    AC_LOGV("Before eMouseDown, state: %s", mState->Name());
     rv = mState->OnPress(this, point, id);
-    AC_LOGV("After NS_MOUSE_BUTTON_DOWN, state: %s, consume: %d",
+    AC_LOGV("After eMouseDown, state: %s, consume: %d",
             mState->Name(), rv);
     break;
 
   case eMouseMove:
     AC_LOGV("Before eMouseMove, state: %s", mState->Name());
     rv = mState->OnMove(this, point);
     AC_LOGV("After eMouseMove, state: %s, consume: %d", mState->Name(), rv);
     break;
--- a/layout/base/SelectionCarets.cpp
+++ b/layout/base/SelectionCarets.cpp
@@ -200,17 +200,17 @@ SelectionCarets::HandleEvent(WidgetEvent
   nsIFrame* rootFrame = mPresShell->GetRootFrame();
   if (!rootFrame) {
     return nsEventStatus_eIgnore;
   }
   nsPoint ptInRoot =
     nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, movePoint, rootFrame);
 
   if (aEvent->mMessage == NS_TOUCH_START ||
-      (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN &&
+      (aEvent->mMessage == eMouseDown &&
        mouseEvent->button == WidgetMouseEvent::eLeftButton)) {
     // If having a active touch, ignore other touch down event
     if (aEvent->mMessage == NS_TOUCH_START && mActiveTouchId >= 0) {
       return nsEventStatus_eConsumeNoDefault;
     }
 
     mActiveTouchId = nowTouchId;
     mDownPoint = ptInRoot;
--- a/layout/base/TouchCaret.cpp
+++ b/layout/base/TouchCaret.cpp
@@ -758,17 +758,17 @@ TouchCaret::HandleEvent(WidgetEvent* aEv
   }
 
   nsEventStatus status = nsEventStatus_eIgnore;
 
   switch (aEvent->mMessage) {
     case NS_TOUCH_START:
       status = HandleTouchDownEvent(aEvent->AsTouchEvent());
       break;
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
       status = HandleMouseDownEvent(aEvent->AsMouseEvent());
       break;
     case NS_TOUCH_END:
       status = HandleTouchUpEvent(aEvent->AsTouchEvent());
       break;
     case eMouseUp:
       status = HandleMouseUpEvent(aEvent->AsMouseEvent());
       break;
--- a/layout/base/gtest/TestAccessibleCaretEventHub.cpp
+++ b/layout/base/gtest/TestAccessibleCaretEventHub.cpp
@@ -121,17 +121,17 @@ public:
     event->button = WidgetMouseEvent::eLeftButton;
     event->refPoint = LayoutDeviceIntPoint(aX, aY);
 
     return Move(event);
   }
 
   static UniquePtr<WidgetEvent> CreateMousePressEvent(nscoord aX, nscoord aY)
   {
-    return CreateMouseEvent(NS_MOUSE_BUTTON_DOWN, aX, aY);
+    return CreateMouseEvent(eMouseDown, aX, aY);
   }
 
   static UniquePtr<WidgetEvent> CreateMouseMoveEvent(nscoord aX, nscoord aY)
   {
     return CreateMouseEvent(eMouseMove, aX, aY);
   }
 
   static UniquePtr<WidgetEvent> CreateMouseReleaseEvent(nscoord aX, nscoord aY)
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -462,17 +462,17 @@ public:
 class MOZ_STACK_CLASS nsPresShellEventCB : public EventDispatchingCallback
 {
 public:
   explicit nsPresShellEventCB(PresShell* aPresShell) : mPresShell(aPresShell) {}
 
   virtual void HandleEvent(EventChainPostVisitor& aVisitor) override
   {
     if (aVisitor.mPresContext && aVisitor.mEvent->mClass != eBasicEventClass) {
-      if (aVisitor.mEvent->mMessage == NS_MOUSE_BUTTON_DOWN ||
+      if (aVisitor.mEvent->mMessage == eMouseDown ||
           aVisitor.mEvent->mMessage == eMouseUp) {
         // Mouse-up and mouse-down events call nsFrame::HandlePress/Release
         // which call GetContentOffsetsFromPoint which requires up-to-date layout.
         // Bring layout up-to-date now so that GetCurrentEventFrame() below
         // will return a real frame and we don't have to worry about
         // destroying it by flushing later.
         mPresShell->FlushPendingNotifications(Flush_Layout);
       } else if (aVisitor.mEvent->mMessage == NS_WHEEL_WHEEL &&
@@ -6565,17 +6565,17 @@ PresShell::RecordMouseLocation(WidgetGUI
       rootPresShell->RecordMouseLocation(aEvent);
     }
     return;
   }
 
   if ((aEvent->mMessage == eMouseMove &&
        aEvent->AsMouseEvent()->reason == WidgetMouseEvent::eReal) ||
       aEvent->mMessage == NS_MOUSE_ENTER_WIDGET ||
-      aEvent->mMessage == NS_MOUSE_BUTTON_DOWN ||
+      aEvent->mMessage == eMouseDown ||
       aEvent->mMessage == eMouseUp) {
     nsIFrame* rootFrame = GetRootFrame();
     if (!rootFrame) {
       nsView* rootView = mViewManager->GetRootView();
       mMouseLocation = nsLayoutUtils::TranslateWidgetToView(mPresContext,
         aEvent->widget, aEvent->refPoint, rootView);
     } else {
       mMouseLocation =
@@ -6674,17 +6674,17 @@ DispatchPointerFromMouseOrTouch(PresShel
       if (mouseEvent->buttons == 0) {
         button = -1;
       }
       pointerMessage = NS_POINTER_MOVE;
       break;
     case eMouseUp:
       pointerMessage = NS_POINTER_UP;
       break;
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
       pointerMessage = NS_POINTER_DOWN;
       break;
     default:
       return NS_OK;
     }
 
     WidgetPointerEvent event(*mouseEvent);
     event.mMessage = pointerMessage;
@@ -7476,17 +7476,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
         }
       }
     }
 
     // Suppress mouse event if it's being targeted at an element inside
     // a document which needs events suppressed
     if (aEvent->mClass == eMouseEventClass &&
         frame->PresContext()->Document()->EventHandlingSuppressed()) {
-      if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
+      if (aEvent->mMessage == eMouseDown) {
         mNoDelayedMouseEvents = true;
       } else if (!mNoDelayedMouseEvents && aEvent->mMessage == eMouseUp) {
         DelayedEvent* event = new DelayedMouseEvent(aEvent->AsMouseEvent());
         if (!mDelayedEvents.AppendElement(event)) {
           delete event;
         }
       }
       return NS_OK;
@@ -7882,17 +7882,17 @@ PresShell::HandleEventInternal(WidgetEve
             keyCode != NS_VK_WIN && keyCode != NS_VK_META) {
           // Allow keys other than ESC and modifiers be marked as a
           // valid user input for triggering popup, fullscreen, and
           // pointer lock.
           isHandlingUserInput = true;
         }
         break;
       }
-      case NS_MOUSE_BUTTON_DOWN:
+      case eMouseDown:
       case eMouseUp:
         isHandlingUserInput = true;
         break;
 
       case NS_DRAGDROP_DROP: {
         nsCOMPtr<nsIDragSession> session = nsContentUtils::GetDragSession();
         if (session) {
           bool onlyChromeDrop = false;
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -1128,17 +1128,17 @@ nsComboboxControlFrame::HandleEvent(nsPr
   }
 
   EventStates eventStates = mContent->AsElement()->State();
   if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
     return NS_OK;
   }
 
 #if COMBOBOX_ROLLUP_CONSUME_EVENT == 0
-  if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
+  if (aEvent->mMessage == eMouseDown) {
     nsIWidget* widget = GetNearestWidget();
     if (widget && GetContent() == widget->GetLastRollup()) {
       // This event did a Rollup on this control - prevent it from opening
       // the dropdown again!
       *aEventStatus = nsEventStatus_eConsumeNoDefault;
       return NS_OK;
     }
   }
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2562,17 +2562,17 @@ nsFrame::HandleEvent(nsPresContext* aPre
     // XXX If the second argument of HandleDrag() is WidgetMouseEvent,
     //     the implementation becomes simpler.
     return HandleDrag(aPresContext, aEvent, aEventStatus);
   }
 
   if ((aEvent->mClass == eMouseEventClass &&
        aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) ||
       aEvent->mClass == eTouchEventClass) {
-    if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN ||
+    if (aEvent->mMessage == eMouseDown ||
         aEvent->mMessage == NS_TOUCH_START) {
       HandlePress(aPresContext, aEvent, aEventStatus);
     } else if (aEvent->mMessage == eMouseUp ||
                aEvent->mMessage == NS_TOUCH_END) {
       HandleRelease(aPresContext, aEvent, aEventStatus);
     }
   }
   return NS_OK;
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -1534,17 +1534,17 @@ nsHTMLFramesetBorderFrame::HandleEvent(n
   NS_ENSURE_ARG_POINTER(aEventStatus);
   *aEventStatus = nsEventStatus_eIgnore;
 
   //XXX Mouse setting logic removed.  The remaining logic should also move.
   if (!mCanResize) {
     return NS_OK;
   }
 
-  if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN &&
+  if (aEvent->mMessage == eMouseDown &&
       aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) {
     nsHTMLFramesetFrame* parentFrame = do_QueryFrame(GetParent());
     if (parentFrame) {
       parentFrame->StartMouseDrag(aPresContext, this, aEvent);
       *aEventStatus = nsEventStatus_eConsumeNoDefault;
     }
   }
   return NS_OK;
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -1796,17 +1796,17 @@ nsPluginFrame::HandleEvent(nsPresContext
     // point.
     return rv;
   }
 
   // These two calls to nsIPresShell::SetCapturingContext() (on mouse-down
   // and mouse-up) are needed to make the routing of mouse events while
   // dragging conform to standard OS X practice, and to the Cocoa NPAPI spec.
   // See bug 525078 and bug 909678.
-  if (anEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
+  if (anEvent->mMessage == eMouseDown) {
     nsIPresShell::SetCapturingContent(GetContent(), CAPTURE_IGNOREALLOWED);
   }
 #endif
 
   rv = nsPluginFrameSuper::HandleEvent(aPresContext, anEvent, anEventStatus);
 
   // We need to be careful from this point because the call to
   // nsPluginFrameSuper::HandleEvent() might have killed us.
--- a/layout/xul/nsMenuFrame.cpp
+++ b/layout/xul/nsMenuFrame.cpp
@@ -408,17 +408,17 @@ nsMenuFrame::HandleEvent(nsPresContext* 
     // On other platforms, toggle menulist on unmodified F4 or Alt arrow
     if ((keyCode == NS_VK_F4 && !keyEvent->IsAlt()) ||
         ((keyCode == NS_VK_UP || keyCode == NS_VK_DOWN) && keyEvent->IsAlt())) {
       *aEventStatus = nsEventStatus_eConsumeNoDefault;
       ToggleMenuState();
     }
 #endif
   }
-  else if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN &&
+  else if (aEvent->mMessage == eMouseDown &&
            aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton &&
            !IsDisabled() && IsMenu()) {
     // The menu item was selected. Bring up the menu.
     // We have children.
     // Don't prevent the default action here, since that will also cancel
     // potential drag starts.
     if (!menuParent || menuParent->IsMenuBar()) {
       ToggleMenuState();
--- a/layout/xul/nsResizerFrame.cpp
+++ b/layout/xul/nsResizerFrame.cpp
@@ -58,17 +58,17 @@ nsResizerFrame::HandleEvent(nsPresContex
     return NS_OK;
   }
 
   nsWeakFrame weakFrame(this);
   bool doDefault = true;
 
   switch (aEvent->mMessage) {
     case NS_TOUCH_START:
-    case NS_MOUSE_BUTTON_DOWN: {
+    case eMouseDown: {
       if (aEvent->mClass == eTouchEventClass ||
           (aEvent->mClass == eMouseEventClass &&
            aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton)) {
         nsCOMPtr<nsIBaseWindow> window;
         nsIPresShell* presShell = aPresContext->GetPresShell();
         nsIContent* contentToResize =
           GetContentToResize(presShell, getter_AddRefs(window));
         if (contentToResize) {
--- a/layout/xul/nsScrollbarButtonFrame.cpp
+++ b/layout/xul/nsScrollbarButtonFrame.cpp
@@ -48,17 +48,17 @@ nsScrollbarButtonFrame::HandleEvent(nsPr
   // If a web page calls event.preventDefault() we still want to
   // scroll when scroll arrow is clicked. See bug 511075.
   if (!mContent->IsInNativeAnonymousSubtree() &&
       nsEventStatus_eConsumeNoDefault == *aEventStatus) {
     return NS_OK;
   }
 
   switch (aEvent->mMessage) {
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
       mCursorOnThis = true;
       // if we didn't handle the press ourselves, pass it on to the superclass
       if (HandleButtonPress(aPresContext, aEvent, aEventStatus)) {
         return NS_OK;
       }
       break;
     case eMouseUp:
       HandleRelease(aPresContext, aEvent, aEventStatus);
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -594,17 +594,17 @@ nsSliderFrame::HandleEvent(nsPresContext
     mDragStart = pos - mThumbStart;
   }
 #ifdef MOZ_WIDGET_GTK
   else if (ShouldScrollForEvent(aEvent) &&
            aEvent->mClass == eMouseEventClass &&
            aEvent->AsMouseEvent()->button == WidgetMouseEvent::eRightButton) {
     // HandlePress and HandleRelease are usually called via
     // nsFrame::HandleEvent, but only for the left mouse button.
-    if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
+    if (aEvent->mMessage == eMouseDown) {
       HandlePress(aPresContext, aEvent, aEventStatus);
     } else if (aEvent->mMessage == eMouseUp) {
       HandleRelease(aPresContext, aEvent, aEventStatus);
     }
 
     return NS_OK;
   }
 #endif
@@ -1047,17 +1047,17 @@ nsSliderFrame::RemoveListener()
 
 bool
 nsSliderFrame::ShouldScrollForEvent(WidgetGUIEvent* aEvent)
 {
   switch (aEvent->mMessage) {
     case NS_TOUCH_START:
     case NS_TOUCH_END:
       return true;
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
     case eMouseUp: {
       uint16_t button = aEvent->AsMouseEvent()->button;
 #ifdef MOZ_WIDGET_GTK
       return (button == WidgetMouseEvent::eLeftButton) ||
              (button == WidgetMouseEvent::eRightButton && GetScrollToClick()) ||
              (button == WidgetMouseEvent::eMiddleButton && gMiddlePref && !GetScrollToClick());
 #else
       return (button == WidgetMouseEvent::eLeftButton) ||
@@ -1075,17 +1075,17 @@ nsSliderFrame::ShouldScrollToClickForEve
   if (!ShouldScrollForEvent(aEvent)) {
     return false;
   }
 
   if (aEvent->mMessage == NS_TOUCH_START) {
     return GetScrollToClick();
   }
 
-  if (aEvent->mMessage != NS_MOUSE_BUTTON_DOWN) {
+  if (aEvent->mMessage != eMouseDown) {
     return false;
   }
 
 #if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
   // On Mac and Linux, clicking the scrollbar thumb should never scroll to click.
   if (IsEventOverThumb(aEvent)) {
     return false;
   }
--- a/layout/xul/nsTitleBarFrame.cpp
+++ b/layout/xul/nsTitleBarFrame.cpp
@@ -63,17 +63,17 @@ nsTitleBarFrame::HandleEvent(nsPresConte
   if (nsEventStatus_eConsumeNoDefault == *aEventStatus) {
     return NS_OK;
   }
 
   bool doDefault = true;
 
   switch (aEvent->mMessage) {
 
-   case NS_MOUSE_BUTTON_DOWN:  {
+   case eMouseDown: {
        if (aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) {
          // titlebar has no effect in non-chrome shells
          nsCOMPtr<nsIDocShellTreeItem> dsti = aPresContext->GetDocShell();
          if (dsti) {
            if (dsti->ItemType() == nsIDocShellTreeItem::typeChrome) {
              // we're tracking.
              mTrackingMouseMove = true;
 
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -43,17 +43,17 @@ NS_EVENT_MESSAGE(eOnline,               
 
 // NS_BEFORERESIZE_EVENT used to be here (eWindowEventFirst + 66)
 
 NS_EVENT_MESSAGE(eLanguageChange,       eWindowEventFirst + 70)
 
 NS_EVENT_MESSAGE(eMouseEventFirst,      300)
 NS_EVENT_MESSAGE(eMouseMove,            eMouseEventFirst)
 NS_EVENT_MESSAGE(eMouseUp,              eMouseEventFirst + 1)
-NS_EVENT_MESSAGE(NS_MOUSE_BUTTON_DOWN,  eMouseEventFirst + 2)
+NS_EVENT_MESSAGE(eMouseDown,            eMouseEventFirst + 2)
 NS_EVENT_MESSAGE(NS_MOUSE_ENTER_WIDGET, eMouseEventFirst + 22)
 NS_EVENT_MESSAGE(NS_MOUSE_EXIT_WIDGET,  eMouseEventFirst + 23)
 NS_EVENT_MESSAGE(NS_MOUSE_DOUBLECLICK,  eMouseEventFirst + 24)
 NS_EVENT_MESSAGE(NS_MOUSE_CLICK,        eMouseEventFirst + 27)
 NS_EVENT_MESSAGE(NS_MOUSE_ACTIVATE,     eMouseEventFirst + 30)
 NS_EVENT_MESSAGE(NS_MOUSE_OVER,         eMouseEventFirst + 31)
 NS_EVENT_MESSAGE(NS_MOUSE_OUT,          eMouseEventFirst + 32)
 NS_EVENT_MESSAGE(NS_MOUSE_MOZHITTEST,   eMouseEventFirst + 33)
--- a/widget/InputData.cpp
+++ b/widget/InputData.cpp
@@ -120,17 +120,17 @@ WidgetMouseEvent
 MultiTouchInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
 {
   MOZ_ASSERT(NS_IsMainThread(),
              "Can only convert To WidgetMouseEvent on main thread");
 
   EventMessage mouseEventMessage = eVoidEvent;
   switch (mType) {
     case MultiTouchInput::MULTITOUCH_START:
-      mouseEventMessage = NS_MOUSE_BUTTON_DOWN;
+      mouseEventMessage = eMouseDown;
       break;
     case MultiTouchInput::MULTITOUCH_MOVE:
       mouseEventMessage = eMouseMove;
       break;
     case MultiTouchInput::MULTITOUCH_CANCEL:
     case MultiTouchInput::MULTITOUCH_END:
       mouseEventMessage = eMouseUp;
       break;
@@ -177,17 +177,17 @@ MultiTouchInput::IndexOfTouch(int32_t aT
 // and rotation angle.
 MultiTouchInput::MultiTouchInput(const WidgetMouseEvent& aMouseEvent)
   : InputData(MULTITOUCH_INPUT, aMouseEvent.time, aMouseEvent.timeStamp,
               aMouseEvent.modifiers)
 {
   MOZ_ASSERT(NS_IsMainThread(),
              "Can only copy from WidgetMouseEvent on main thread");
   switch (aMouseEvent.mMessage) {
-  case NS_MOUSE_BUTTON_DOWN:
+  case eMouseDown:
     mType = MULTITOUCH_START;
     break;
   case eMouseMove:
     mType = MULTITOUCH_MOVE;
     break;
   case eMouseUp:
     mType = MULTITOUCH_END;
     break;
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -73,17 +73,17 @@ WidgetEvent::IsNativeEventDelivererForPl
  *
  * Event message checking methods.
  ******************************************************************************/
 
 bool
 WidgetEvent::HasMouseEventMessage() const
 {
   switch (mMessage) {
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
     case eMouseUp:
     case NS_MOUSE_CLICK:
     case NS_MOUSE_DOUBLECLICK:
     case NS_MOUSE_ENTER_WIDGET:
     case NS_MOUSE_EXIT_WIDGET:
     case NS_MOUSE_ACTIVATE:
     case NS_MOUSE_OVER:
     case NS_MOUSE_OUT:
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -4572,17 +4572,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
 #endif
 
   // in order to send gecko events we'll need a gecko widget
   if (!mGeckoChild)
     return;
 
   NSUInteger modifierFlags = [theEvent modifierFlags];
 
-  WidgetMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_DOWN, mGeckoChild,
+  WidgetMouseEvent geckoEvent(true, eMouseDown, mGeckoChild,
                               WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
 
   NSInteger clickCount = [theEvent clickCount];
   if (mBlockedLastMouseDown && clickCount > 1) {
     // Don't send a double click if the first click of the double click was
     // blocked.
     clickCount--;
@@ -4782,17 +4782,17 @@ NewCGSRegionFromRegion(const nsIntRegion
 
   nsAutoRetainCocoaObject kungFuDeathGrip(self);
 
   [self maybeRollup:theEvent];
   if (!mGeckoChild)
     return;
 
   // The right mouse went down, fire off a right mouse down event to gecko
-  WidgetMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_DOWN, mGeckoChild,
+  WidgetMouseEvent geckoEvent(true, eMouseDown, mGeckoChild,
                               WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
   geckoEvent.button = WidgetMouseEvent::eRightButton;
   geckoEvent.clickCount = [theEvent clickCount];
 
   mGeckoChild->DispatchInputEvent(&geckoEvent);
   if (!mGeckoChild)
     return;
@@ -4845,17 +4845,17 @@ NewCGSRegionFromRegion(const nsIntRegion
 
   if ([self maybeRollup:theEvent] ||
       !ChildViewMouseTracker::WindowAcceptsEvent([self window], theEvent, self))
     return;
 
   if (!mGeckoChild)
     return;
 
-  WidgetMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_DOWN, mGeckoChild,
+  WidgetMouseEvent geckoEvent(true, eMouseDown, mGeckoChild,
                               WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
   geckoEvent.button = WidgetMouseEvent::eMiddleButton;
   geckoEvent.clickCount = [theEvent clickCount];
 
   mGeckoChild->DispatchInputEvent(&geckoEvent);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2748,18 +2748,17 @@ nsWindow::OnButtonPressEvent(GdkEventBut
         DispatchCommandEvent(nsGkAtoms::Forward);
         return;
     default:
         return;
     }
 
     gButtonState |= ButtonMaskFromGDKButton(aEvent->button);
 
-    WidgetMouseEvent event(true, NS_MOUSE_BUTTON_DOWN, this,
-                           WidgetMouseEvent::eReal);
+    WidgetMouseEvent event(true, eMouseDown, this, WidgetMouseEvent::eReal);
     event.button = domButton;
     InitButtonEvent(event, aEvent);
     event.pressure = mLastMotionPressure;
 
     DispatchInputEvent(&event);
 
     // right menu click on linux should also pop up a context menu
     if (domButton == WidgetMouseEvent::eRightButton &&
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -2644,17 +2644,17 @@ case _value: eventName.AssignLiteral(_na
     _ASSIGN_eventName(NS_FORM_SUBMIT,"NS_FORM_SUBMIT");
     _ASSIGN_eventName(NS_IMAGE_ABORT,"NS_IMAGE_ABORT");
     _ASSIGN_eventName(NS_LOAD_ERROR,"NS_LOAD_ERROR");
     _ASSIGN_eventName(eKeyDown,"eKeyDown");
     _ASSIGN_eventName(eKeyPress,"eKeyPress");
     _ASSIGN_eventName(eKeyUp,"eKeyUp");
     _ASSIGN_eventName(NS_MOUSE_ENTER_WIDGET,"NS_MOUSE_ENTER_WIDGET");
     _ASSIGN_eventName(NS_MOUSE_EXIT_WIDGET,"NS_MOUSE_EXIT_WIDGET");
-    _ASSIGN_eventName(NS_MOUSE_BUTTON_DOWN,"NS_MOUSE_BUTTON_DOWN");
+    _ASSIGN_eventName(eMouseDown,"eMouseDown");
     _ASSIGN_eventName(eMouseUp,"eMouseUp");
     _ASSIGN_eventName(NS_MOUSE_CLICK,"NS_MOUSE_CLICK");
     _ASSIGN_eventName(NS_MOUSE_DOUBLECLICK,"NS_MOUSE_DBLCLICK");
     _ASSIGN_eventName(eMouseMove,"eMouseMove");
     _ASSIGN_eventName(NS_LOAD,"NS_LOAD");
     _ASSIGN_eventName(NS_POPSTATE,"NS_POPSTATE");
     _ASSIGN_eventName(NS_BEFORE_SCRIPT_EXECUTE,"NS_BEFORE_SCRIPT_EXECUTE");
     _ASSIGN_eventName(NS_AFTER_SCRIPT_EXECUTE,"NS_AFTER_SCRIPT_EXECUTE");
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -994,18 +994,17 @@ nsWindow::mousePressEvent(QMouseEvent* a
     if (!IsAcceptedButton(aEvent->button())) {
         if (aEvent->button() == Qt::BackButton)
             return DispatchCommandEvent(nsGkAtoms::Back);
         if (aEvent->button() == Qt::ForwardButton)
             return DispatchCommandEvent(nsGkAtoms::Forward);
         return nsEventStatus_eIgnore;
     }
 
-    WidgetMouseEvent event(true, NS_MOUSE_BUTTON_DOWN, this,
-                           WidgetMouseEvent::eReal);
+    WidgetMouseEvent event(true, eMouseDown, this, WidgetMouseEvent::eReal);
     InitMouseEvent(event, aEvent, 1);
     nsEventStatus status = DispatchEvent(&event);
 
     // Right click on linux should also pop up a context menu.
     if (event.button == WidgetMouseEvent::eRightButton &&
         MOZ_LIKELY(!mIsDestroyed)) {
         WidgetMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
                                           WidgetMouseEvent::eReal);
--- a/widget/uikit/nsWindow.mm
+++ b/widget/uikit/nsWindow.mm
@@ -154,17 +154,17 @@ private:
 }
 
 - (void)handleTap:(UITapGestureRecognizer *)sender
 {
     if (sender.state == UIGestureRecognizerStateEnded) {
         ALOG("[ChildView[%p] handleTap]", self);
         LayoutDeviceIntPoint lp = UIKitPointsToDevPixels([sender locationInView:self], [self contentScaleFactor]);
         [self sendMouseEvent:eMouseMove point:lp widget:mGeckoChild];
-        [self sendMouseEvent:NS_MOUSE_BUTTON_DOWN point:lp widget:mGeckoChild];
+        [self sendMouseEvent:eMouseDown point:lp widget:mGeckoChild];
         [self sendMouseEvent:eMouseUp point:lp widget:mGeckoChild];
     }
 }
 
 - (void)sendTouchEvent:(int) aType touches:(NSSet*)aTouches widget:(nsWindow*)aWindow
 {
     WidgetTouchEvent event(true, aType, aWindow);
     //XXX: I think nativeEvent.timestamp * 1000 is probably usable here but
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -2596,18 +2596,17 @@ IMMHandler::OnMouseButtonEvent(nsWindow*
   }
 
   if (!sWM_MSIME_MOUSE || !IsComposingOnOurEditor() ||
       !ShouldDrawCompositionStringOurselves()) {
     return NS_OK;
   }
 
   // We need to handle only mousedown event.
-  if (aIMENotification.mMouseButtonEventData.mEventMessage !=
-        NS_MOUSE_BUTTON_DOWN) {
+  if (aIMENotification.mMouseButtonEventData.mEventMessage != eMouseDown) {
     return NS_OK;
   }
 
   // If the character under the cursor is not in the composition string,
   // we don't need to notify IME of it.
   uint32_t compositionStart = gIMMHandler->mCompositionStart;
   uint32_t compositionEnd =
     compositionStart + gIMMHandler->mCompositionString.Length();
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -533,18 +533,18 @@ GetDisplayAttrStr(const TF_DISPLAYATTRIB
   str += GetClauseAttrName(aDispAttr.bAttr);
   return str;
 }
 
 static const char*
 GetEventMessageName(uint32_t aMessage)
 {
   switch (aMessage) {
-    case NS_MOUSE_BUTTON_DOWN:
-      return "NS_MOUSE_BUTTON_DOWN";
+    case eMouseDown:
+      return "eMouseDown";
     case eMouseUp:
       return "eMouseUp";
     default:
       return "Unknown";
   }
 }
 
 static const char*
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -941,18 +941,17 @@ WinUtils::GetMouseInputSource()
 }
 
 /* static */
 bool
 WinUtils::GetIsMouseFromTouch(EventMessage aEventMessage)
 {
   const uint32_t MOZ_T_I_SIGNATURE = TABLET_INK_TOUCH | TABLET_INK_SIGNATURE;
   const uint32_t MOZ_T_I_CHECK_TCH = TABLET_INK_TOUCH | TABLET_INK_CHECK;
-  return ((aEventMessage == eMouseMove ||
-           aEventMessage == NS_MOUSE_BUTTON_DOWN ||
+  return ((aEventMessage == eMouseMove || aEventMessage == eMouseDown ||
            aEventMessage == eMouseUp) &&
          (GetMessageExtraInfo() & MOZ_T_I_SIGNATURE) == MOZ_T_I_CHECK_TCH);
 }
 
 /* static */
 MSG
 WinUtils::InitMSG(UINT aMessage, WPARAM wParam, LPARAM lParam, HWND aWnd)
 {
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -4020,17 +4020,17 @@ nsWindow::DispatchMouseEvent(EventMessag
       // Messages should be only at topLevel window.
       && nsWindowType::eWindowType_toplevel == mWindowType
       // Currently this scheme is used only when pointer events is enabled.
       && gfxPrefs::PointerEventsEnabled()) {
     InkCollector::sInkCollector->SetTarget(mWnd);
   }
 
   switch (aEventMessage) {
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
       CaptureMouse(true);
       break;
 
     // eMouseMove and NS_MOUSE_EXIT_WIDGET are here because we need to make
     // sure capture flag isn't left on after a drag where we wouldn't see a
     // button up message (see bug 324131).
     case eMouseUp:
     case eMouseMove:
@@ -4096,28 +4096,28 @@ nsWindow::DispatchMouseEvent(EventMessag
   }
 
   // Doubleclicks are used to set the click count, then changed to mousedowns
   // We're going to time double-clicks from mouse *up* to next mouse *down*
   LONG curMsgTime = ::GetMessageTime();
 
   switch (aEventMessage) {
     case NS_MOUSE_DOUBLECLICK:
-      event.mMessage = NS_MOUSE_BUTTON_DOWN;
+      event.mMessage = eMouseDown;
       event.button = aButton;
       sLastClickCount = 2;
       sLastMouseDownTime = curMsgTime;
       break;
     case eMouseUp:
       // remember when this happened for the next mouse down
       sLastMousePoint.x = eventPoint.x;
       sLastMousePoint.y = eventPoint.y;
       sLastMouseButton = eventButton;
       break;
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
       // now look to see if we want to convert this to a double- or triple-click
       if (((curMsgTime - sLastMouseDownTime) < (LONG)::GetDoubleClickTime()) &&
           insideMovementThreshold &&
           eventButton == sLastMouseButton) {
         sLastClickCount ++;
       } else {
         // reset the click count, to count *this* click
         sLastClickCount = 1;
@@ -4142,17 +4142,17 @@ nsWindow::DispatchMouseEvent(EventMessag
 #ifdef NS_DEBUG_XX
   MOZ_LOG(gWindowsLog, LogLevel::Info,
          ("Msg Time: %d Click Count: %d\n", curMsgTime, event.clickCount));
 #endif
 
   NPEvent pluginEvent;
 
   switch (aEventMessage) {
-    case NS_MOUSE_BUTTON_DOWN:
+    case eMouseDown:
       switch (aButton) {
         case WidgetMouseEvent::eLeftButton:
           pluginEvent.event = WM_LBUTTONDOWN;
           break;
         case WidgetMouseEvent::eMiddleButton:
           pluginEvent.event = WM_MBUTTONDOWN;
           break;
         case WidgetMouseEvent::eRightButton:
@@ -5137,17 +5137,17 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       // If we receive a mouse move event on non-client chrome, make sure and
       // send an NS_MOUSE_EXIT_WIDGET event as well.
       if (mMousePresent && !sIsInMouseCapture)
         SendMessage(mWnd, WM_MOUSELEAVE, 0, 0);
     break;
 
     case WM_LBUTTONDOWN:
     {
-      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam, lParam,
+      result = DispatchMouseEvent(eMouseDown, wParam, lParam,
                                   false, WidgetMouseEvent::eLeftButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
     }
     break;
 
     case WM_LBUTTONUP:
     {
@@ -5228,17 +5228,17 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, wParam,
                                   lParam, false,
                                   WidgetMouseEvent::eLeftButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_MBUTTONDOWN:
-      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam,
+      result = DispatchMouseEvent(eMouseDown, wParam,
                                   lParam, false,
                                   WidgetMouseEvent::eMiddleButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_MBUTTONUP:
       result = DispatchMouseEvent(eMouseUp, wParam,
@@ -5252,17 +5252,17 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, wParam,
                                   lParam, false,
                                   WidgetMouseEvent::eMiddleButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_NCMBUTTONDOWN:
-      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, 0,
+      result = DispatchMouseEvent(eMouseDown, 0,
                                   lParamToClient(lParam), false,
                                   WidgetMouseEvent::eMiddleButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_NCMBUTTONUP:
       result = DispatchMouseEvent(eMouseUp, 0,
@@ -5276,17 +5276,17 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, 0,
                                   lParamToClient(lParam), false,
                                   WidgetMouseEvent::eMiddleButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_RBUTTONDOWN:
-      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam,
+      result = DispatchMouseEvent(eMouseDown, wParam,
                                   lParam, false,
                                   WidgetMouseEvent::eRightButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_RBUTTONUP:
       result = DispatchMouseEvent(eMouseUp, wParam,
@@ -5300,17 +5300,17 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, wParam,
                                   lParam, false,
                                   WidgetMouseEvent::eRightButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_NCRBUTTONDOWN:
-      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, 0,
+      result = DispatchMouseEvent(eMouseDown, 0,
                                   lParamToClient(lParam), false,
                                   WidgetMouseEvent::eRightButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_NCRBUTTONUP:
       result = DispatchMouseEvent(eMouseUp, 0,