Bug 920377 part.32 Get rid of nsMouseEvent r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 02 Oct 2013 15:38:27 +0900
changeset 149619 50400711c347b3aff4f179907ac153a46a3a76a4
parent 149618 e19ed60eaffadc441bdba5c32aee14dd74d00e48
child 149620 32c6282f3a29dba12f60ff30945d0d22bd7ea948
push id25395
push useremorley@mozilla.com
push dateWed, 02 Oct 2013 15:42:23 +0000
treeherdermozilla-central@8bc54ab0ef14 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs920377
milestone27.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 920377 part.32 Get rid of nsMouseEvent r=roc
accessible/src/base/nsCoreUtils.cpp
accessible/src/generic/Accessible.cpp
content/base/src/Element.cpp
content/base/src/FragmentOrElement.cpp
content/events/src/nsDOMDragEvent.cpp
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMMouseEvent.cpp
content/events/src/nsDOMMouseScrollEvent.cpp
content/events/src/nsDOMSimpleGestureEvent.cpp
content/events/src/nsEventStateManager.cpp
content/events/src/nsEventStateManager.h
content/html/content/src/HTMLButtonElement.cpp
content/html/content/src/HTMLImageElement.cpp
content/html/content/src/HTMLInputElement.cpp
content/html/content/src/HTMLLabelElement.cpp
content/html/content/src/HTMLTextAreaElement.cpp
content/html/content/src/nsGenericHTMLElement.cpp
content/xul/content/src/nsXULElement.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsGlobalWindow.cpp
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
dom/plugins/base/nsPluginInstanceOwner.cpp
gfx/layers/composite/APZCTreeManager.cpp
gfx/layers/composite/APZCTreeManager.h
layout/base/PositionedEventTargeting.cpp
layout/base/nsPresShell.cpp
layout/base/nsPresShell.h
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsImageControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/generic/nsFrameSelection.h
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsImageFrame.cpp
layout/generic/nsSelection.cpp
layout/xul/base/src/nsMenuFrame.cpp
layout/xul/base/src/nsMenuPopupFrame.cpp
layout/xul/base/src/nsResizerFrame.cpp
layout/xul/base/src/nsScrollbarButtonFrame.cpp
layout/xul/base/src/nsSliderFrame.cpp
layout/xul/base/src/nsSplitterFrame.cpp
layout/xul/base/src/nsTitleBarFrame.cpp
layout/xul/base/src/nsXULPopupManager.cpp
view/src/nsViewManager.cpp
widget/EventForwards.h
widget/InputData.h
widget/MouseEvents.h
widget/android/nsWindow.cpp
widget/cocoa/TextInputHandler.mm
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/cocoa/nsMenuX.mm
widget/gonk/nsAppShell.cpp
widget/gtk/nsGtkKeyUtils.cpp
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
widget/nsGUIEventIPC.h
widget/nsIWidget.h
widget/os2/nsWindow.cpp
widget/os2/nsWindow.h
widget/qt/nsWindow.cpp
widget/qt/nsWindow.h
widget/windows/KeyboardLayout.cpp
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
widget/windows/winrt/MetroInput.cpp
widget/windows/winrt/MetroInput.h
widget/xpwidgets/InputData.cpp
widget/xpwidgets/nsBaseWidget.cpp
widget/xpwidgets/nsBaseWidget.h
xpfe/appshell/src/nsWebShellWindow.cpp
--- a/accessible/src/base/nsCoreUtils.cpp
+++ b/accessible/src/base/nsCoreUtils.cpp
@@ -117,23 +117,23 @@ nsCoreUtils::DispatchClickEvent(nsITreeB
                      tcContent, tcFrame, presShell, rootWidget);
 }
 
 void
 nsCoreUtils::DispatchMouseEvent(uint32_t aEventType, int32_t aX, int32_t aY,
                                 nsIContent *aContent, nsIFrame *aFrame,
                                 nsIPresShell *aPresShell, nsIWidget *aRootWidget)
 {
-  nsMouseEvent event(true, aEventType, aRootWidget,
-                     nsMouseEvent::eReal, nsMouseEvent::eNormal);
+  WidgetMouseEvent event(true, aEventType, aRootWidget,
+                         WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
 
   event.refPoint = LayoutDeviceIntPoint(aX, aY);
 
   event.clickCount = 1;
-  event.button = nsMouseEvent::eLeftButton;
+  event.button = WidgetMouseEvent::eLeftButton;
   event.time = PR_IntervalNow();
   event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
 
   nsEventStatus status = nsEventStatus_eIgnore;
   aPresShell->HandleEventWithTarget(&event, aFrame, aContent, &status);
 }
 
 void
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -833,18 +833,18 @@ Accessible::ChildAtPoint(int32_t aX, int
 
   // Check whether the point is at popup content.
   nsIWidget* rootWidget = rootFrame->GetView()->GetNearestWidget(nullptr);
   NS_ENSURE_TRUE(rootWidget, nullptr);
 
   nsIntRect rootRect;
   rootWidget->GetScreenBounds(rootRect);
 
-  nsMouseEvent dummyEvent(true, NS_MOUSE_MOVE, rootWidget,
-                          nsMouseEvent::eSynthesized);
+  WidgetMouseEvent dummyEvent(true, NS_MOUSE_MOVE, rootWidget,
+                              WidgetMouseEvent::eSynthesized);
   dummyEvent.refPoint = LayoutDeviceIntPoint(aX - rootRect.x, aY - rootRect.y);
 
   nsIFrame* popupFrame = nsLayoutUtils::
     GetPopupFrameForEventCoordinates(accDocument->PresContext()->GetRootPresContext(),
                                      &dummyEvent);
   if (popupFrame) {
     // If 'this' accessible is not inside the popup then ignore the popup when
     // searching an accessible at point.
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -1436,26 +1436,26 @@ Element::DispatchClickEvent(nsPresContex
                             bool aFullDispatch,
                             const EventFlags* aExtraEventFlags,
                             nsEventStatus* aStatus)
 {
   NS_PRECONDITION(aTarget, "Must have target");
   NS_PRECONDITION(aSourceEvent, "Must have source event");
   NS_PRECONDITION(aStatus, "Null out param?");
 
-  nsMouseEvent event(aSourceEvent->mFlags.mIsTrusted, NS_MOUSE_CLICK,
-                     aSourceEvent->widget, nsMouseEvent::eReal);
+  WidgetMouseEvent event(aSourceEvent->mFlags.mIsTrusted, NS_MOUSE_CLICK,
+                         aSourceEvent->widget, WidgetMouseEvent::eReal);
   event.refPoint = aSourceEvent->refPoint;
   uint32_t clickCount = 1;
   float pressure = 0;
   uint16_t inputSource = 0;
   if (aSourceEvent->eventStructType == NS_MOUSE_EVENT) {
-    clickCount = static_cast<nsMouseEvent*>(aSourceEvent)->clickCount;
-    pressure = static_cast<nsMouseEvent*>(aSourceEvent)->pressure;
-    inputSource = static_cast<nsMouseEvent*>(aSourceEvent)->inputSource;
+    clickCount = static_cast<WidgetMouseEvent*>(aSourceEvent)->clickCount;
+    pressure = static_cast<WidgetMouseEvent*>(aSourceEvent)->pressure;
+    inputSource = static_cast<WidgetMouseEvent*>(aSourceEvent)->inputSource;
   } else if (aSourceEvent->eventStructType == NS_KEY_EVENT) {
     inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
   }
   event.pressure = pressure;
   event.clickCount = clickCount;
   event.inputSource = inputSource;
   event.modifiers = aSourceEvent->modifiers;
   if (aExtraEventFlags) {
@@ -2217,18 +2217,18 @@ Element::PostHandleEventForLinks(nsEvent
   }
 
   nsresult rv = NS_OK;
 
   switch (aVisitor.mEvent->message) {
   case NS_MOUSE_BUTTON_DOWN:
     {
       if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
-          static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-          nsMouseEvent::eLeftButton) {
+          static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+            WidgetMouseEvent::eLeftButton) {
         // don't make the link grab the focus if there is no link handler
         nsILinkHandler *handler = aVisitor.mPresContext->GetLinkHandler();
         nsIDocument *document = GetCurrentDoc();
         if (handler && document) {
           nsIFocusManager* fm = nsFocusManager::GetFocusManager();
           if (fm) {
             aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
             nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(this);
--- a/content/base/src/FragmentOrElement.cpp
+++ b/content/base/src/FragmentOrElement.cpp
@@ -689,18 +689,18 @@ nsIContent::PreHandleEvent(nsEventChainP
   if ((aVisitor.mEvent->message == NS_MOUSE_ENTER_SYNTH ||
        aVisitor.mEvent->message == NS_MOUSE_EXIT_SYNTH) &&
       // Check if we should stop event propagation when event has just been
       // dispatched or when we're about to propagate from
       // chrome access only subtree.
       ((this == aVisitor.mEvent->originalTarget &&
         !ChromeOnlyAccess()) || isAnonForEvents)) {
      nsCOMPtr<nsIContent> relatedTarget =
-       do_QueryInterface(static_cast<nsMouseEvent*>
-                                    (aVisitor.mEvent)->relatedTarget);
+       do_QueryInterface(
+         static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->relatedTarget);
     if (relatedTarget &&
         relatedTarget->OwnerDoc() == OwnerDoc()) {
 
       // If current target is anonymous for events or we know that related
       // target is descendant of an element which is anonymous for events,
       // we may want to stop event propagation.
       // If this is the original target, aVisitor.mRelatedTargetIsInAnon
       // must be updated.
--- a/content/events/src/nsDOMDragEvent.cpp
+++ b/content/events/src/nsDOMDragEvent.cpp
@@ -19,17 +19,18 @@ nsDOMDragEvent::nsDOMDragEvent(mozilla::
 {
   if (aEvent) {
     mEventIsInternal = false;
   }
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
     mEvent->refPoint.x = mEvent->refPoint.y = 0;
-    static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
+    static_cast<WidgetMouseEvent*>(mEvent)->inputSource =
+      nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
   }
 }
 
 nsDOMDragEvent::~nsDOMDragEvent()
 {
   if (mEventIsInternal) {
     if (mEvent->eventStructType == NS_DRAG_EVENT)
       delete static_cast<WidgetDragEvent*>(mEvent);
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -545,19 +545,19 @@ nsDOMEvent::DuplicatePrivateData()
       WidgetKeyboardEvent* keyEvent =
         new WidgetKeyboardEvent(false, msg, nullptr);
       keyEvent->AssignKeyEventData(*oldKeyEvent, true);
       newEvent = keyEvent;
       break;
     }
     case NS_MOUSE_EVENT:
     {
-      nsMouseEvent* oldMouseEvent = static_cast<nsMouseEvent*>(mEvent);
-      nsMouseEvent* mouseEvent =
-        new nsMouseEvent(false, msg, nullptr, oldMouseEvent->reason);
+      WidgetMouseEvent* oldMouseEvent = static_cast<WidgetMouseEvent*>(mEvent);
+      WidgetMouseEvent* mouseEvent =
+        new WidgetMouseEvent(false, msg, nullptr, oldMouseEvent->reason);
       mouseEvent->AssignMouseEventData(*oldMouseEvent, true);
       newEvent = mouseEvent;
       break;
     }
     case NS_DRAG_EVENT:
     {
       WidgetDragEvent* oldDragEvent = static_cast<WidgetDragEvent*>(mEvent);
       WidgetDragEvent* dragEvent = new WidgetDragEvent(false, msg, nullptr);
@@ -935,17 +935,18 @@ nsDOMEvent::GetEventPopupControlState(Wi
           abuse = openControlled;
         }
         break;
       }
     }
     break;
   case NS_MOUSE_EVENT :
     if (aEvent->mFlags.mIsTrusted &&
-        static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) {
+        static_cast<WidgetMouseEvent*>(aEvent)->button ==
+          WidgetMouseEvent::eLeftButton) {
       switch(aEvent->message) {
       case NS_MOUSE_BUTTON_UP :
         if (::PopupAllowedForEvent("mouseup"))
           abuse = openControlled;
         break;
       case NS_MOUSE_BUTTON_DOWN :
         if (::PopupAllowedForEvent("mousedown"))
           abuse = openControlled;
--- a/content/events/src/nsDOMMouseEvent.cpp
+++ b/content/events/src/nsDOMMouseEvent.cpp
@@ -10,53 +10,54 @@
 #include "mozilla/MouseEvents.h"
 
 using namespace mozilla;
 
 nsDOMMouseEvent::nsDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
                                  nsPresContext* aPresContext,
                                  WidgetInputEvent* aEvent)
   : nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
-                 new nsMouseEvent(false, 0, nullptr,
-                                  nsMouseEvent::eReal))
+                 new WidgetMouseEvent(false, 0, nullptr,
+                                      WidgetMouseEvent::eReal))
 {
   // There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.
   // It's not that important, though, since a scroll event is not a real
   // DOM event.
   
   if (aEvent) {
     mEventIsInternal = false;
   }
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
     mEvent->refPoint.x = mEvent->refPoint.y = 0;
-    static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
+    static_cast<WidgetMouseEvent*>(mEvent)->inputSource =
+      nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
   }
 
   switch (mEvent->eventStructType)
   {
     case NS_MOUSE_EVENT:
-      NS_ASSERTION(static_cast<nsMouseEvent*>(mEvent)->reason
-                   != nsMouseEvent::eSynthesized,
+      NS_ASSERTION(static_cast<WidgetMouseEvent*>(mEvent)->reason
+                     != WidgetMouseEvent::eSynthesized,
                    "Don't dispatch DOM events from synthesized mouse events");
-      mDetail = static_cast<nsMouseEvent*>(mEvent)->clickCount;
+      mDetail = static_cast<WidgetMouseEvent*>(mEvent)->clickCount;
       break;
     default:
       break;
   }
 }
 
 nsDOMMouseEvent::~nsDOMMouseEvent()
 {
   if (mEventIsInternal && mEvent) {
     switch (mEvent->eventStructType)
     {
       case NS_MOUSE_EVENT:
-        delete static_cast<nsMouseEvent*>(mEvent);
+        delete static_cast<WidgetMouseEvent*>(mEvent);
         break;
       default:
         delete mEvent;
         break;
     }
     mEvent = nullptr;
   }
 }
@@ -92,17 +93,17 @@ nsDOMMouseEvent::InitMouseEvent(const ns
        WidgetInputEvent* inputEvent = static_cast<WidgetInputEvent*>(mEvent);
        inputEvent->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
        mClientPoint.x = aClientX;
        mClientPoint.y = aClientY;
        inputEvent->refPoint.x = aScreenX;
        inputEvent->refPoint.y = aScreenY;
 
        if (mEvent->eventStructType == NS_MOUSE_EVENT) {
-         nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(mEvent);
+         WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(mEvent);
          mouseEvent->clickCount = aDetail;
        }
        break;
     }
     default:
        break;
   }
 
@@ -214,17 +215,17 @@ nsDOMMouseEvent::Button()
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
       return static_cast<WidgetMouseEventBase*>(mEvent)->button;
     default:
       NS_WARNING("Tried to get mouse button for non-mouse event!");
-      return nsMouseEvent::eLeftButton;
+      return WidgetMouseEvent::eLeftButton;
   }
 }
 
 NS_IMETHODIMP
 nsDOMMouseEvent::GetButtons(uint16_t* aButtons)
 {
   NS_ENSURE_ARG_POINTER(aButtons);
   *aButtons = Buttons();
--- a/content/events/src/nsDOMMouseScrollEvent.cpp
+++ b/content/events/src/nsDOMMouseScrollEvent.cpp
@@ -17,17 +17,18 @@ nsDOMMouseScrollEvent::nsDOMMouseScrollE
                              new WidgetMouseScrollEvent(false, 0, nullptr))
 {
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
     mEvent->refPoint.x = mEvent->refPoint.y = 0;
-    static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
+    static_cast<WidgetMouseEventBase*>(mEvent)->inputSource =
+      nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
   }
 
   if(mEvent->eventStructType == NS_MOUSE_SCROLL_EVENT) {
     mDetail = static_cast<WidgetMouseScrollEvent*>(mEvent)->delta;
   }
 }
 
 nsDOMMouseScrollEvent::~nsDOMMouseScrollEvent()
--- a/content/events/src/nsDOMSimpleGestureEvent.cpp
+++ b/content/events/src/nsDOMSimpleGestureEvent.cpp
@@ -20,17 +20,18 @@ nsDOMSimpleGestureEvent::nsDOMSimpleGest
   NS_ASSERTION(mEvent->eventStructType == NS_SIMPLE_GESTURE_EVENT, "event type mismatch");
 
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
     mEvent->refPoint.x = mEvent->refPoint.y = 0;
-    static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
+    static_cast<WidgetMouseEventBase*>(mEvent)->inputSource =
+      nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
   }
 }
 
 nsDOMSimpleGestureEvent::~nsDOMSimpleGestureEvent()
 {
   if (mEventIsInternal) {
     delete static_cast<WidgetSimpleGestureEvent*>(mEvent);
     mEvent = nullptr;
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -131,17 +131,18 @@ RoundDown(double aDouble)
                          static_cast<int32_t>(ceil(aDouble));
 }
 
 static inline bool
 IsMouseEventReal(WidgetEvent* aEvent)
 {
   NS_ABORT_IF_FALSE(aEvent->IsMouseDerivedEvent(), "Not a mouse event");
   // Return true if not synthesized.
-  return static_cast<nsMouseEvent*>(aEvent)->reason == nsMouseEvent::eReal;
+  return static_cast<WidgetMouseEvent*>(aEvent)->reason ==
+           WidgetMouseEvent::eReal;
 }
 
 #ifdef DEBUG_DOCSHELL_FOCUS
 static void
 PrintDocTree(nsIDocShellTreeItem* aParentItem, int aLevel)
 {
   for (int32_t i=0;i<aLevel;i++) printf("  ");
 
@@ -837,87 +838,95 @@ nsEventStateManager::PreHandleEvent(nsPr
   }
 
   *aStatus = nsEventStatus_eIgnore;
 
   nsMouseWheelTransaction::OnEvent(aEvent);
 
   switch (aEvent->message) {
   case NS_MOUSE_BUTTON_DOWN:
-    switch (static_cast<nsMouseEvent*>(aEvent)->button) {
-    case nsMouseEvent::eLeftButton:
+    switch (static_cast<WidgetMouseEvent*>(aEvent)->button) {
+    case WidgetMouseEvent::eLeftButton:
 #ifndef XP_OS2
-      BeginTrackingDragGesture(aPresContext, (nsMouseEvent*)aEvent, aTargetFrame);
+      BeginTrackingDragGesture(aPresContext,
+                               static_cast<WidgetMouseEvent*>(aEvent),
+                               aTargetFrame);
 #endif
-      mLClickCount = ((nsMouseEvent*)aEvent)->clickCount;
-      SetClickCount(aPresContext, (nsMouseEvent*)aEvent, aStatus);
+      mLClickCount = static_cast<WidgetMouseEvent*>(aEvent)->clickCount;
+      SetClickCount(aPresContext, static_cast<WidgetMouseEvent*>(aEvent),
+                    aStatus);
       sNormalLMouseEventInProcess = true;
       break;
-    case nsMouseEvent::eMiddleButton:
-      mMClickCount = ((nsMouseEvent*)aEvent)->clickCount;
-      SetClickCount(aPresContext, (nsMouseEvent*)aEvent, aStatus);
+    case WidgetMouseEvent::eMiddleButton:
+      mMClickCount = static_cast<WidgetMouseEvent*>(aEvent)->clickCount;
+      SetClickCount(aPresContext, static_cast<WidgetMouseEvent*>(aEvent),
+                    aStatus);
       break;
-    case nsMouseEvent::eRightButton:
+    case WidgetMouseEvent::eRightButton:
 #ifdef XP_OS2
-      BeginTrackingDragGesture(aPresContext, (nsMouseEvent*)aEvent, aTargetFrame);
+      BeginTrackingDragGesture(aPresContext,
+                               static_cast<WidgetMouseEvent*>(aEvent),
+                               aTargetFrame);
 #endif
-      mRClickCount = ((nsMouseEvent*)aEvent)->clickCount;
-      SetClickCount(aPresContext, (nsMouseEvent*)aEvent, aStatus);
+      mRClickCount = static_cast<WidgetMouseEvent*>(aEvent)->clickCount;
+      SetClickCount(aPresContext, static_cast<WidgetMouseEvent*>(aEvent),
+                    aStatus);
       break;
     }
     break;
   case NS_MOUSE_BUTTON_UP:
-    switch (static_cast<nsMouseEvent*>(aEvent)->button) {
-      case nsMouseEvent::eLeftButton:
+    switch (static_cast<WidgetMouseEvent*>(aEvent)->button) {
+      case WidgetMouseEvent::eLeftButton:
         if (Prefs::ClickHoldContextMenu()) {
           KillClickHoldTimer();
         }
 #ifndef XP_OS2
         StopTrackingDragGesture();
 #endif
         sNormalLMouseEventInProcess = false;
         // then fall through...
-      case nsMouseEvent::eRightButton:
+      case WidgetMouseEvent::eRightButton:
 #ifdef XP_OS2
         StopTrackingDragGesture();
 #endif
         // then fall through...
-      case nsMouseEvent::eMiddleButton:
-        SetClickCount(aPresContext, (nsMouseEvent*)aEvent, aStatus);
+      case WidgetMouseEvent::eMiddleButton:
+        SetClickCount(aPresContext, static_cast<WidgetMouseEvent*>(aEvent),
+                      aStatus);
         break;
     }
     break;
   case NS_MOUSE_EXIT:
     // If the event is not a top-level window exit, then it's not
     // really an exit --- we may have traversed widget boundaries but
     // we're still in our toplevel window.
     {
-      nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aEvent);
-      if (mouseEvent->exit != nsMouseEvent::eTopLevel) {
+      WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(aEvent);
+      if (mouseEvent->exit != WidgetMouseEvent::eTopLevel) {
         // Treat it as a synthetic move so we don't generate spurious
         // "exit" or "move" events.  Any necessary "out" or "over" events
         // will be generated by GenerateMouseEnterExit
         mouseEvent->message = NS_MOUSE_MOVE;
-        mouseEvent->reason = nsMouseEvent::eSynthesized;
+        mouseEvent->reason = WidgetMouseEvent::eSynthesized;
         // then fall through...
       } else {
         GenerateMouseEnterExit(static_cast<WidgetGUIEvent*>(aEvent));
         //This is a window level mouse exit event and should stop here
         aEvent->message = 0;
         break;
       }
     }
   case NS_MOUSE_MOVE:
     // on the Mac, GenerateDragGesture() may not return until the drag
     // has completed and so |aTargetFrame| may have been deleted (moving
     // a bookmark, for example).  If this is the case, however, we know
     // that ClearFrameRefs() has been called and it cleared out
     // |mCurrentTarget|. As a result, we should pass |mCurrentTarget|
     // into UpdateCursor().
-    GenerateDragGesture(aPresContext, (nsMouseEvent*)aEvent);
+    GenerateDragGesture(aPresContext, static_cast<WidgetMouseEvent*>(aEvent));
     UpdateCursor(aPresContext, aEvent, mCurrentTarget, aStatus);
     GenerateMouseEnterExit(static_cast<WidgetGUIEvent*>(aEvent));
     // Flush pending layout changes, so that later mouse move events
     // will go to the right nodes.
     FlushPendingEvents(aPresContext);
     break;
   case NS_DRAGDROP_GESTURE:
     if (Prefs::ClickHoldContextMenu()) {
@@ -1383,17 +1392,17 @@ nsEventStateManager::DispatchCrossProces
   PBrowserParent* remoteBrowser = aFrameLoader->GetRemoteBrowser();
   TabParent* remote = static_cast<TabParent*>(remoteBrowser);
   if (!remote) {
     return false;
   }
 
   switch (aEvent->eventStructType) {
   case NS_MOUSE_EVENT: {
-    nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aEvent);
+    WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(aEvent);
     return remote->SendRealMouseEvent(*mouseEvent);
   }
   case NS_KEY_EVENT: {
     WidgetKeyboardEvent* keyEvent = static_cast<WidgetKeyboardEvent*>(aEvent);
     return remote->SendRealKeyEvent(*keyEvent);
   }
   case NS_WHEEL_EVENT: {
     WheelEvent* wheelEvent = static_cast<WheelEvent*>(aEvent);
@@ -1730,19 +1739,18 @@ nsEventStateManager::FireContextClick()
                tag == nsGkAtoms::embed  ||
                tag == nsGkAtoms::object) {
         allowedToDispatch = false;
       }
     }
 
     if (allowedToDispatch) {
       // init the event while mCurrentTarget is still good
-      nsMouseEvent event(true, NS_CONTEXTMENU,
-                         targetWidget,
-                         nsMouseEvent::eReal);
+      WidgetMouseEvent event(true, NS_CONTEXTMENU, targetWidget,
+                             WidgetMouseEvent::eReal);
       event.clickCount = 1;
       FillInEventFromGestureDown(&event);
         
       // stop selection tracking, we're in control now
       if (mCurrentTarget)
       {
         nsRefPtr<nsFrameSelection> frameSel =
           mCurrentTarget->GetFrameSelection();
@@ -1787,17 +1795,17 @@ nsEventStateManager::FireContextClick()
 // We also use this to track click-hold context menus. When the mouse goes down,
 // fire off a short timer. If the timer goes off and we have yet to fire the
 // drag gesture (ie, the mouse hasn't moved a certain distance), then we can
 // assume the user wants a click-hold, so fire a context-click event. We only
 // want to cancel the drag gesture if the context-click event is handled.
 //
 void
 nsEventStateManager::BeginTrackingDragGesture(nsPresContext* aPresContext,
-                                              nsMouseEvent* inDownEvent,
+                                              WidgetMouseEvent* inDownEvent,
                                               nsIFrame* inDownFrame)
 {
   if (!inDownEvent->widget)
     return;
 
   // Note that |inDownEvent| could be either a mouse down event or a
   // synthesized mouse move event.
   mGestureDownPoint = inDownEvent->refPoint +
@@ -1826,17 +1834,17 @@ nsEventStateManager::BeginTrackingDragGe
 void
 nsEventStateManager::StopTrackingDragGesture()
 {
   mGestureDownContent = nullptr;
   mGestureDownFrameOwner = nullptr;
 }
 
 void
-nsEventStateManager::FillInEventFromGestureDown(nsMouseEvent* aEvent)
+nsEventStateManager::FillInEventFromGestureDown(WidgetMouseEvent* aEvent)
 {
   NS_ASSERTION(aEvent->widget == mCurrentTarget->GetNearestWidget(),
                "Incorrect widget in event");
 
   // Set the coordinates in the new event to the coordinates of
   // the old event, adjusted for the fact that the widget might be
   // different
   aEvent->refPoint = mGestureDownPoint -
@@ -1848,17 +1856,17 @@ nsEventStateManager::FillInEventFromGest
 //
 // GenerateDragGesture
 //
 // If we're in the TRACKING state of the d&d gesture tracker, check the current position
 // of the mouse in relation to the old one. If we've moved a sufficient amount from
 // the mouse down, then fire off a drag gesture event.
 void
 nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
-                                         nsMouseEvent *aEvent)
+                                         WidgetMouseEvent* aEvent)
 {
   NS_ASSERTION(aPresContext, "This shouldn't happen.");
   if (IsTrackingDragGesture()) {
     mCurrentTarget = mGestureDownFrameOwner->GetPrimaryFrame();
 
     if (!mCurrentTarget) {
       StopTrackingDragGesture();
       return;
@@ -2956,17 +2964,18 @@ nsEventStateManager::PostHandleEvent(nsP
 
   //Keep the prescontext alive, we might need it after event dispatch
   nsRefPtr<nsPresContext> presContext = aPresContext;
   nsresult ret = NS_OK;
 
   switch (aEvent->message) {
   case NS_MOUSE_BUTTON_DOWN:
     {
-      if (static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton &&
+      if (static_cast<WidgetMouseEvent*>(aEvent)->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;
       }
 
       nsCOMPtr<nsIContent> activeContent;
@@ -3085,18 +3094,18 @@ nsEventStateManager::PostHandleEvent(nsP
 #endif
                 fm->ClearFocus(mDocument->GetWindow());
               fm->SetFocusedWindow(mDocument->GetWindow());
             }
           }
         }
 
         // The rest is left button-specific.
-        if (static_cast<nsMouseEvent*>(aEvent)->button !=
-            nsMouseEvent::eLeftButton)
+        if (static_cast<WidgetMouseEvent*>(aEvent)->button !=
+              WidgetMouseEvent::eLeftButton)
           break;
 
         if (activeContent) {
           // The nearest enclosing element goes into the
           // :active state.  If we fail the QI to DOMElement,
           // then we know we're only a node, and that we need
           // to obtain our parent element and put it into :active
           // instead.
@@ -3144,17 +3153,18 @@ nsEventStateManager::PostHandleEvent(nsP
     {
       ClearGlobalActiveContent(this);
       if (IsMouseEventReal(aEvent)) {
         if (!mCurrentTarget) {
           GetEventTarget();
         }
         // Make sure to dispatch the click even if there is no frame for
         // the current target element. This is required for Web compatibility.
-        ret = CheckForAndDispatchClick(presContext, (nsMouseEvent*)aEvent,
+        ret = CheckForAndDispatchClick(presContext,
+                                       static_cast<WidgetMouseEvent*>(aEvent),
                                        aStatus);
       }
 
       nsIPresShell *shell = presContext->GetPresShell();
       if (shell) {
         nsRefPtr<nsFrameSelection> frameSelection = shell->FrameSelection();
         frameSelection->SetMouseDownState(false);
       }
@@ -3347,17 +3357,17 @@ nsEventStateManager::PostHandleEvent(nsP
         nsCOMPtr<nsIContent> targetContent;
         mCurrentTarget->GetContentForEvent(aEvent,
                                            getter_AddRefs(targetContent));
 
         nsCOMPtr<nsIWidget> widget = mCurrentTarget->GetNearestWidget();
         WidgetDragEvent event(aEvent->mFlags.mIsTrusted,
                               NS_DRAGDROP_DRAGDROP, widget);
 
-        nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aEvent);
+        WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(aEvent);
         event.refPoint = mouseEvent->refPoint;
         if (mouseEvent->widget) {
           event.refPoint += LayoutDeviceIntPoint::FromUntyped(mouseEvent->widget->WidgetToScreenOffset());
         }
         event.refPoint -= LayoutDeviceIntPoint::FromUntyped(widget->WidgetToScreenOffset());
         event.modifiers = mouseEvent->modifiers;
         event.buttons = mouseEvent->buttons;
         event.inputSource = mouseEvent->inputSource;
@@ -3801,24 +3811,24 @@ nsEventStateManager::DispatchMouseEvent(
       return nullptr;
     }
     nsCOMPtr<nsIContent> content = do_QueryInterface(pointerLockedElement);
     return mPresContext->GetPrimaryFrameFor(content);
   }
 
   PROFILER_LABEL("Input", "DispatchMouseEvent");
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(aEvent->mFlags.mIsTrusted, aMessage, aEvent->widget,
-                     nsMouseEvent::eReal);
+  WidgetMouseEvent event(aEvent->mFlags.mIsTrusted, aMessage, aEvent->widget,
+                         WidgetMouseEvent::eReal);
   event.refPoint = aEvent->refPoint;
-  event.modifiers = ((nsMouseEvent*)aEvent)->modifiers;
-  event.buttons = ((nsMouseEvent*)aEvent)->buttons;
-  event.pluginEvent = ((nsMouseEvent*)aEvent)->pluginEvent;
+  event.modifiers = static_cast<WidgetMouseEvent*>(aEvent)->modifiers;
+  event.buttons = static_cast<WidgetMouseEvent*>(aEvent)->buttons;
+  event.pluginEvent = static_cast<WidgetMouseEvent*>(aEvent)->pluginEvent;
   event.relatedTarget = aRelatedContent;
-  event.inputSource = static_cast<nsMouseEvent*>(aEvent)->inputSource;
+  event.inputSource = static_cast<WidgetMouseEvent*>(aEvent)->inputSource;
 
   nsWeakFrame previousTarget = mCurrentTarget;
 
   mCurrentTargetContent = aTargetContent;
 
   nsIFrame* targetFrame = nullptr;
   if (aTargetContent) {
     nsESMEventCB callback(aTargetContent);
@@ -4278,20 +4288,20 @@ nsEventStateManager::FireDragEnterOrExit
                                          uint32_t aMsg,
                                          nsIContent* aRelatedTarget,
                                          nsIContent* aTargetContent,
                                          nsWeakFrame& aTargetFrame)
 {
   nsEventStatus status = nsEventStatus_eIgnore;
   WidgetDragEvent event(aEvent->mFlags.mIsTrusted, aMsg, aEvent->widget);
   event.refPoint = aEvent->refPoint;
-  event.modifiers = ((nsMouseEvent*)aEvent)->modifiers;
-  event.buttons = ((nsMouseEvent*)aEvent)->buttons;
+  event.modifiers = static_cast<WidgetMouseEvent*>(aEvent)->modifiers;
+  event.buttons = static_cast<WidgetMouseEvent*>(aEvent)->buttons;
   event.relatedTarget = aRelatedTarget;
-  event.inputSource = static_cast<nsMouseEvent*>(aEvent)->inputSource;
+  event.inputSource = static_cast<WidgetMouseEvent*>(aEvent)->inputSource;
 
   mCurrentTargetContent = aTargetContent;
 
   if (aTargetContent != aRelatedTarget) {
     //XXX This event should still go somewhere!!
     if (aTargetContent)
       nsEventDispatcher::Dispatch(aTargetContent, aPresContext, &event,
                                   nullptr, &status);
@@ -4333,33 +4343,33 @@ nsEventStateManager::UpdateDragDataTrans
       dragEvent->dataTransfer->GetMozCursor(mozCursor);
       initialDataTransfer->SetMozCursor(mozCursor);
     }
   }
 }
 
 nsresult
 nsEventStateManager::SetClickCount(nsPresContext* aPresContext,
-                                   nsMouseEvent *aEvent,
+                                   WidgetMouseEvent* aEvent,
                                    nsEventStatus* aStatus)
 {
   nsCOMPtr<nsIContent> mouseContent;
   nsIContent* mouseContentParent = nullptr;
   mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(mouseContent));
   if (mouseContent) {
     if (mouseContent->IsNodeOfType(nsINode::eTEXT)) {
       mouseContent = mouseContent->GetParent();
     }
     if (mouseContent && mouseContent->IsRootOfNativeAnonymousSubtree()) {
       mouseContentParent = mouseContent->GetParent();
     }
   }
 
   switch (aEvent->button) {
-  case nsMouseEvent::eLeftButton:
+  case WidgetMouseEvent::eLeftButton:
     if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
       mLastLeftMouseDownContent = mouseContent;
       mLastLeftMouseDownContentParent = mouseContentParent;
     } else if (aEvent->message == NS_MOUSE_BUTTON_UP) {
       if (mLastLeftMouseDownContent == mouseContent ||
           mLastLeftMouseDownContentParent == mouseContent ||
           mLastLeftMouseDownContent == mouseContentParent) {
         aEvent->clickCount = mLClickCount;
@@ -4367,17 +4377,17 @@ nsEventStateManager::SetClickCount(nsPre
       } else {
         aEvent->clickCount = 0;
       }
       mLastLeftMouseDownContent = nullptr;
       mLastLeftMouseDownContentParent = nullptr;
     }
     break;
 
-  case nsMouseEvent::eMiddleButton:
+  case WidgetMouseEvent::eMiddleButton:
     if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
       mLastMiddleMouseDownContent = mouseContent;
       mLastMiddleMouseDownContentParent = mouseContentParent;
     } else if (aEvent->message == NS_MOUSE_BUTTON_UP) {
       if (mLastMiddleMouseDownContent == mouseContent ||
           mLastMiddleMouseDownContentParent == mouseContent ||
           mLastMiddleMouseDownContent == mouseContentParent) {
         aEvent->clickCount = mMClickCount;
@@ -4385,17 +4395,17 @@ nsEventStateManager::SetClickCount(nsPre
       } else {
         aEvent->clickCount = 0;
       }
       mLastMiddleMouseDownContent = nullptr;
       mLastMiddleMouseDownContentParent = nullptr;
     }
     break;
 
-  case nsMouseEvent::eRightButton:
+  case WidgetMouseEvent::eRightButton:
     if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
       mLastRightMouseDownContent = mouseContent;
       mLastRightMouseDownContentParent = mouseContentParent;
     } else if (aEvent->message == NS_MOUSE_BUTTON_UP) {
       if (mLastRightMouseDownContent == mouseContent ||
           mLastRightMouseDownContentParent == mouseContent ||
           mLastRightMouseDownContent == mouseContentParent) {
         aEvent->clickCount = mRClickCount;
@@ -4409,36 +4419,36 @@ nsEventStateManager::SetClickCount(nsPre
     break;
   }
 
   return NS_OK;
 }
 
 nsresult
 nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
-                                              nsMouseEvent *aEvent,
+                                              WidgetMouseEvent* aEvent,
                                               nsEventStatus* aStatus)
 {
   nsresult ret = NS_OK;
 
   //If mouse is still over same element, clickcount will be > 1.
   //If it has moved it will be zero, so no click.
   if (0 != aEvent->clickCount) {
     //Check that the window isn't disabled before firing a click
     //(see bug 366544).
     if (aEvent->widget && !aEvent->widget->IsEnabled()) {
       return ret;
     }
     //fire click
     bool notDispatchToContents =
-     (aEvent->button == nsMouseEvent::eMiddleButton ||
-      aEvent->button == nsMouseEvent::eRightButton);
-
-    nsMouseEvent event(aEvent->mFlags.mIsTrusted, NS_MOUSE_CLICK,
-                       aEvent->widget, nsMouseEvent::eReal);
+     (aEvent->button == WidgetMouseEvent::eMiddleButton ||
+      aEvent->button == WidgetMouseEvent::eRightButton);
+
+    WidgetMouseEvent event(aEvent->mFlags.mIsTrusted, NS_MOUSE_CLICK,
+                           aEvent->widget, WidgetMouseEvent::eReal);
     event.refPoint = aEvent->refPoint;
     event.clickCount = aEvent->clickCount;
     event.modifiers = aEvent->modifiers;
     event.buttons = aEvent->buttons;
     event.time = aEvent->time;
     event.mFlags.mNoContentDispatch = notDispatchToContents;
     event.button = aEvent->button;
     event.inputSource = aEvent->inputSource;
@@ -4451,18 +4461,18 @@ nsEventStateManager::CheckForAndDispatch
       }
 
       // HandleEvent clears out mCurrentTarget which we might need again
       nsWeakFrame currentTarget = mCurrentTarget;
       ret = presShell->HandleEventWithTarget(&event, currentTarget,
                                              mouseContent, aStatus);
       if (NS_SUCCEEDED(ret) && aEvent->clickCount == 2) {
         //fire double click
-        nsMouseEvent event2(aEvent->mFlags.mIsTrusted, NS_MOUSE_DOUBLECLICK,
-                            aEvent->widget, nsMouseEvent::eReal);
+        WidgetMouseEvent event2(aEvent->mFlags.mIsTrusted, NS_MOUSE_DOUBLECLICK,
+                                aEvent->widget, WidgetMouseEvent::eReal);
         event2.refPoint = aEvent->refPoint;
         event2.clickCount = aEvent->clickCount;
         event2.modifiers = aEvent->modifiers;
         event2.buttons = aEvent->buttons;
         event2.mFlags.mNoContentDispatch = notDispatchToContents;
         event2.button = aEvent->button;
         event2.inputSource = aEvent->inputSource;
 
@@ -4842,18 +4852,19 @@ nsEventStateManager::ContentRemoved(nsID
     mLastMouseOverElement = nullptr;
   }
 }
 
 bool
 nsEventStateManager::EventStatusOK(WidgetGUIEvent* aEvent)
 {
   return !(aEvent->message == NS_MOUSE_BUTTON_DOWN &&
-      static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton  && 
-      !sNormalLMouseEventInProcess);
+           static_cast<WidgetMouseEvent*>(aEvent)->button ==
+             WidgetMouseEvent::eLeftButton &&
+           !sNormalLMouseEventInProcess);
 }
 
 //-------------------------------------------
 // Access Key Registration
 //-------------------------------------------
 void
 nsEventStateManager::RegisterAccessKey(nsIContent* aContent, uint32_t aKey)
 {
--- a/content/events/src/nsEventStateManager.h
+++ b/content/events/src/nsEventStateManager.h
@@ -296,18 +296,22 @@ protected:
                            nsIContent* aTargetContent,
                            nsWeakFrame& aTargetFrame);
   /**
    * Update the initial drag session data transfer with any changes that occur
    * on cloned data transfer objects used for events.
    */
   void UpdateDragDataTransfer(mozilla::WidgetDragEvent* dragEvent);
 
-  nsresult SetClickCount(nsPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus);
-  nsresult CheckForAndDispatchClick(nsPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus);
+  nsresult SetClickCount(nsPresContext* aPresContext,
+                         mozilla::WidgetMouseEvent* aEvent,
+                         nsEventStatus* aStatus);
+  nsresult CheckForAndDispatchClick(nsPresContext* aPresContext,
+                                    mozilla::WidgetMouseEvent* aEvent,
+                                    nsEventStatus* aStatus);
   void EnsureDocument(nsPresContext* aPresContext);
   void FlushPendingEvents(nsPresContext* aPresContext);
 
   /**
    * The phases of HandleAccessKey processing. See below.
    */
   typedef enum {
     eAccessKeyProcessingNormal = 0,
@@ -661,20 +665,22 @@ protected:
    * Currently it decides between panning (finger scrolling) or dragging
    * the target element, as well as the orientation to trigger panning and
    * display visual boundary feedback. The decision is stored back in aEvent.
    */
   void DecideGestureEvent(mozilla::WidgetGestureNotifyEvent* aEvent,
                           nsIFrame* targetFrame);
 
   // routines for the d&d gesture tracking state machine
-  void BeginTrackingDragGesture ( nsPresContext* aPresContext, nsMouseEvent* inDownEvent,
-                                  nsIFrame* inDownFrame ) ;
-  void StopTrackingDragGesture ( ) ;
-  void GenerateDragGesture ( nsPresContext* aPresContext, nsMouseEvent *aEvent ) ;
+  void BeginTrackingDragGesture(nsPresContext* aPresContext,
+                                mozilla::WidgetMouseEvent* aDownEvent,
+                                nsIFrame* aDownFrame);
+  void StopTrackingDragGesture();
+  void GenerateDragGesture(nsPresContext* aPresContext,
+                           mozilla::WidgetMouseEvent* aEvent);
 
   /**
    * Determine which node the drag should be targeted at.
    * This is either the node clicked when there is a selection, or, for HTML,
    * the element with a draggable property set to true.
    *
    * aSelectionTarget - target to check for selection
    * aDataTransfer - data transfer object that will contain the data to drag
@@ -705,17 +711,17 @@ protected:
 
   bool IsTrackingDragGesture ( ) const { return mGestureDownContent != nullptr; }
   /**
    * Set the fields of aEvent to reflect the mouse position and modifier keys
    * that were set when the user first pressed the mouse button (stored by
    * BeginTrackingDragGesture). aEvent->widget must be
    * mCurrentTarget->GetNearestWidget().
    */
-  void FillInEventFromGestureDown(nsMouseEvent* aEvent);
+  void FillInEventFromGestureDown(mozilla::WidgetMouseEvent* aEvent);
 
   nsresult DoContentCommandEvent(mozilla::WidgetContentCommandEvent* aEvent);
   nsresult DoContentCommandScrollEvent(
              mozilla::WidgetContentCommandEvent* aEvent);
 
   void DoQuerySelectedText(mozilla::WidgetQueryContentEvent* aEvent);
 
   bool RemoteQueryContentEvent(mozilla::WidgetEvent* aEvent);
--- a/content/html/content/src/HTMLButtonElement.cpp
+++ b/content/html/content/src/HTMLButtonElement.cpp
@@ -263,48 +263,49 @@ HTMLButtonElement::PostHandleEvent(nsEve
           WidgetKeyboardEvent* keyEvent =
             static_cast<WidgetKeyboardEvent*>(aVisitor.mEvent);
           if ((keyEvent->keyCode == NS_VK_RETURN &&
                NS_KEY_PRESS == aVisitor.mEvent->message) ||
               (keyEvent->keyCode == NS_VK_SPACE &&
                NS_KEY_UP == aVisitor.mEvent->message)) {
             nsEventStatus status = nsEventStatus_eIgnore;
 
-            nsMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
-                               NS_MOUSE_CLICK, nullptr,
-                               nsMouseEvent::eReal);
+            WidgetMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
+                                   NS_MOUSE_CLICK, nullptr,
+                                   WidgetMouseEvent::eReal);
             event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
             nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this),
                                         aVisitor.mPresContext, &event, nullptr,
                                         &status);
             aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
           }
         }
         break;// NS_KEY_PRESS
 
       case NS_MOUSE_BUTTON_DOWN:
         {
           if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT) {
-            if (static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-                  nsMouseEvent::eLeftButton) {
+            if (static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+                  WidgetMouseEvent::eLeftButton) {
               if (aVisitor.mEvent->mFlags.mIsTrusted) {
                 nsEventStateManager* esm =
                   aVisitor.mPresContext->EventStateManager();
                 nsEventStateManager::SetActiveManager(
                   static_cast<nsEventStateManager*>(esm), this);
               }
               nsIFocusManager* fm = nsFocusManager::GetFocusManager();
               if (fm)
                 fm->SetFocus(this, nsIFocusManager::FLAG_BYMOUSE |
                                    nsIFocusManager::FLAG_NOSCROLL);
               aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
-            } else if (static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-                         nsMouseEvent::eMiddleButton ||
-                       static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-                         nsMouseEvent::eRightButton) {
+            } else if (
+              static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+                WidgetMouseEvent::eMiddleButton ||
+              static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+                WidgetMouseEvent::eRightButton) {
               // cancel all of these events for buttons
               //XXXsmaug What to do with these events? Why these should be cancelled?
               if (aVisitor.mDOMEvent) {
                 aVisitor.mDOMEvent->StopPropagation();
               }
             }
           }
         }
@@ -312,20 +313,20 @@ HTMLButtonElement::PostHandleEvent(nsEve
 
       // cancel all of these events for buttons
       //XXXsmaug What to do with these events? Why these should be cancelled?
       case NS_MOUSE_BUTTON_UP:
       case NS_MOUSE_DOUBLECLICK:
         {
           if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
               aVisitor.mDOMEvent &&
-              (static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-                 nsMouseEvent::eMiddleButton ||
-               static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-                 nsMouseEvent::eRightButton)) {
+              (static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+                 WidgetMouseEvent::eMiddleButton ||
+               static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+                 WidgetMouseEvent::eRightButton)) {
             aVisitor.mDOMEvent->StopPropagation();
           }
         }
         break;
 
       case NS_MOUSE_ENTER_SYNTH:
         {
           aVisitor.mPresContext->EventStateManager()->
--- a/content/html/content/src/HTMLImageElement.cpp
+++ b/content/html/content/src/HTMLImageElement.cpp
@@ -327,18 +327,18 @@ nsresult
 HTMLImageElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
 {
   // If we are a map and get a mouse click, don't let it be handled by
   // the Generic Element as this could cause a click event to fire
   // twice, once by the image frame for the map and once by the Anchor
   // element. (bug 39723)
   if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
       aVisitor.mEvent->message == NS_MOUSE_CLICK &&
-      static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-        nsMouseEvent::eLeftButton) {
+      static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+        WidgetMouseEvent::eLeftButton) {
     bool isMap = false;
     GetIsMap(&isMap);
     if (isMap) {
       aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
     }
   }
   return nsGenericHTMLElement::PreHandleEvent(aVisitor);
 }
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -2794,17 +2794,18 @@ HTMLInputElement::MaybeSubmitForm(nsPres
 
   // Get the default submit element
   nsIFormControl* submitControl = mForm->GetDefaultSubmitElement();
   if (submitControl) {
     nsCOMPtr<nsIContent> submitContent = do_QueryInterface(submitControl);
     NS_ASSERTION(submitContent, "Form control not implementing nsIContent?!");
     // Fire the button's onclick handler and let the button handle
     // submitting the form.
-    nsMouseEvent event(true, NS_MOUSE_CLICK, nullptr, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_CLICK, nullptr,
+                           WidgetMouseEvent::eReal);
     nsEventStatus status = nsEventStatus_eIgnore;
     shell->HandleDOMEventWithTarget(submitContent, &event, &status);
   } else if (mForm->HasSingleTextControl() &&
              (mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
               mForm->CheckValidFormSubmission())) {
     // TODO: removing this code and have the submit event sent by the form,
     // bug 592124.
     // If there's only one text control, just submit the form
@@ -3075,18 +3076,18 @@ HTMLInputElement::PreHandleEvent(nsEvent
   // this event.  But to allow middle mouse button paste to work we must allow
   // middle clicks to go to text fields anyway.
   if (aVisitor.mEvent->mFlags.mNoContentDispatch) {
     aVisitor.mItemFlags |= NS_NO_CONTENT_DISPATCH;
   }
   if (IsSingleLineTextControl(false) &&
       aVisitor.mEvent->message == NS_MOUSE_CLICK &&
       aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
-      static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-        nsMouseEvent::eMiddleButton) {
+      static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+        WidgetMouseEvent::eMiddleButton) {
     aVisitor.mEvent->mFlags.mNoContentDispatch = false;
   }
 
   // We must cache type because mType may change during JS event (bug 2369)
   aVisitor.mItemFlags |= mType;
 
   // Fire onchange (if necessary), before we do the blur, bug 357684.
   if (aVisitor.mEvent->message == NS_BLUR_CONTENT) {
@@ -3436,18 +3437,19 @@ HTMLInputElement::PostHandleEvent(nsEven
                 }
                 // else fall through and treat Space like click...
               }
               case NS_FORM_INPUT_BUTTON:
               case NS_FORM_INPUT_RESET:
               case NS_FORM_INPUT_SUBMIT:
               case NS_FORM_INPUT_IMAGE: // Bug 34418
               {
-                nsMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
-                                   NS_MOUSE_CLICK, nullptr, nsMouseEvent::eReal);
+                WidgetMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
+                                       NS_MOUSE_CLICK, nullptr,
+                                       WidgetMouseEvent::eReal);
                 event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
                 nsEventStatus status = nsEventStatus_eIgnore;
 
                 nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this),
                                             aVisitor.mPresContext, &event,
                                             nullptr, &status);
                 aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
               } // case
@@ -3471,19 +3473,19 @@ HTMLInputElement::PostHandleEvent(nsEven
                 GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
                 nsRefPtr<HTMLInputElement> selectedRadioButton;
                 container->GetNextRadioButton(name, isMovingBack, this,
                                               getter_AddRefs(selectedRadioButton));
                 if (selectedRadioButton) {
                   rv = selectedRadioButton->Focus();
                   if (NS_SUCCEEDED(rv)) {
                     nsEventStatus status = nsEventStatus_eIgnore;
-                    nsMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
-                                       NS_MOUSE_CLICK, nullptr,
-                                       nsMouseEvent::eReal);
+                    WidgetMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
+                                           NS_MOUSE_CLICK, nullptr,
+                                           WidgetMouseEvent::eReal);
                     event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
                     rv = nsEventDispatcher::Dispatch(ToSupports(selectedRadioButton),
                                                      aVisitor.mPresContext,
                                                      &event, nullptr, &status);
                     if (NS_SUCCEEDED(rv)) {
                       aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
                     }
                   }
@@ -3577,20 +3579,20 @@ HTMLInputElement::PostHandleEvent(nsEven
 
         case NS_MOUSE_BUTTON_DOWN:
         case NS_MOUSE_BUTTON_UP:
         case NS_MOUSE_DOUBLECLICK:
         {
           // cancel all of these events for buttons
           //XXXsmaug Why?
           if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
-              (static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-                 nsMouseEvent::eMiddleButton ||
-               static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-                 nsMouseEvent::eRightButton)) {
+              (static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+                 WidgetMouseEvent::eMiddleButton ||
+               static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+                 WidgetMouseEvent::eRightButton)) {
             if (mType == NS_FORM_INPUT_BUTTON ||
                 mType == NS_FORM_INPUT_RESET ||
                 mType == NS_FORM_INPUT_SUBMIT) {
               if (aVisitor.mDOMEvent) {
                 aVisitor.mDOMEvent->StopPropagation();
               } else {
                 rv = NS_ERROR_FAILURE;
               }
@@ -3700,18 +3702,19 @@ HTMLInputElement::PostHandleEventForRang
         static_cast<WidgetInputEvent*>(aVisitor.mEvent);
       if (inputEvent->IsShift() || inputEvent->IsControl() ||
           inputEvent->IsAlt() || inputEvent->IsMeta() ||
           inputEvent->IsAltGraph() || inputEvent->IsFn() ||
           inputEvent->IsOS()) {
         break; // ignore
       }
       if (aVisitor.mEvent->message == NS_MOUSE_BUTTON_DOWN) {
-        nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aVisitor.mEvent);
-        if (mouseEvent->buttons == nsMouseEvent::eLeftButtonFlag) {
+        WidgetMouseEvent* mouseEvent =
+          static_cast<WidgetMouseEvent*>(aVisitor.mEvent);
+        if (mouseEvent->buttons == WidgetMouseEvent::eLeftButtonFlag) {
           StartRangeThumbDrag(inputEvent);
         } else if (mIsDraggingRange) {
           CancelRangeThumbDrag();
         }
       } else {
         WidgetTouchEvent* touchEvent =
           static_cast<WidgetTouchEvent*>(aVisitor.mEvent);
         if (touchEvent->touches.Length() == 1) {
--- a/content/html/content/src/HTMLLabelElement.cpp
+++ b/content/html/content/src/HTMLLabelElement.cpp
@@ -128,32 +128,32 @@ HTMLLabelElement::PostHandleEvent(nsEven
   nsRefPtr<Element> content = GetLabeledElement();
 
   if (content && !EventTargetIn(aVisitor.mEvent, content, this)) {
     mHandlingEvent = true;
     switch (aVisitor.mEvent->message) {
       case NS_MOUSE_BUTTON_DOWN:
         NS_ASSERTION(aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT,
                      "wrong event struct for event");
-        if (static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-            nsMouseEvent::eLeftButton) {
+        if (static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->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(aVisitor.mEvent->refPoint);
           SetProperty(nsGkAtoms::labelMouseDownPtProperty,
                       static_cast<void*>(curPoint),
                       DestroyMouseDownPoint);
         }
         break;
 
       case NS_MOUSE_CLICK:
         if (aVisitor.mEvent->IsLeftClickEvent()) {
-          const nsMouseEvent* event =
-            static_cast<const nsMouseEvent*>(aVisitor.mEvent);
+          const WidgetMouseEvent* event =
+            static_cast<const WidgetMouseEvent*>(aVisitor.mEvent);
           LayoutDeviceIntPoint* mouseDownPoint =
             static_cast<LayoutDeviceIntPoint*>(
               GetProperty(nsGkAtoms::labelMouseDownPtProperty));
 
           bool dragSelect = false;
           if (mouseDownPoint) {
             LayoutDeviceIntPoint dragDistance = *mouseDownPoint;
             DeleteProperty(nsGkAtoms::labelMouseDownPtProperty);
@@ -231,18 +231,18 @@ HTMLLabelElement::PerformAccesskey(bool 
     if (element)
       element->PerformAccesskey(aKeyCausesActivation, aIsTrustedEvent);
   } else {
     nsPresContext *presContext = GetPresContext();
     if (!presContext)
       return;
 
     // Click on it if the users prefs indicate to do so.
-    nsMouseEvent event(aIsTrustedEvent, NS_MOUSE_CLICK,
-                       nullptr, nsMouseEvent::eReal);
+    WidgetMouseEvent event(aIsTrustedEvent, NS_MOUSE_CLICK,
+                           nullptr, WidgetMouseEvent::eReal);
     event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
 
     nsAutoPopupStatePusher popupStatePusher(aIsTrustedEvent ?
                                             openAllowed : openAbused);
 
     nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
                                 &event);
   }
--- a/content/html/content/src/HTMLTextAreaElement.cpp
+++ b/content/html/content/src/HTMLTextAreaElement.cpp
@@ -473,18 +473,18 @@ HTMLTextAreaElement::PreHandleEvent(nsEv
   // If noContentDispatch is true we will not allow content to handle
   // this event.  But to allow middle mouse button paste to work we must allow 
   // middle clicks to go to text fields anyway.
   if (aVisitor.mEvent->mFlags.mNoContentDispatch) {
     aVisitor.mItemFlags |= NS_NO_CONTENT_DISPATCH;
   }
   if (aVisitor.mEvent->message == NS_MOUSE_CLICK &&
       aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
-      static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-        nsMouseEvent::eMiddleButton) {
+      static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
+        WidgetMouseEvent::eMiddleButton) {
     aVisitor.mEvent->mFlags.mNoContentDispatch = false;
   }
 
   // Fire onchange (if necessary), before we do the blur, bug 370521.
   if (aVisitor.mEvent->message == NS_BLUR_CONTENT) {
     FireChangeEventIfNeeded();
   }
 
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -2726,18 +2726,18 @@ nsGenericHTMLElement::Click()
     }
   }
 
   SetHandlingClick();
 
   // Click() is never called from native code, but it may be
   // called from chrome JS. Mark this event trusted if Click()
   // is called from chrome code.
-  nsMouseEvent event(nsContentUtils::IsCallerChrome(),
-                     NS_MOUSE_CLICK, nullptr, nsMouseEvent::eReal);
+  WidgetMouseEvent event(nsContentUtils::IsCallerChrome(),
+                         NS_MOUSE_CLICK, nullptr, WidgetMouseEvent::eReal);
   event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
 
   nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), context, &event);
 
   ClearHandlingClick();
 }
 
 bool
@@ -2829,18 +2829,18 @@ nsGenericHTMLElement::PerformAccesskey(b
   // It's hard to say what HTML4 wants us to do in all cases.
   nsIFocusManager* fm = nsFocusManager::GetFocusManager();
   if (fm) {
     fm->SetFocus(this, nsIFocusManager::FLAG_BYKEY);
   }
 
   if (aKeyCausesActivation) {
     // Click on it if the users prefs indicate to do so.
-    nsMouseEvent event(aIsTrustedEvent, NS_MOUSE_CLICK,
-                       nullptr, nsMouseEvent::eReal);
+    WidgetMouseEvent event(aIsTrustedEvent, NS_MOUSE_CLICK, nullptr,
+                           WidgetMouseEvent::eReal);
     event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
 
     nsAutoPopupStatePusher popupStatePusher(aIsTrustedEvent ?
                                             openAllowed : openAbused);
 
     nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext, &event);
   }
 }
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -1595,22 +1595,22 @@ 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();
 
-            nsMouseEvent eventDown(isCallerChrome, NS_MOUSE_BUTTON_DOWN,
-                                   nullptr, nsMouseEvent::eReal);
-            nsMouseEvent eventUp(isCallerChrome, NS_MOUSE_BUTTON_UP,
-                                 nullptr, nsMouseEvent::eReal);
-            nsMouseEvent eventClick(isCallerChrome, NS_MOUSE_CLICK, nullptr,
-                                    nsMouseEvent::eReal);
+            WidgetMouseEvent eventDown(isCallerChrome, NS_MOUSE_BUTTON_DOWN,
+                                       nullptr, WidgetMouseEvent::eReal);
+            WidgetMouseEvent eventUp(isCallerChrome, NS_MOUSE_BUTTON_UP,
+                                     nullptr, WidgetMouseEvent::eReal);
+            WidgetMouseEvent eventClick(isCallerChrome, NS_MOUSE_CLICK, nullptr,
+                                        WidgetMouseEvent::eReal);
             eventDown.inputSource = eventUp.inputSource = eventClick.inputSource 
                                   = aInputSource;
 
             // send mouse down
             nsEventStatus status = nsEventStatus_eIgnore;
             nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this),
                                         context, &eventDown,  nullptr, &status);
 
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -635,26 +635,26 @@ ToWidgetPoint(const CSSPoint& aPoint, co
     CSSPoint::ToAppUnits(aPoint) + aOffset,
     aPresContext->AppUnitsPerDevPixel());
 }
 
 static inline int16_t
 GetButtonsFlagForButton(int32_t aButton)
 {
   switch (aButton) {
-    case nsMouseEvent::eLeftButton:
-      return nsMouseEvent::eLeftButtonFlag;
-    case nsMouseEvent::eMiddleButton:
-      return nsMouseEvent::eMiddleButtonFlag;
-    case nsMouseEvent::eRightButton:
-      return nsMouseEvent::eRightButtonFlag;
+    case WidgetMouseEvent::eLeftButton:
+      return WidgetMouseEvent::eLeftButtonFlag;
+    case WidgetMouseEvent::eMiddleButton:
+      return WidgetMouseEvent::eMiddleButtonFlag;
+    case WidgetMouseEvent::eRightButton:
+      return WidgetMouseEvent::eRightButtonFlag;
     case 4:
-      return nsMouseEvent::e4thButtonFlag;
+      return WidgetMouseEvent::e4thButtonFlag;
     case 5:
-      return nsMouseEvent::e5thButtonFlag;
+      return WidgetMouseEvent::e5thButtonFlag;
     default:
       NS_ERROR("Button not known.");
       return 0;
   }
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
@@ -698,19 +698,19 @@ nsDOMWindowUtils::SendMouseEventCommon(c
     msg = NS_MOUSE_MOZHITTEST;
   else
     return NS_ERROR_FAILURE;
 
   if (aInputSourceArg == nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN) {
     aInputSourceArg = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
   }
 
-  nsMouseEvent event(true, msg, widget, nsMouseEvent::eReal,
-                     contextMenuKey ?
-                       nsMouseEvent::eContextMenuKey : nsMouseEvent::eNormal);
+  WidgetMouseEvent event(true, msg, widget, WidgetMouseEvent::eReal,
+                         contextMenuKey ? WidgetMouseEvent::eContextMenuKey :
+                                          WidgetMouseEvent::eNormal);
   event.modifiers = GetWidgetModifiers(aModifiers);
   event.button = aButton;
   event.buttons = GetButtonsFlagForButton(aButton);
   event.widget = widget;
   event.pressure = aPressure;
   event.inputSource = aInputSourceArg;
   event.clickCount = aClickCount;
   event.time = PR_IntervalNow();
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -11786,17 +11786,17 @@ nsGlobalChromeWindow::BeginWindowMove(ns
     return NS_OK;
   }
 
   NS_ENSURE_TRUE(aMouseDownEvent, NS_ERROR_FAILURE);
   WidgetEvent* internalEvent = aMouseDownEvent->GetInternalNSEvent();
   NS_ENSURE_TRUE(internalEvent &&
                  internalEvent->eventStructType == NS_MOUSE_EVENT,
                  NS_ERROR_FAILURE);
-  nsMouseEvent *mouseEvent = static_cast<nsMouseEvent*>(internalEvent);
+  WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(internalEvent);
 
   return widget->BeginMoveDrag(mouseEvent);
 }
 
 //Note: This call will lock the cursor, it will not change as it moves.
 //To unlock, the cursor must be set back to CURSOR_AUTO.
 NS_IMETHODIMP
 nsGlobalChromeWindow::SetCursor(const nsAString& aCursor)
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -37,17 +37,17 @@ using mozilla::void_t;
 using mozilla::WindowsHandle;
 using nscolor;
 using mozilla::WidgetCompositionEvent;
 using nsIMEUpdatePreference;
 using nsIntPoint;
 using nsIntRect;
 using nsIntSize;
 using mozilla::WidgetKeyboardEvent;
-using nsMouseEvent;
+using mozilla::WidgetMouseEvent;
 using mozilla::WheelEvent;
 using nsRect;
 using mozilla::WidgetSelectionEvent;
 using mozilla::WidgetTextEvent;
 using mozilla::WidgetTouchEvent;
 using RemoteDOMEvent;
 using mozilla::dom::ScreenOrientation;
 using mozilla::layers::TextureFactoryIdentifier;
@@ -360,17 +360,17 @@ child:
     MouseEvent(nsString aType,
                float aX,
                float aY,
                int32_t aButton,
                int32_t aClickCount,
                int32_t aModifiers,
                bool aIgnoreRootScrollFrame);
 
-    RealMouseEvent(nsMouseEvent event);
+    RealMouseEvent(WidgetMouseEvent event);
     RealKeyEvent(WidgetKeyboardEvent event);
     MouseWheelEvent(WheelEvent event);
     RealTouchEvent(WidgetTouchEvent event);
     // We use a separate message for touchmove events only to apply
     // compression to them.
     RealTouchMoveEvent(WidgetTouchEvent event) compress;
 
     /**
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1661,19 +1661,19 @@ TabChild::RecvMouseEvent(const nsString&
                          const bool&     aIgnoreRootScrollFrame)
 {
   DispatchMouseEvent(aType, CSSPoint(aX, aY), aButton, aClickCount, aModifiers,
                      aIgnoreRootScrollFrame, nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN);
   return true;
 }
 
 bool
-TabChild::RecvRealMouseEvent(const nsMouseEvent& event)
+TabChild::RecvRealMouseEvent(const WidgetMouseEvent& event)
 {
-  nsMouseEvent localEvent(event);
+  WidgetMouseEvent localEvent(event);
   DispatchWidgetEvent(localEvent);
   return true;
 }
 
 bool
 TabChild::RecvMouseWheelEvent(const WheelEvent& event)
 {
   WheelEvent localEvent(event);
@@ -1683,21 +1683,21 @@ TabChild::RecvMouseWheelEvent(const Whee
 
 void
 TabChild::DispatchSynthesizedMouseEvent(uint32_t aMsg, uint64_t aTime,
                                         const LayoutDevicePoint& aRefPoint)
 {
   MOZ_ASSERT(aMsg == NS_MOUSE_MOVE || aMsg == NS_MOUSE_BUTTON_DOWN ||
              aMsg == NS_MOUSE_BUTTON_UP);
 
-  nsMouseEvent event(true, aMsg, NULL,
-      nsMouseEvent::eReal, nsMouseEvent::eNormal);
+  WidgetMouseEvent event(true, aMsg, NULL,
+                         WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
   event.refPoint = LayoutDeviceIntPoint(aRefPoint.x, aRefPoint.y);
   event.time = aTime;
-  event.button = nsMouseEvent::eLeftButton;
+  event.button = WidgetMouseEvent::eLeftButton;
   event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
   if (aMsg != NS_MOUSE_MOVE) {
     event.clickCount = 1;
   }
 
   DispatchWidgetEvent(event);
 }
 
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -222,17 +222,17 @@ public:
     virtual bool RecvDeactivate();
     virtual bool RecvMouseEvent(const nsString& aType,
                                 const float&    aX,
                                 const float&    aY,
                                 const int32_t&  aButton,
                                 const int32_t&  aClickCount,
                                 const int32_t&  aModifiers,
                                 const bool&     aIgnoreRootScrollFrame);
-    virtual bool RecvRealMouseEvent(const nsMouseEvent& event);
+    virtual bool RecvRealMouseEvent(const mozilla::WidgetMouseEvent& event);
     virtual bool RecvRealKeyEvent(const mozilla::WidgetKeyboardEvent& event);
     virtual bool RecvMouseWheelEvent(const mozilla::WheelEvent& event);
     virtual bool RecvRealTouchEvent(const WidgetTouchEvent& event);
     virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& event);
     virtual bool RecvKeyEvent(const nsString& aType,
                               const int32_t&  aKeyCode,
                               const int32_t&  aCharCode,
                               const int32_t&  aModifiers,
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -629,22 +629,22 @@ TabParent::MapEventCoordinatesForChildPr
       Touch* touch = touches[i];
       if (touch) {
         touch->mRefPoint += LayoutDeviceIntPoint::ToUntyped(aOffset);
       }
     }
   }
 }
 
-bool TabParent::SendRealMouseEvent(nsMouseEvent& event)
+bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event)
 {
   if (mIsDestroyed) {
     return false;
   }
-  nsMouseEvent e(event);
+  WidgetMouseEvent e(event);
   MaybeForwardEventToRenderFrame(event, &e);
   if (!MapEventCoordinatesForChildProcess(&e)) {
     return false;
   }
   return PBrowserParent::SendRealMouseEvent(e);
 }
 
 bool TabParent::SendMouseWheelEvent(WheelEvent& event)
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -192,17 +192,17 @@ public:
                                             mozilla::WidgetEvent* aEvent);
 
     void SendMouseEvent(const nsAString& aType, float aX, float aY,
                         int32_t aButton, int32_t aClickCount,
                         int32_t aModifiers, bool aIgnoreRootScrollFrame);
     void SendKeyEvent(const nsAString& aType, int32_t aKeyCode,
                       int32_t aCharCode, int32_t aModifiers,
                       bool aPreventDefault);
-    bool SendRealMouseEvent(nsMouseEvent& event);
+    bool SendRealMouseEvent(mozilla::WidgetMouseEvent& event);
     bool SendMouseWheelEvent(mozilla::WheelEvent& event);
     bool SendRealKeyEvent(mozilla::WidgetKeyboardEvent& event);
     bool SendRealTouchEvent(WidgetTouchEvent& event);
 
     virtual PDocumentRendererParent*
     AllocPDocumentRendererParent(const nsRect& documentRect, const gfxMatrix& transform,
                                  const nsString& bgcolor,
                                  const uint32_t& renderFlags, const bool& flushLayout,
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1860,17 +1860,17 @@ nsPluginInstanceOwner::ProcessMouseDown(
     if (fm) {
       nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(mContent);
       fm->SetFocus(elem, 0);
     }
   }
 
   WidgetEvent* event = aMouseEvent->GetInternalNSEvent();
   if (event && event->eventStructType == NS_MOUSE_EVENT) {
-    mLastMouseDownButtonType = static_cast<nsMouseEvent*>(event)->button;
+    mLastMouseDownButtonType = static_cast<WidgetMouseEvent*>(event)->button;
     nsEventStatus rv = ProcessEvent(*static_cast<WidgetGUIEvent*>(event));
     if (nsEventStatus_eConsumeNoDefault == rv) {
       return aMouseEvent->PreventDefault(); // consume event
     }
   }
   
   return NS_OK;
 }
@@ -1920,18 +1920,18 @@ nsPluginInstanceOwner::HandleEvent(nsIDO
   }
   if (eventType.EqualsLiteral("mouseup")) {
     // Don't send a mouse-up event to the plugin if its button type doesn't
     // match that of the preceding mouse-down event (if any).  This kind of
     // mismatch can happen if the previous mouse-down event was sent to a DOM
     // element above the plugin, the mouse is still above the plugin, and the
     // mouse-down event caused the element to disappear.  See bug 627649 and
     // bug 909678.
-    nsMouseEvent *event =
-      static_cast<nsMouseEvent*>(aEvent->GetInternalNSEvent());
+    WidgetMouseEvent *event =
+      static_cast<WidgetMouseEvent*>(aEvent->GetInternalNSEvent());
     if (event && ((int) event->button != mLastMouseDownButtonType)) {
       aEvent->PreventDefault();
       return NS_OK;
     }
     return DispatchMouseToPlugin(aEvent);
   }
   if (eventType.EqualsLiteral("mousemove") ||
       eventType.EqualsLiteral("click") ||
@@ -2032,17 +2032,18 @@ nsEventStatus nsPluginInstanceOwner::Pro
         synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
         synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
         event = &synthCocoaEvent;
         break;
       case NS_MOUSE_BUTTON_UP:
         // If we're in a dragging operation that started over another frame,
         // convert it into a mouse-entered event (in the Cocoa Event Model).
         // See bug 525078.
-        if ((static_cast<const nsMouseEvent&>(anEvent).button == nsMouseEvent::eLeftButton) &&
+        if ((static_cast<const WidgetMouseEvent&>(anEvent).button ==
+               WidgetMouseEvent::eLeftButton) &&
             (nsIPresShell::GetCapturingContent() != mObjectFrame->GetContent())) {
           synthCocoaEvent.type = NPCocoaEventMouseEntered;
           synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
           synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
           event = &synthCocoaEvent;
         } else {
           synthCocoaEvent.type = NPCocoaEventMouseUp;
           synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
@@ -2069,17 +2070,18 @@ nsEventStatus nsPluginInstanceOwner::Pro
 
   if (eventModel == NPEventModelCocoa && response == kNPEventStartIME) {
     pluginWidget->StartComplexTextInputForCurrentEvent();
   }
 
   if ((response == kNPEventHandled || response == kNPEventStartIME) &&
       !(anEvent.eventStructType == NS_MOUSE_EVENT &&
         anEvent.message == NS_MOUSE_BUTTON_DOWN &&
-        static_cast<const nsMouseEvent&>(anEvent).button == nsMouseEvent::eLeftButton &&
+        static_cast<const WidgetMouseEvent&>(anEvent).button ==
+          WidgetMouseEvent::eLeftButton &&
         !mContentFocused))
     rv = nsEventStatus_eConsumeNoDefault;
 
   pluginWidget->EndDrawPlugin();
 #endif
 
 #ifdef XP_WIN
   // this code supports windowless plugins
@@ -2087,17 +2089,18 @@ nsEventStatus nsPluginInstanceOwner::Pro
   // we can get synthetic events from the nsEventStateManager... these
   // have no pluginEvent
   NPEvent pluginEvent;
   if (anEvent.eventStructType == NS_MOUSE_EVENT) {
     if (!pPluginEvent) {
       // XXX Should extend this list to synthesize events for more event
       // types
       pluginEvent.event = 0;
-      const nsMouseEvent* mouseEvent = static_cast<const nsMouseEvent*>(&anEvent);
+      const WidgetMouseEvent* mouseEvent =
+        static_cast<const WidgetMouseEvent*>(&anEvent);
       switch (anEvent.message) {
       case NS_MOUSE_MOVE:
         pluginEvent.event = WM_MOUSEMOVE;
         break;
       case NS_MOUSE_BUTTON_DOWN: {
         static const int downMsgs[] =
           { WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN };
         static const int dblClickMsgs[] =
@@ -2206,18 +2209,18 @@ nsEventStatus nsPluginInstanceOwner::Pro
 
         // Get reference point relative to plugin origin.
         const nsPresContext* presContext = mObjectFrame->PresContext();
         nsPoint appPoint =
           nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mObjectFrame) -
           mObjectFrame->GetContentRectRelativeToSelf().TopLeft();
         nsIntPoint pluginPoint(presContext->AppUnitsToDevPixels(appPoint.x),
                                presContext->AppUnitsToDevPixels(appPoint.y));
-        const nsMouseEvent& mouseEvent =
-          static_cast<const nsMouseEvent&>(anEvent);
+        const WidgetMouseEvent& mouseEvent =
+          static_cast<const WidgetMouseEvent&>(anEvent);
         // Get reference point relative to screen:
         LayoutDeviceIntPoint rootPoint(-1, -1);
         if (widget)
           rootPoint = anEvent.refPoint +
             LayoutDeviceIntPoint::FromUntyped(widget->WidgetToScreenOffset());
 #ifdef MOZ_WIDGET_GTK
         Window root = GDK_ROOT_WINDOW();
 #elif defined(MOZ_WIDGET_QT)
@@ -2276,23 +2279,23 @@ nsEventStatus nsPluginInstanceOwner::Pro
               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);
               switch (mouseEvent.button)
                 {
-                case nsMouseEvent::eMiddleButton:
+                case WidgetMouseEvent::eMiddleButton:
                   event.button = 2;
                   break;
-                case nsMouseEvent::eRightButton:
+                case WidgetMouseEvent::eRightButton:
                   event.button = 3;
                   break;
-                default: // nsMouseEvent::eLeftButton;
+                default: // WidgetMouseEvent::eLeftButton;
                   event.button = 1;
                   break;
                 }
               // information lost:
               event.subwindow = None;
               event.same_screen = True;
             }
             break;
--- a/gfx/layers/composite/APZCTreeManager.cpp
+++ b/gfx/layers/composite/APZCTreeManager.cpp
@@ -355,30 +355,31 @@ APZCTreeManager::ProcessTouchEvent(const
   if (aEvent.message == NS_TOUCH_CANCEL ||
       (aEvent.message == NS_TOUCH_END && aEvent.touches.Length() == 1)) {
     mApzcForInputBlock = nullptr;
   }
   return ret;
 }
 
 nsEventStatus
-APZCTreeManager::ProcessMouseEvent(const nsMouseEvent& aEvent,
-                                   nsMouseEvent* aOutEvent)
+APZCTreeManager::ProcessMouseEvent(const WidgetMouseEvent& aEvent,
+                                   WidgetMouseEvent* aOutEvent)
 {
   nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(ScreenPoint(aEvent.refPoint.x, aEvent.refPoint.y));
   if (!apzc) {
     return nsEventStatus_eIgnore;
   }
   gfx3DMatrix transformToApzc;
   gfx3DMatrix transformToScreen;
   GetInputTransforms(apzc, transformToApzc, transformToScreen);
   MultiTouchInput inputForApzc(aEvent);
   ApplyTransform(&(inputForApzc.mTouches[0].mScreenPoint), transformToApzc);
   gfx3DMatrix outTransform = transformToApzc * transformToScreen;
-  ApplyTransform(&(static_cast<nsMouseEvent*>(aOutEvent)->refPoint), outTransform);
+  ApplyTransform(&(static_cast<WidgetMouseEvent*>(aOutEvent)->refPoint),
+                 outTransform);
   return apzc->ReceiveInputEvent(inputForApzc);
 }
 
 nsEventStatus
 APZCTreeManager::ProcessEvent(const WidgetInputEvent& aEvent,
                               WidgetInputEvent* aOutEvent)
 {
   // Transform the refPoint
@@ -415,18 +416,19 @@ APZCTreeManager::ReceiveInputEvent(const
       if (!mApzcForInputBlock) {
         return nsEventStatus_eIgnore;
       }
       WidgetTouchEvent* outEvent = static_cast<WidgetTouchEvent*>(aOutEvent);
       return ProcessTouchEvent(touchEvent, outEvent);
     }
     case NS_MOUSE_EVENT: {
       // For b2g emulation
-      const nsMouseEvent& mouseEvent = static_cast<const nsMouseEvent&>(aEvent);
-      nsMouseEvent* outEvent = static_cast<nsMouseEvent*>(aOutEvent);
+      const WidgetMouseEvent& mouseEvent =
+        static_cast<const WidgetMouseEvent&>(aEvent);
+      WidgetMouseEvent* outEvent = static_cast<WidgetMouseEvent*>(aOutEvent);
       return ProcessMouseEvent(mouseEvent, outEvent);
     }
     default: {
       return ProcessEvent(aEvent, aOutEvent);
     }
   }
 }
 
--- a/gfx/layers/composite/APZCTreeManager.h
+++ b/gfx/layers/composite/APZCTreeManager.h
@@ -297,17 +297,17 @@ public:
 private:
   /* Helpers */
   AsyncPanZoomController* FindTargetAPZC(AsyncPanZoomController* aApzc, const ScrollableLayerGuid& aGuid);
   AsyncPanZoomController* GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& aHitTestPoint);
   AsyncPanZoomController* CommonAncestor(AsyncPanZoomController* aApzc1, AsyncPanZoomController* aApzc2);
   AsyncPanZoomController* RootAPZCForLayersId(AsyncPanZoomController* aApzc);
   AsyncPanZoomController* GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent, ScreenPoint aPoint);
   nsEventStatus ProcessTouchEvent(const WidgetTouchEvent& touchEvent, WidgetTouchEvent* aOutEvent);
-  nsEventStatus ProcessMouseEvent(const nsMouseEvent& mouseEvent, nsMouseEvent* aOutEvent);
+  nsEventStatus ProcessMouseEvent(const WidgetMouseEvent& mouseEvent, WidgetMouseEvent* aOutEvent);
   nsEventStatus ProcessEvent(const WidgetInputEvent& inputEvent, WidgetInputEvent* aOutEvent);
 
   /**
    * Recursive helper function to build the APZC tree. The tree of APZC instances has
    * the same shape as the layer tree, but excludes all the layers that are not scrollable.
    * Note that this means APZCs corresponding to layers at different depths in the tree
    * may end up becoming siblings. It also means that the "root" APZC may have siblings.
    * This function walks the layer tree backwards through siblings and constructs the APZC
--- a/layout/base/PositionedEventTargeting.cpp
+++ b/layout/base/PositionedEventTargeting.cpp
@@ -317,17 +317,17 @@ FindFrameTargetedByInputEvent(const Widg
   if (!prefs || !prefs->mEnabled || (target && IsElementClickable(target, nsGkAtoms::body))) {
     return target;
   }
 
   // Do not modify targeting for actual mouse hardware; only for mouse
   // events generated by touch-screen hardware.
   if (aEvent->eventStructType == NS_MOUSE_EVENT &&
       prefs->mTouchOnly &&
-      static_cast<const nsMouseEvent*>(aEvent)->inputSource !=
+      static_cast<const WidgetMouseEvent*>(aEvent)->inputSource !=
           nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
       return target;
   }
 
   nsRect targetRect = GetTargetRect(aRootFrame, aPointRelativeToRootFrame, prefs);
   nsAutoTArray<nsIFrame*,8> candidates;
   nsresult rv = nsLayoutUtils::GetFramesForArea(aRootFrame, targetRect, candidates, flags);
   if (NS_FAILED(rv)) {
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -5238,18 +5238,18 @@ PresShell::ProcessSynthMouseMoveEvent(bo
     nsIFrame* frame = view->GetFrame();
     NS_ASSERTION(frame, "floating views can't be anonymous");
     viewAPD = frame->PresContext()->AppUnitsPerDevPixel();
     refpoint = mMouseLocation.ConvertAppUnits(APD, viewAPD);
     refpoint -= view->GetOffsetTo(rootView);
     refpoint += view->ViewToWidgetOffset();
   }
   NS_ASSERTION(view->GetWidget(), "view should have a widget here");
-  nsMouseEvent event(true, NS_MOUSE_MOVE, view->GetWidget(),
-                     nsMouseEvent::eSynthesized);
+  WidgetMouseEvent event(true, NS_MOUSE_MOVE, view->GetWidget(),
+                         WidgetMouseEvent::eSynthesized);
   event.refPoint = LayoutDeviceIntPoint::FromAppUnitsToNearest(refpoint, viewAPD);
   event.time = PR_IntervalNow();
   // XXX set event.modifiers ?
   // XXX mnakano I think that we should get the latest information from widget.
 
   nsCOMPtr<nsIPresShell> shell = pointVM->GetPresShell();
   if (shell) {
     shell->DispatchSynthMouseMove(&event, !aFromScroll);
@@ -5882,17 +5882,18 @@ PresShell::RecordMouseLocation(WidgetGUI
     PresShell* rootPresShell = GetRootPresShell();
     if (rootPresShell) {
       rootPresShell->RecordMouseLocation(aEvent);
     }
     return;
   }
 
   if ((aEvent->message == NS_MOUSE_MOVE &&
-       static_cast<nsMouseEvent*>(aEvent)->reason == nsMouseEvent::eReal) ||
+       static_cast<WidgetMouseEvent*>(aEvent)->reason ==
+         WidgetMouseEvent::eReal) ||
       aEvent->message == NS_MOUSE_ENTER ||
       aEvent->message == NS_MOUSE_BUTTON_DOWN ||
       aEvent->message == NS_MOUSE_BUTTON_UP) {
     nsIFrame* rootFrame = GetRootFrame();
     if (!rootFrame) {
       nsView* rootView = mViewManager->GetRootView();
       mMouseLocation = nsLayoutUtils::TranslateWidgetToView(mPresContext,
         aEvent->widget, LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint),
@@ -6179,17 +6180,18 @@ PresShell::HandleEvent(nsIFrame* aFrame,
 
     // all touch events except for touchstart use a captured target
     if (aEvent->eventStructType == NS_TOUCH_EVENT &&
         aEvent->message != NS_TOUCH_START) {
       captureRetarget = true;
     }
 
     bool isWindowLevelMouseExit = (aEvent->message == NS_MOUSE_EXIT) &&
-      (static_cast<nsMouseEvent*>(aEvent)->exit == nsMouseEvent::eTopLevel);
+      (static_cast<WidgetMouseEvent*>(aEvent)->exit ==
+         WidgetMouseEvent::eTopLevel);
 
     // Get the frame at the event point. However, don't do this if we're
     // capturing and retargeting the event because the captured frame will
     // be used instead below. Also keep using the root frame if we're dealing
     // with a window-level mouse exit event since we want to start sending
     // mouse out events at the root EventStateManager.
     if (!captureRetarget && !isWindowLevelMouseExit) {
       nsPoint eventPoint;
@@ -6271,17 +6273,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
               touch->SetTarget(oldTouch->mTarget);
             }
           }
         }
       } else {
         eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, frame);
       }
       if (aEvent->eventStructType == NS_MOUSE_EVENT &&
-          static_cast<nsMouseEvent*>(aEvent)->ignoreRootScrollFrame) {
+          static_cast<WidgetMouseEvent*>(aEvent)->ignoreRootScrollFrame) {
         flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
       }
       nsIFrame* target =
         FindFrameTargetedByInputEvent(aEvent, frame, eventPoint, flags);
       if (target) {
         frame = target;
       }
     }
@@ -6307,17 +6309,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->eventStructType == NS_MOUSE_EVENT &&
         frame->PresContext()->Document()->EventHandlingSuppressed()) {
       if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
         mNoDelayedMouseEvents = true;
       } else if (!mNoDelayedMouseEvents && aEvent->message == NS_MOUSE_BUTTON_UP) {
         nsDelayedEvent* event =
-          new nsDelayedMouseEvent(static_cast<nsMouseEvent*>(aEvent));
+          new nsDelayedMouseEvent(static_cast<WidgetMouseEvent*>(aEvent));
         if (!mDelayedEvents.AppendElement(event)) {
           delete event;
         }
       }
 
       return NS_OK;
     }
 
@@ -6622,27 +6624,27 @@ PresShell::HandleEventWithTarget(WidgetE
   NS_ENSURE_STATE(!aContent || aContent->GetCurrentDoc() == mDocument);
 
   PushCurrentEventInfo(aFrame, aContent);
   nsresult rv = HandleEventInternal(aEvent, aStatus);
   PopCurrentEventInfo();
   return rv;
 }
 
-static bool CanHandleContextMenuEvent(nsMouseEvent* aMouseEvent,
-                                        nsIFrame* aFrame)
+static bool CanHandleContextMenuEvent(WidgetMouseEvent* aMouseEvent,
+                                      nsIFrame* aFrame)
 {
 #if defined(XP_MACOSX) && defined(MOZ_XUL)
   nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
   if (pm) {
     nsIFrame* popupFrame = pm->GetTopPopup(ePopupTypeMenu);
     if (popupFrame) {
       // context menus should not be opened while another menu is open on Mac,
       // so return false so that the event is not fired.
-      if (aMouseEvent->context == nsMouseEvent::eContextMenuKey) {
+      if (aMouseEvent->context == WidgetMouseEvent::eContextMenuKey) {
         return false;
       } else if (aMouseEvent->widget) {
          nsWindowType windowType;
          aMouseEvent->widget->GetWindowType(windowType);
          if (windowType == eWindowType_popup) {
            for (nsIFrame* current = aFrame; current;
                 current = nsLayoutUtils::GetCrossDocParentFrame(current)) {
              if (current->GetType() == nsGkAtoms::menuPopupFrame) {
@@ -6827,21 +6829,21 @@ PresShell::HandleEventInternal(WidgetEve
             aEvent->mFlags.mOnlyChromeDispatch = true;
           }
         }
         break;
       }
     }
 
     if (aEvent->message == NS_CONTEXTMENU) {
-      nsMouseEvent* me = static_cast<nsMouseEvent*>(aEvent);
+      WidgetMouseEvent* me = static_cast<WidgetMouseEvent*>(aEvent);
       if (!CanHandleContextMenuEvent(me, GetCurrentEventFrame())) {
         return NS_OK;
       }
-      if (me->context == nsMouseEvent::eContextMenuKey &&
+      if (me->context == WidgetMouseEvent::eContextMenuKey &&
           !AdjustContextMenuKeyEvent(me)) {
         return NS_OK;
       }
       if (me->IsShift()) {
         aEvent->mFlags.mOnlyChromeDispatch = true;
         aEvent->mFlags.mRetargetToNonNativeAnonymous = true;
       }
     }
@@ -7058,17 +7060,17 @@ PresShell::HandleDOMEventWithTarget(nsIC
                                              mPresContext, aStatus);
   }
 
   PopCurrentEventInfo();
   return rv;
 }
 
 bool
-PresShell::AdjustContextMenuKeyEvent(nsMouseEvent* aEvent)
+PresShell::AdjustContextMenuKeyEvent(WidgetMouseEvent* aEvent)
 {
 #ifdef MOZ_XUL
   // if a menu is open, open the context menu relative to the active item on the menu. 
   nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
   if (pm) {
     nsIFrame* popupFrame = pm->GetTopPopup(ePopupTypeMenu);
     if (popupFrame) {
       nsIFrame* itemFrame = 
--- a/layout/base/nsPresShell.h
+++ b/layout/base/nsPresShell.h
@@ -571,29 +571,31 @@ protected:
     : nsDelayedEvent(), mEvent(nullptr) {}
 
     mozilla::WidgetInputEvent* mEvent;
   };
 
   class nsDelayedMouseEvent : public nsDelayedInputEvent
   {
   public:
-    nsDelayedMouseEvent(nsMouseEvent* aEvent) : nsDelayedInputEvent()
+    nsDelayedMouseEvent(mozilla::WidgetMouseEvent* aEvent) :
+      nsDelayedInputEvent()
     {
-      mEvent = new nsMouseEvent(aEvent->mFlags.mIsTrusted,
-                                aEvent->message,
-                                aEvent->widget,
-                                aEvent->reason,
-                                aEvent->context);
-      static_cast<nsMouseEvent*>(mEvent)->AssignMouseEventData(*aEvent, false);
+      mEvent = new mozilla::WidgetMouseEvent(aEvent->mFlags.mIsTrusted,
+                                             aEvent->message,
+                                             aEvent->widget,
+                                             aEvent->reason,
+                                             aEvent->context);
+      static_cast<mozilla::WidgetMouseEvent*>(mEvent)->
+        AssignMouseEventData(*aEvent, false);
     }
 
     virtual ~nsDelayedMouseEvent()
     {
-      delete static_cast<nsMouseEvent*>(mEvent);
+      delete static_cast<mozilla::WidgetMouseEvent*>(mEvent);
     }
   };
 
   class nsDelayedKeyEvent : public nsDelayedInputEvent
   {
   public:
     nsDelayedKeyEvent(mozilla::WidgetKeyboardEvent* aEvent) :
       nsDelayedInputEvent()
@@ -676,17 +678,17 @@ protected:
    * Otherwise, if a selectable list such as a listbox is focused, the
    * current item within the menu is opened relative to this item.
    * Otherwise, the context menu is opened at the topleft corner of the
    * view.
    *
    * Returns true if the context menu event should fire and false if it should
    * not.
    */
-  bool AdjustContextMenuKeyEvent(nsMouseEvent* aEvent);
+  bool AdjustContextMenuKeyEvent(mozilla::WidgetMouseEvent* aEvent);
 
   // 
   bool PrepareToUseCaretPosition(nsIWidget* aEventWidget, nsIntPoint& aTargetPt);
 
   // Get the selected item and coordinates in device pixels relative to root
   // document's root view for element, first ensuring the element is onscreen
   void GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
                                            nsIContent **aTargetToUse,
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -295,19 +295,19 @@ nsComboboxControlFrame::ShowPopup(bool a
   } else {
     viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
     nsRect emptyRect(0, 0, 0, 0);
     viewManager->ResizeView(view, emptyRect);
   }
 
   // fire a popup dom event
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(true, aShowPopup ?
-                     NS_XUL_POPUP_SHOWING : NS_XUL_POPUP_HIDING, nullptr,
-                     nsMouseEvent::eReal);
+  WidgetMouseEvent event(true, aShowPopup ?
+                         NS_XUL_POPUP_SHOWING : NS_XUL_POPUP_HIDING, nullptr,
+                         WidgetMouseEvent::eReal);
 
   nsCOMPtr<nsIPresShell> shell = PresContext()->GetPresShell();
   if (shell)
     shell->HandleDOMEventWithTarget(mContent, &event, &status);
 }
 
 bool
 nsComboboxControlFrame::ShowList(bool aShowList)
--- a/layout/forms/nsImageControlFrame.cpp
+++ b/layout/forms/nsImageControlFrame.cpp
@@ -166,17 +166,18 @@ nsImageControlFrame::HandleEvent(nsPresC
   if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) { // XXX cache disabled
     return NS_OK;
   }
 
   *aEventStatus = nsEventStatus_eIgnore;
 
   if (aEvent->eventStructType == NS_MOUSE_EVENT &&
       aEvent->message == NS_MOUSE_BUTTON_UP &&
-      static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) {
+      static_cast<WidgetMouseEvent*>(aEvent)->button ==
+        WidgetMouseEvent::eLeftButton) {
     // Store click point for HTMLInputElement::SubmitNamesValues
     // Do this on MouseUp because the specs don't say and that's what IE does
     nsIntPoint* lastClickPoint =
       static_cast<nsIntPoint*>
                  (mContent->GetProperty(nsGkAtoms::imageClickedPoint));
     if (lastClickPoint) {
       // normally lastClickedPoint is not null, as it's allocated in Init()
       nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this);
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -1602,18 +1602,18 @@ nsListControlFrame::MouseUp(nsIDOMEvent*
     // down on the select and the drag over an option and let go
     // And then NOT get an "onclick" event when when you click down on the select
     // and then up outside of the select
     // the EventStateManager tracks the content of the mouse down and the mouse up
     // to make sure they are the same, and the onclick is sent in the PostHandleEvent
     // depeneding on whether the clickCount is non-zero.
     // So we cheat here by either setting or unsetting the clcikCount in the native event
     // so the right thing happens for the onclick event
-    nsMouseEvent * mouseEvent;
-    mouseEvent = (nsMouseEvent *) aMouseEvent->GetInternalNSEvent();
+    WidgetMouseEvent* mouseEvent =
+      static_cast<WidgetMouseEvent*>(aMouseEvent->GetInternalNSEvent());
 
     int32_t selectedIndex;
     if (NS_SUCCEEDED(GetIndexFromDOMEvent(aMouseEvent, selectedIndex))) {
       // If it's disabled, disallow the click and leave.
       bool isDisabled = false;
       IsOptionDisabled(selectedIndex, isDisabled);
       if (isDisabled) {
         aMouseEvent->PreventDefault();
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2344,31 +2344,35 @@ nsFrame::HandleEvent(nsPresContext* aPre
                      nsEventStatus* aEventStatus)
 {
 
   if (aEvent->message == NS_MOUSE_MOVE) {
     return HandleDrag(aPresContext, aEvent, aEventStatus);
   }
 
   if ((aEvent->eventStructType == NS_MOUSE_EVENT &&
-      static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) ||
+      static_cast<WidgetMouseEvent*>(aEvent)->button ==
+        WidgetMouseEvent::eLeftButton) ||
       aEvent->eventStructType == NS_TOUCH_EVENT) {
     if (aEvent->message == NS_MOUSE_BUTTON_DOWN || aEvent->message == NS_TOUCH_START) {
       HandlePress(aPresContext, aEvent, aEventStatus);
     } else if (aEvent->message == NS_MOUSE_BUTTON_UP || aEvent->message == NS_TOUCH_END) {
       HandleRelease(aPresContext, aEvent, aEventStatus);
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsFrame::GetDataForTableSelection(const nsFrameSelection *aFrameSelection,
-                                  nsIPresShell *aPresShell, nsMouseEvent *aMouseEvent, 
-                                  nsIContent **aParentContent, int32_t *aContentOffset, int32_t *aTarget)
+nsFrame::GetDataForTableSelection(const nsFrameSelection* aFrameSelection,
+                                  nsIPresShell* aPresShell,
+                                  WidgetMouseEvent* aMouseEvent, 
+                                  nsIContent** aParentContent,
+                                  int32_t* aContentOffset,
+                                  int32_t* aTarget)
 {
   if (!aFrameSelection || !aPresShell || !aMouseEvent || !aParentContent || !aContentOffset || !aTarget)
     return NS_ERROR_NULL_POINTER;
 
   *aParentContent = nullptr;
   *aContentOffset = 0;
   *aTarget = 0;
 
@@ -2380,17 +2384,17 @@ nsFrame::GetDataForTableSelection(const 
   // If already in cell selection mode, 
   //  continue selecting with mouse drag or end on mouse up,
   //  or when using shift key to extend block of cells
   //  (Mouse down does normal selection unless Ctrl/Cmd is pressed)
   bool doTableSelection =
      displaySelection == nsISelectionDisplay::DISPLAY_ALL && selectingTableCells &&
      (aMouseEvent->message == NS_MOUSE_MOVE ||
       (aMouseEvent->message == NS_MOUSE_BUTTON_UP &&
-       aMouseEvent->button == nsMouseEvent::eLeftButton) ||
+       aMouseEvent->button == WidgetMouseEvent::eLeftButton) ||
       aMouseEvent->IsShift());
 
   if (!doTableSelection)
   {  
     // In Browser, special 'table selection' key must be pressed for table selection
     // or when just Shift is pressed and we're already in table/cell selection mode
 #ifdef XP_MACOSX
     doTableSelection = aMouseEvent->IsMeta() || (aMouseEvent->IsShift() && selectingTableCells);
@@ -2633,17 +2637,17 @@ nsFrame::HandlePress(nsPresContext* aPre
   if (useFrameSelection)
     frameselection = GetConstFrameSelection();
   else
     frameselection = shell->ConstFrameSelection();
 
   if (!frameselection || frameselection->GetDisplaySelection() == nsISelectionController::SELECTION_OFF)
     return NS_OK;//nothing to do we cannot affect selection from here
 
-  nsMouseEvent *me = (nsMouseEvent *)aEvent;
+  WidgetMouseEvent* me = static_cast<WidgetMouseEvent*>(aEvent);
 
 #ifdef XP_MACOSX
   if (me->IsControl())
     return NS_OK;//short circuit. hard coded for mac due to time restraints.
   bool control = me->IsMeta();
 #else
   bool control = me->IsControl();
 #endif
@@ -2830,17 +2834,17 @@ nsFrame::HandleMultiplePress(nsPresConte
     return NS_OK;
   }
 
   // Find out whether we're doing line or paragraph selection.
   // If browser.triple_click_selects_paragraph is true, triple-click selects paragraph.
   // Otherwise, triple-click selects line, and quadruple-click selects paragraph
   // (on platforms that support quadruple-click).
   nsSelectionAmount beginAmount, endAmount;
-  nsMouseEvent *me = (nsMouseEvent *)aEvent;
+  WidgetMouseEvent* me = static_cast<WidgetMouseEvent*>(aEvent);
   if (!me) return NS_OK;
 
   if (me->clickCount == 4) {
     beginAmount = endAmount = eSelectParagraph;
   } else if (me->clickCount == 3) {
     if (Preferences::GetBool("browser.triple_click_selects_paragraph")) {
       beginAmount = endAmount = eSelectParagraph;
     } else {
@@ -2960,17 +2964,17 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPres
     return NS_OK;
 
   frameselection->StopAutoScrollTimer();
 
   // Check if we are dragging in a table cell
   nsCOMPtr<nsIContent> parentContent;
   int32_t contentOffset;
   int32_t target;
-  nsMouseEvent *me = (nsMouseEvent *)aEvent;
+  WidgetMouseEvent* me = static_cast<WidgetMouseEvent*>(aEvent);
   nsresult result;
   result = GetDataForTableSelection(frameselection, presShell, me,
                                     getter_AddRefs(parentContent),
                                     &contentOffset, &target);      
 
   nsWeakFrame weakThis = this;
   if (NS_SUCCEEDED(result) && parentContent) {
     frameselection->HandleTableSelection(parentContent, contentOffset, target, me);
@@ -3046,20 +3050,21 @@ HandleFrameSelection(nsFrameSelection*  
                                         aFrameSelection->IsShiftDownInDelayedCaretData(),
                                         false,
                                         aOffsets.associateWithNext);
       if (NS_FAILED(rv)) {
         return rv;
       }
     } else if (aParentContentForTableSel) {
       aFrameSelection->SetMouseDownState(false);
-      rv = aFrameSelection->HandleTableSelection(aParentContentForTableSel,
-                                                 aContentOffsetForTableSel,
-                                                 aTargetForTableSel,
-                                                 (nsMouseEvent *)aEvent);
+      rv = aFrameSelection->HandleTableSelection(
+                              aParentContentForTableSel,
+                              aContentOffsetForTableSel,
+                              aTargetForTableSel,
+                              static_cast<WidgetMouseEvent*>(aEvent));
       if (NS_FAILED(rv)) {
         return rv;
       }
     }
     aFrameSelection->SetDelayedCaretData(0);
   }
 
   aFrameSelection->SetMouseDownState(false);
@@ -3105,17 +3110,17 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsP
 
       if (!mouseDown && frameselection->HasDelayedCaretData() &&
           frameselection->GetClickCountInDelayedCaretData() < 2) {
         nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this);
         offsets = GetContentOffsetsFromPoint(pt, SKIP_HIDDEN);
         handleTableSelection = false;
       } else {
         GetDataForTableSelection(frameselection, PresContext()->PresShell(),
-                                 (nsMouseEvent *)aEvent,
+                                 static_cast<WidgetMouseEvent*>(aEvent),
                                  getter_AddRefs(parentContent),
                                  &contentOffsetForTableSel,
                                  &targetForTableSel);
       }
     }
   }
 
   // We might be capturing in some other document and the event just happened to
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -613,20 +613,22 @@ protected:
   // Test if we are selecting a table object:
   //  Most table/cell selection requires that Ctrl (Cmd on Mac) key is down 
   //   during a mouse click or drag. Exception is using Shift+click when
   //   already in "table/cell selection mode" to extend a block selection
   //  Get the parent content node and offset of the frame 
   //   of the enclosing cell or table (if not inside a cell)
   //  aTarget tells us what table element to select (currently only cell and table supported)
   //  (enums for this are defined in nsIFrame.h)
-  NS_IMETHOD GetDataForTableSelection(const nsFrameSelection *aFrameSelection,
-                                      nsIPresShell *aPresShell, nsMouseEvent *aMouseEvent, 
-                                      nsIContent **aParentContent, int32_t *aContentOffset, 
-                                      int32_t *aTarget);
+  NS_IMETHOD GetDataForTableSelection(const nsFrameSelection* aFrameSelection,
+                                      nsIPresShell* aPresShell,
+                                      mozilla::WidgetMouseEvent* aMouseEvent,
+                                      nsIContent** aParentContent,
+                                      int32_t* aContentOffset,
+                                      int32_t* aTarget);
 
   // Fills aCursor with the appropriate information from ui
   static void FillCursorInformationFromStyle(const nsStyleUserInterface* ui,
                                              nsIFrame::Cursor& aCursor);
   NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
 
 #ifdef DEBUG_LAYOUT
   virtual void GetBoxName(nsAutoString& aName) MOZ_OVERRIDE;
--- a/layout/generic/nsFrameSelection.h
+++ b/layout/generic/nsFrameSelection.h
@@ -238,20 +238,20 @@ public:
    *    TABLESELECTION_CELL      We should select a cell (content points to the cell)
    *    TABLESELECTION_ROW       We should select a row (content points to any cell in row)
    *    TABLESELECTION_COLUMN    We should select a row (content points to any cell in column)
    *    TABLESELECTION_TABLE     We should select a table (content points to the table)
    *    TABLESELECTION_ALLCELLS  We should select all cells (content points to any cell in table)
    *  @param aMouseEvent         passed in so we can get where event occurred and what keys are pressed
    */
   /*unsafe*/
-  nsresult HandleTableSelection(nsINode *aParentContent,
+  nsresult HandleTableSelection(nsINode* aParentContent,
                                 int32_t aContentOffset,
                                 int32_t aTarget,
-                                nsMouseEvent *aMouseEvent);
+                                mozilla::WidgetMouseEvent* aMouseEvent);
 
   /**
    * Add cell to the selection.
    *
    * @param  aCell  [in] HTML td element.
    */
   virtual nsresult SelectCellElement(nsIContent *aCell);
 
@@ -491,17 +491,17 @@ public:
   int16_t GetDisplaySelection() const { return mDisplaySelection; }
 
   /** This method can be used to store the data received during a MouseDown
    *  event so that we can place the caret during the MouseUp event.
    * @aMouseEvent the event received by the selection MouseDown
    *  handling method. A NULL value can be use to tell this method
    *  that any data is storing is no longer valid.
    */
-  void SetDelayedCaretData(nsMouseEvent *aMouseEvent);
+  void SetDelayedCaretData(mozilla::WidgetMouseEvent* aMouseEvent);
 
   /** Get the delayed MouseDown event data necessary to place the
    *  caret during MouseUp processing.
    * @return a pointer to the event received
    *  by the selection during MouseDown processing. It can be NULL
    *  if the data is no longer valid.
    */
   bool HasDelayedCaretData() { return mDelayedMouseEventValid; }
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -688,18 +688,18 @@ NS_METHOD nsHTMLFramesetFrame::HandleEve
   if (mDragger) {
     // the nsFramesetBorderFrame has captured NS_MOUSE_DOWN
     switch (aEvent->message) {
       case NS_MOUSE_MOVE:
         MouseDrag(aPresContext, aEvent);
 	      break;
       case NS_MOUSE_BUTTON_UP:
         if (aEvent->eventStructType == NS_MOUSE_EVENT &&
-            static_cast<nsMouseEvent*>(aEvent)->button ==
-              nsMouseEvent::eLeftButton) {
+            static_cast<WidgetMouseEvent*>(aEvent)->button ==
+              WidgetMouseEvent::eLeftButton) {
           EndMouseDrag(aPresContext);
         }
 	      break;
     }
     *aEventStatus = nsEventStatus_eConsumeNoDefault;
   } else {
     *aEventStatus = nsEventStatus_eIgnore;
   }
@@ -1587,17 +1587,18 @@ nsHTMLFramesetBorderFrame::HandleEvent(n
 
   //XXX Mouse setting logic removed.  The remaining logic should also move.
   if (!mCanResize) {
     return NS_OK;
   }
 
   if (aEvent->eventStructType == NS_MOUSE_EVENT &&
       aEvent->message == NS_MOUSE_BUTTON_DOWN &&
-      static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) {
+      static_cast<WidgetMouseEvent*>(aEvent)->button ==
+        WidgetMouseEvent::eLeftButton) {
     nsHTMLFramesetFrame* parentFrame = do_QueryFrame(GetParent());
     if (parentFrame) {
       parentFrame->StartMouseDrag(aPresContext, this, aEvent);
       *aEventStatus = nsEventStatus_eConsumeNoDefault;
     }
   }
   return NS_OK;
 }
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1642,17 +1642,18 @@ NS_IMETHODIMP
 nsImageFrame::HandleEvent(nsPresContext* aPresContext,
                           WidgetGUIEvent* aEvent,
                           nsEventStatus* aEventStatus)
 {
   NS_ENSURE_ARG_POINTER(aEventStatus);
 
   if ((aEvent->eventStructType == NS_MOUSE_EVENT &&
        aEvent->message == NS_MOUSE_BUTTON_UP && 
-       static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) ||
+       static_cast<WidgetMouseEvent*>(aEvent)->button ==
+         WidgetMouseEvent::eLeftButton) ||
       aEvent->message == NS_MOUSE_MOVE) {
     nsImageMap* map = GetImageMap();
     bool isServerMap = IsServerImageMap();
     if ((nullptr != map) || isServerMap) {
       nsIntPoint p;
       TranslateEventCoords(
         nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this), p);
       bool inside = false;
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -1498,17 +1498,17 @@ nsFrameSelection::TakeFocus(nsIContent *
     {
       int32_t offset;
       nsINode *cellparent = GetCellParent(aNewFocus);
       if (mCellParent && cellparent && cellparent != mCellParent) //switch to cell selection mode
       {
 #ifdef DEBUG_TABLE_SELECTION
 printf(" * TakeFocus - moving into new cell\n");
 #endif
-        nsMouseEvent event(false, 0, nullptr, nsMouseEvent::eReal);
+        WidgetMouseEvent event(false, 0, nullptr, WidgetMouseEvent::eReal);
 
         // Start selecting in the cell we were in before
         nsINode* parent = ParentOffset(mCellParent, &offset);
         if (parent)
           HandleTableSelection(parent, offset,
                                nsISelectionPrivate::TABLESELECTION_CELL, &event);
 
         // Find the parent of this new cell and extend selection to it
@@ -1967,20 +1967,20 @@ GetFirstSelectedContent(nsRange* aRange)
                   "Unexpected parent");
 
   return aRange->GetStartParent()->GetChildAt(aRange->StartOffset());
 }
 
 // Table selection support.
 // TODO: Separate table methods into a separate nsITableSelection interface
 nsresult
-nsFrameSelection::HandleTableSelection(nsINode *aParentContent,
+nsFrameSelection::HandleTableSelection(nsINode* aParentContent,
                                        int32_t aContentOffset,
                                        int32_t aTarget,
-                                       nsMouseEvent *aMouseEvent)
+                                       WidgetMouseEvent* aMouseEvent)
 {
   NS_ENSURE_TRUE(aParentContent, NS_ERROR_NULL_POINTER);
   NS_ENSURE_TRUE(aMouseEvent, NS_ERROR_NULL_POINTER);
 
   if (mMouseDownState && mDragSelectingCells && (aTarget & nsISelectionPrivate::TABLESELECTION_TABLE))
   {
     // We were selecting cells and user drags mouse in table border or inbetween cells,
     //  just do nothing
@@ -2935,17 +2935,17 @@ nsFrameSelection::DeleteFromDocument()
   else
     printf("Don't know how to set selection back past frame boundary\n");
 #endif
 
   return NS_OK;
 }
 
 void
-nsFrameSelection::SetDelayedCaretData(nsMouseEvent *aMouseEvent)
+nsFrameSelection::SetDelayedCaretData(WidgetMouseEvent* aMouseEvent)
 {
   if (aMouseEvent) {
     mDelayedMouseEventValid = true;
     mDelayedMouseEventIsShift = aMouseEvent->IsShift();
     mDelayedMouseEventClickCount = aMouseEvent->clickCount;
   } else {
     mDelayedMouseEventValid = false;
   }
--- a/layout/xul/base/src/nsMenuFrame.cpp
+++ b/layout/xul/base/src/nsMenuFrame.cpp
@@ -422,17 +422,18 @@ nsMenuFrame::HandleEvent(nsPresContext* 
         ((keyCode == NS_VK_UP || keyCode == NS_VK_DOWN) && keyEvent->IsAlt())) {
       *aEventStatus = nsEventStatus_eConsumeNoDefault;
       ToggleMenuState();
     }
 #endif
   }
   else if (aEvent->eventStructType == NS_MOUSE_EVENT &&
            aEvent->message == NS_MOUSE_BUTTON_DOWN &&
-           static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton &&
+           static_cast<WidgetMouseEvent*>(aEvent)->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 (!mMenuParent || mMenuParent->IsMenuBar()) {
       ToggleMenuState();
     }
@@ -441,18 +442,18 @@ nsMenuFrame::HandleEvent(nsPresContext* 
         OpenMenu(false);
       }
     }
   }
   else if (
 #ifndef NSCONTEXTMENUISMOUSEUP
            (aEvent->eventStructType == NS_MOUSE_EVENT &&
             aEvent->message == NS_MOUSE_BUTTON_UP &&
-            static_cast<nsMouseEvent*>(aEvent)->button ==
-              nsMouseEvent::eRightButton) &&
+            static_cast<WidgetMouseEvent*>(aEvent)->button ==
+              WidgetMouseEvent::eRightButton) &&
 #else
             aEvent->message == NS_CONTEXTMENU &&
 #endif
             onmenu && !IsMenu() && !IsDisabled()) {
     // if this menu is a context menu it accepts right-clicks...fire away!
     // Make sure we cancel default processing of the context menu event so
     // that it doesn't bubble and get seen again by the popuplistener and show
     // another context menu.
@@ -464,17 +465,18 @@ nsMenuFrame::HandleEvent(nsPresContext* 
     // dismiss the menu.
     if (mMenuParent->IsContextMenu()) {
       *aEventStatus = nsEventStatus_eConsumeNoDefault;
       Execute(aEvent);
     }
   }
   else if (aEvent->eventStructType == NS_MOUSE_EVENT &&
            aEvent->message == NS_MOUSE_BUTTON_UP &&
-           static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton &&
+           static_cast<WidgetMouseEvent*>(aEvent)->button ==
+             WidgetMouseEvent::eLeftButton &&
            !IsMenu() && !IsDisabled()) {
     // Execute the execute event handler.
     *aEventStatus = nsEventStatus_eConsumeNoDefault;
     Execute(aEvent);
   }
   else if (aEvent->message == NS_MOUSE_EXIT_SYNTH) {
     // Kill our timer if one is active.
     if (mOpenTimer) {
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -333,17 +333,18 @@ class nsXULPopupShownEvent : public nsRu
 public:
   nsXULPopupShownEvent(nsIContent *aPopup, nsPresContext* aPresContext)
     : mPopup(aPopup), mPresContext(aPresContext)
   {
   }
 
   NS_IMETHOD Run()
   {
-    nsMouseEvent event(true, NS_XUL_POPUP_SHOWN, nullptr, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_XUL_POPUP_SHOWN, nullptr,
+                           WidgetMouseEvent::eReal);
     return nsEventDispatcher::Dispatch(mPopup, mPresContext, &event);                 
   }
 
 private:
   nsCOMPtr<nsIContent> mPopup;
   nsRefPtr<nsPresContext> mPresContext;
 };
 
--- a/layout/xul/base/src/nsResizerFrame.cpp
+++ b/layout/xul/base/src/nsResizerFrame.cpp
@@ -62,17 +62,18 @@ nsResizerFrame::HandleEvent(nsPresContex
   nsWeakFrame weakFrame(this);
   bool doDefault = true;
 
   switch (aEvent->message) {
     case NS_TOUCH_START:
     case NS_MOUSE_BUTTON_DOWN: {
       if (aEvent->eventStructType == NS_TOUCH_EVENT ||
           (aEvent->eventStructType == NS_MOUSE_EVENT &&
-        static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton))
+        static_cast<WidgetMouseEvent*>(aEvent)->button ==
+          WidgetMouseEvent::eLeftButton))
       {
         nsCOMPtr<nsIBaseWindow> window;
         nsIPresShell* presShell = aPresContext->GetPresShell();
         nsIContent* contentToResize =
           GetContentToResize(presShell, getter_AddRefs(window));
         if (contentToResize) {
           nsIFrame* frameToResize = contentToResize->GetPrimaryFrame();
           if (!frameToResize)
@@ -129,17 +130,18 @@ nsResizerFrame::HandleEvent(nsPresContex
     }
     break;
 
   case NS_TOUCH_END:
   case NS_MOUSE_BUTTON_UP: {
 
       if (aEvent->eventStructType == NS_TOUCH_EVENT ||
           (aEvent->eventStructType == NS_MOUSE_EVENT &&
-        static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton))
+           static_cast<WidgetMouseEvent*>(aEvent)->button ==
+             WidgetMouseEvent::eLeftButton))
     {
       // we're done tracking.
       mTrackingMouseMove = false;
 
       nsIPresShell::SetCapturingContent(nullptr, 0);
 
       doDefault = false;
     }
@@ -290,17 +292,18 @@ nsResizerFrame::HandleEvent(nsPresContex
     if (aEvent->IsLeftClickEvent())
     {
       MouseClicked(aPresContext, aEvent);
     }
     break;
 
   case NS_MOUSE_DOUBLECLICK:
     if (aEvent->eventStructType == NS_MOUSE_EVENT &&
-        static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton)
+        static_cast<WidgetMouseEvent*>(aEvent)->button ==
+          WidgetMouseEvent::eLeftButton)
     {
       nsCOMPtr<nsIBaseWindow> window;
       nsIPresShell* presShell = aPresContext->GetPresShell();
       nsIContent* contentToResize =
         GetContentToResize(presShell, getter_AddRefs(window));
       if (contentToResize) {
         nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(contentToResize->GetPrimaryFrame());
         if (menuPopupFrame)
--- a/layout/xul/base/src/nsScrollbarButtonFrame.cpp
+++ b/layout/xul/base/src/nsScrollbarButtonFrame.cpp
@@ -81,22 +81,22 @@ nsScrollbarButtonFrame::HandleEvent(nsPr
 
 bool
 nsScrollbarButtonFrame::HandleButtonPress(nsPresContext* aPresContext,
                                           WidgetGUIEvent* aEvent,
                                           nsEventStatus* aEventStatus)
 {
   // Get the desired action for the scrollbar button.
   LookAndFeel::IntID tmpAction;
-  uint16_t button = static_cast<nsMouseEvent*>(aEvent)->button;
-  if (button == nsMouseEvent::eLeftButton) {
+  uint16_t button = static_cast<WidgetMouseEvent*>(aEvent)->button;
+  if (button == WidgetMouseEvent::eLeftButton) {
     tmpAction = LookAndFeel::eIntID_ScrollButtonLeftMouseButtonAction;
-  } else if (button == nsMouseEvent::eMiddleButton) {
+  } else if (button == WidgetMouseEvent::eMiddleButton) {
     tmpAction = LookAndFeel::eIntID_ScrollButtonMiddleMouseButtonAction;
-  } else if (button == nsMouseEvent::eRightButton) {
+  } else if (button == WidgetMouseEvent::eRightButton) {
     tmpAction = LookAndFeel::eIntID_ScrollButtonRightMouseButtonAction;
   } else {
     return false;
   }
 
   // Get the button action metric from the pres. shell.
   int32_t pressedButtonAction;
   if (NS_FAILED(LookAndFeel::GetInt(tmpAction, &pressedButtonAction))) {
--- a/layout/xul/base/src/nsSliderFrame.cpp
+++ b/layout/xul/base/src/nsSliderFrame.cpp
@@ -942,19 +942,19 @@ bool
 nsSliderFrame::ShouldScrollForEvent(WidgetGUIEvent* aEvent)
 {
   switch (aEvent->message) {
     case NS_TOUCH_START:
     case NS_TOUCH_END:
       return true;
     case NS_MOUSE_BUTTON_DOWN:
     case NS_MOUSE_BUTTON_UP: {
-      uint16_t button = static_cast<nsMouseEvent*>(aEvent)->button;
-      return (button == nsMouseEvent::eLeftButton) ||
-             (button == nsMouseEvent::eMiddleButton && gMiddlePref);
+      uint16_t button = static_cast<WidgetMouseEvent*>(aEvent)->button;
+      return (button == WidgetMouseEvent::eLeftButton) ||
+             (button == WidgetMouseEvent::eMiddleButton && gMiddlePref);
     }
     default:
       return false;
   }
 }
 
 bool
 nsSliderFrame::ShouldScrollToClickForEvent(WidgetGUIEvent* aEvent)
@@ -973,18 +973,18 @@ nsSliderFrame::ShouldScrollToClickForEve
 
 #ifdef XP_MACOSX
   // On Mac, clicking the scrollbar thumb should never scroll to click.
   if (IsEventOverThumb(aEvent)) {
     return false;
   }
 #endif
 
-  nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aEvent);
-  if (mouseEvent->button == nsMouseEvent::eLeftButton) {
+  WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(aEvent);
+  if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
 #ifdef XP_MACOSX
     bool invertPref = mouseEvent->IsAlt();
 #else
     bool invertPref = mouseEvent->IsShift();
 #endif
     return GetScrollToClick() != invertPref;
   }
 
--- a/layout/xul/base/src/nsSplitterFrame.cpp
+++ b/layout/xul/base/src/nsSplitterFrame.cpp
@@ -388,18 +388,18 @@ nsSplitterFrame::HandleEvent(nsPresConte
   nsRefPtr<nsSplitterFrameInner> kungFuDeathGrip(mInner);
   switch (aEvent->message) {
     case NS_MOUSE_MOVE: 
       mInner->MouseDrag(aPresContext, aEvent);
     break;
   
     case NS_MOUSE_BUTTON_UP:
       if (aEvent->eventStructType == NS_MOUSE_EVENT &&
-          static_cast<nsMouseEvent*>(aEvent)->button ==
-            nsMouseEvent::eLeftButton) {
+          static_cast<WidgetMouseEvent*>(aEvent)->button ==
+            WidgetMouseEvent::eLeftButton) {
         mInner->MouseUp(aPresContext, aEvent);
       }
     break;
   }
 
   NS_ENSURE_STATE(weakFrame.IsAlive());
   return nsBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
 }
--- a/layout/xul/base/src/nsTitleBarFrame.cpp
+++ b/layout/xul/base/src/nsTitleBarFrame.cpp
@@ -66,19 +66,18 @@ nsTitleBarFrame::HandleEvent(nsPresConte
   }
 
   bool doDefault = true;
 
   switch (aEvent->message) {
 
    case NS_MOUSE_BUTTON_DOWN:  {
        if (aEvent->eventStructType == NS_MOUSE_EVENT &&
-           static_cast<nsMouseEvent*>(aEvent)->button ==
-             nsMouseEvent::eLeftButton)
-       {
+           static_cast<WidgetMouseEvent*>(aEvent)->button ==
+             WidgetMouseEvent::eLeftButton) {
          // titlebar has no effect in non-chrome shells
          nsCOMPtr<nsISupports> cont = aPresContext->GetContainer();
          nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(cont);
          if (dsti) {
            int32_t type = -1;
            if (NS_SUCCEEDED(dsti->GetItemType(&type)) &&
                type == nsIDocShellTreeItem::typeChrome) {
              // we're tracking.
@@ -96,19 +95,18 @@ nsTitleBarFrame::HandleEvent(nsPresConte
          doDefault = false;
        }
      }
      break;
 
 
    case NS_MOUSE_BUTTON_UP: {
        if(mTrackingMouseMove && aEvent->eventStructType == NS_MOUSE_EVENT &&
-          static_cast<nsMouseEvent*>(aEvent)->button ==
-            nsMouseEvent::eLeftButton)
-       {
+          static_cast<WidgetMouseEvent*>(aEvent)->button ==
+            WidgetMouseEvent::eLeftButton) {
          // we're done tracking.
          mTrackingMouseMove = false;
 
          // end capture
          nsIPresShell::SetCapturingContent(nullptr, 0);
 
          *aEventStatus = nsEventStatus_eConsumeNoDefault;
          doDefault = false;
--- a/layout/xul/base/src/nsXULPopupManager.cpp
+++ b/layout/xul/base/src/nsXULPopupManager.cpp
@@ -936,19 +936,21 @@ nsXULPopupManager::HidePopupCallback(nsI
   }
 
   delete item;
 
   nsWeakFrame weakFrame(aPopupFrame);
   aPopupFrame->HidePopup(aDeselectMenu, ePopupClosed);
   ENSURE_TRUE(weakFrame.IsAlive());
 
-  // send the popuphidden event synchronously. This event has no default behaviour.
+  // send the popuphidden event synchronously. This event has no default
+  // behaviour.
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(true, NS_XUL_POPUP_HIDDEN, nullptr, nsMouseEvent::eReal);
+  WidgetMouseEvent event(true, NS_XUL_POPUP_HIDDEN, nullptr,
+                         WidgetMouseEvent::eReal);
   nsEventDispatcher::Dispatch(aPopup, aPopupFrame->PresContext(),
                               &event, nullptr, &status);
   ENSURE_TRUE(weakFrame.IsAlive());
 
   // if there are more popups to close, look for the next one
   if (aNextPopup && aPopup != aLastPopup) {
     nsMenuChainItem* foundMenu = nullptr;
     nsMenuChainItem* item = mPopups;
@@ -1174,17 +1176,18 @@ nsXULPopupManager::FirePopupShowingEvent
                               NS_FRAME_HAS_DIRTY_CHILDREN);
 
   // cache the popup so that document.popupNode can retrieve the trigger node
   // during the popupshowing event. It will be cleared below after the event
   // has fired.
   mOpeningPopup = aPopup;
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(true, NS_XUL_POPUP_SHOWING, nullptr, nsMouseEvent::eReal);
+  WidgetMouseEvent event(true, NS_XUL_POPUP_SHOWING, nullptr,
+                         WidgetMouseEvent::eReal);
 
   // coordinates are relative to the root widget
   nsPresContext* rootPresContext =
     presShell->GetPresContext()->GetRootPresContext();
   if (rootPresContext) {
     rootPresContext->PresShell()->GetViewManager()->
       GetRootWidget(getter_AddRefs(event.widget));
   }
@@ -1252,17 +1255,18 @@ nsXULPopupManager::FirePopupHidingEvent(
                                         nsIContent* aLastPopup,
                                         nsPresContext *aPresContext,
                                         nsPopupType aPopupType,
                                         bool aDeselectMenu)
 {
   nsCOMPtr<nsIPresShell> presShell = aPresContext->PresShell();
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(true, NS_XUL_POPUP_HIDING, nullptr, nsMouseEvent::eReal);
+  WidgetMouseEvent event(true, NS_XUL_POPUP_HIDING, nullptr,
+                         WidgetMouseEvent::eReal);
   nsEventDispatcher::Dispatch(aPopup, aPresContext, &event, nullptr, &status);
 
   // when a panel is closed, blur whatever has focus inside the popup
   if (aPopupType == ePopupTypePanel &&
       !aPopup->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus,
                            nsGkAtoms::_true, eCaseMatters)) {
     nsIFocusManager* fm = nsFocusManager::GetFocusManager();
     if (fm) {
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -690,17 +690,18 @@ void
 nsViewManager::DispatchEvent(WidgetGUIEvent *aEvent,
                              nsView* aView,
                              nsEventStatus* aStatus)
 {
   PROFILER_LABEL("event", "nsViewManager::DispatchEvent");
 
   if ((aEvent->HasMouseEventMessage() &&
        // Ignore mouse events that we synthesize.
-       static_cast<nsMouseEvent*>(aEvent)->reason == nsMouseEvent::eReal &&
+       static_cast<WidgetMouseEvent*>(aEvent)->reason ==
+         WidgetMouseEvent::eReal &&
        // Ignore mouse exit and enter (we'll get moves if the user
        // is really moving the mouse) since we get them when we
        // create and destroy widgets.
        aEvent->message != NS_MOUSE_EXIT &&
        aEvent->message != NS_MOUSE_ENTER) ||
       aEvent->HasKeyEventMessage() ||
       aEvent->HasIMEEventMessage() ||
       aEvent->message == NS_PLUGIN_INPUT_EVENT) {
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -98,15 +98,13 @@ class WidgetCommandEvent;
 class WidgetContentCommandEvent;
 class WidgetPluginEvent;
 
 // MutationEvent.h (content/events/public)
 class InternalMutationEvent;
 } // namespace mozilla
 
 // TODO: Remove following typedefs
-typedef mozilla::WidgetMouseEvent          nsMouseEvent;
-
 namespace mozilla {
 typedef WidgetWheelEvent                   WheelEvent;
 }
 
 #endif // mozilla_EventForwards_h__
--- a/widget/InputData.h
+++ b/widget/InputData.h
@@ -157,23 +157,23 @@ public:
   }
 
   MultiTouchInput()
   {
   }
 
   MultiTouchInput(const WidgetTouchEvent& aTouchEvent);
 
-  // This conversion from nsMouseEvent to MultiTouchInput is needed because on
-  // the B2G emulator we can only receive mouse events, but we need to be able
-  // to pan correctly. To do this, we convert the events into a format that the
-  // panning code can handle. This code is very limited and only supports
+  // This conversion from WidgetMouseEvent to MultiTouchInput is needed because
+  // on the B2G emulator we can only receive mouse events, but we need to be
+  // able to pan correctly. To do this, we convert the events into a format that
+  // the panning code can handle. This code is very limited and only supports
   // SingleTouchData. It also sends garbage for the identifier, radius, force
   // and rotation angle.
-  MultiTouchInput(const nsMouseEvent& aMouseEvent);
+  MultiTouchInput(const WidgetMouseEvent& aMouseEvent);
 
   MultiTouchType mType;
   nsTArray<SingleTouchData> mTouches;
 };
 
 /**
  * Encapsulation class for pinch events. In general, these will be generated by
  * a gesture listener by looking at SingleTouchData/MultiTouchInput instances and
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -418,12 +418,9 @@ public:
   }
 };
 
 // TODO: Remove following typedef
 typedef WidgetWheelEvent                WheelEvent;
 
 } // namespace mozilla
 
-// TODO: Remove following typedefs
-typedef mozilla::WidgetMouseEvent       nsMouseEvent;
-
 #endif // mozilla_MouseEvents_h__
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1185,21 +1185,20 @@ nsWindow::OnMouseEvent(AndroidGeckoEvent
         default:
             return;
     }
 
     nsRefPtr<nsWindow> kungFuDeathGrip(this);
 
 send_again:
 
-    nsMouseEvent event(true,
-                       msg, this,
-                       nsMouseEvent::eReal, nsMouseEvent::eNormal);
+    WidgetMouseEvent event(true, msg, this,
+                           WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
     // XXX can we synthesize different buttons?
-    event.button = nsMouseEvent::eLeftButton;
+    event.button = WidgetMouseEvent::eLeftButton;
 
     if (msg != NS_MOUSE_MOVE)
         event.clickCount = 1;
 
     // XXX add the double-click handling logic here
     if (ae->Points().Length() > 0)
         DispatchMotionEvent(event, ae, ae->Points()[0]);
     if (Destroyed())
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -1462,19 +1462,19 @@ TextInputHandler::HandleKeyDownEvent(NSE
       return currentKeyEvent->IsDefaultPrevented();
     }
 
     // If this is the context menu key command, send a context menu key event.
     NSUInteger modifierFlags =
       [aNativeEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask;
     if (modifierFlags == NSControlKeyMask &&
         [[aNativeEvent charactersIgnoringModifiers] isEqualToString:@" "]) {
-      nsMouseEvent contextMenuEvent(true, NS_CONTEXTMENU,
-                                    [mView widget], nsMouseEvent::eReal,
-                                    nsMouseEvent::eContextMenuKey);
+      WidgetMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, [mView widget],
+                                        WidgetMouseEvent::eReal,
+                                        WidgetMouseEvent::eContextMenuKey);
       contextMenuEvent.modifiers = 0;
 
       bool cmEventHandled = DispatchEvent(contextMenuEvent);
       PR_LOG(gLog, PR_LOG_ALWAYS,
         ("%p TextInputHandler::HandleKeyDownEvent, "
          "context menu event dispatched, handled=%s%s",
          this, TrueOrFalse(cmEventHandled),
          Destroyed() ? " and widget was destroyed" : ""));
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -315,17 +315,17 @@ typedef NSInteger NSEventGestureAxis;
 - (void)sendFocusEvent:(uint32_t)eventType;
 
 - (void)handleMouseMoved:(NSEvent*)aEvent;
 
 - (void)updateWindowDraggableStateOnMouseMove:(NSEvent*)theEvent;
 
 - (void)sendMouseEnterOrExitEvent:(NSEvent*)aEvent
                             enter:(BOOL)aEnter
-                             type:(nsMouseEvent::exitType)aType;
+                             type:(mozilla::WidgetMouseEvent::exitType)aType;
 
 - (void)update;
 - (void)lockFocus;
 - (void) _surfaceNeedsUpdate:(NSNotification*)notification;
 
 - (BOOL)isPluginView;
 
 // Are we processing an NSLeftMouseDown event that will fail to click through?
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -4338,31 +4338,32 @@ NSEvent* gLastDragMouseDownEvent = nil;
 #endif
 
   // in order to send gecko events we'll need a gecko widget
   if (!mGeckoChild)
     return;
 
   NSUInteger modifierFlags = [theEvent modifierFlags];
 
-  nsMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_DOWN, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_DOWN, 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--;
   }
   geckoEvent.clickCount = clickCount;
 
   if (modifierFlags & NSControlKeyMask)
-    geckoEvent.button = nsMouseEvent::eRightButton;
+    geckoEvent.button = WidgetMouseEvent::eRightButton;
   else
-    geckoEvent.button = nsMouseEvent::eLeftButton;
+    geckoEvent.button = WidgetMouseEvent::eLeftButton;
 
   // Create event for use by plugins.
   // This is going to our child view so we don't need to look up the destination
   // event type.
   NPCocoaEvent cocoaEvent;
   ChildViewMouseTracker::AttachPluginEvent(geckoEvent, self, theEvent,
                                            NPCocoaEventMouseDown,
                                            &cocoaEvent);
@@ -4383,22 +4384,23 @@ NSEvent* gLastDragMouseDownEvent = nil;
 
   if (!mGeckoChild || mBlockedLastMouseDown)
     return;
 
   nsAutoRetainCocoaObject kungFuDeathGrip(self);
 
   NPCocoaEvent cocoaEvent;
 	
-  nsMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_UP, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_UP, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
   if ([theEvent modifierFlags] & NSControlKeyMask)
-    geckoEvent.button = nsMouseEvent::eRightButton;
+    geckoEvent.button = WidgetMouseEvent::eRightButton;
   else
-    geckoEvent.button = nsMouseEvent::eLeftButton;
+    geckoEvent.button = WidgetMouseEvent::eLeftButton;
 
   // Create event for use by plugins.
   // This is going to our child view so we don't need to look up the destination
   // event type.
   ChildViewMouseTracker::AttachPluginEvent(geckoEvent, self, theEvent,
                                            NPCocoaEventMouseUp,
                                            &cocoaEvent);
 
@@ -4425,26 +4427,26 @@ NSEvent* gLastDragMouseDownEvent = nil;
     ChildViewMouseTracker::ReEvaluateMouseEnterState(theEvent, self);
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (void)sendMouseEnterOrExitEvent:(NSEvent*)aEvent
                             enter:(BOOL)aEnter
-                             type:(nsMouseEvent::exitType)aType
+                             type:(WidgetMouseEvent::exitType)aType
 {
   if (!mGeckoChild)
     return;
 
   NSPoint windowEventLocation = nsCocoaUtils::EventLocationForWindow(aEvent, [self window]);
   NSPoint localEventLocation = [self convertPoint:windowEventLocation fromView:nil];
 
   uint32_t msg = aEnter ? NS_MOUSE_ENTER : NS_MOUSE_EXIT;
-  nsMouseEvent event(true, msg, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent event(true, msg, mGeckoChild, WidgetMouseEvent::eReal);
   event.refPoint = LayoutDeviceIntPoint::FromUntyped(
     mGeckoChild->CocoaPointsToDevPixels(localEventLocation));
 
   // Create event for use by plugins.
   // This is going to our child view so we don't need to look up the destination
   // event type.
   NPCocoaEvent cocoaEvent;
   ChildViewMouseTracker::AttachPluginEvent(event, self, aEvent,
@@ -4465,31 +4467,33 @@ NSEvent* gLastDragMouseDownEvent = nil;
   }
 
   nsCocoaWindow* windowWidget = mGeckoChild->GetXULWindowWidget();
   if (!windowWidget) {
     return;
   }
 
   // We assume later on that sending a hit test event won't cause widget destruction.
-  nsMouseEvent hitTestEvent(true, NS_MOUSE_MOZHITTEST, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent hitTestEvent(true, NS_MOUSE_MOZHITTEST, mGeckoChild,
+                                WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&hitTestEvent];
   bool result = mGeckoChild->DispatchWindowEvent(hitTestEvent);
 
   [windowWidget->GetCocoaWindow() setMovableByWindowBackground:result];
 }
 
 - (void)handleMouseMoved:(NSEvent*)theEvent
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if (!mGeckoChild)
     return;
 
-  nsMouseEvent geckoEvent(true, NS_MOUSE_MOVE, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_MOVE, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
 
   // Create event for use by plugins.
   // This is going to our child view so we don't need to look up the destination
   // event type.
   NPCocoaEvent cocoaEvent;
   ChildViewMouseTracker::AttachPluginEvent(geckoEvent, self, theEvent,
                                            NPCocoaEventMouseMoved,
@@ -4505,17 +4509,18 @@ NSEvent* gLastDragMouseDownEvent = nil;
 
   if (!mGeckoChild)
     return;
 
   gLastDragView = self;
 
   NPCocoaEvent cocoaEvent;
 
-  nsMouseEvent geckoEvent(true, NS_MOUSE_MOVE, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_MOVE, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
 
   // create event for use by plugins
   ChildViewMouseTracker::AttachPluginEvent(geckoEvent, self, theEvent,
                                            NPCocoaEventMouseDragged,
                                            &cocoaEvent);
 
   mGeckoChild->DispatchWindowEvent(geckoEvent);
@@ -4535,19 +4540,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
 
   nsAutoRetainCocoaObject kungFuDeathGrip(self);
 
   [self maybeRollup:theEvent];
   if (!mGeckoChild)
     return;
 
   // The right mouse went down, fire off a right mouse down event to gecko
-  nsMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_DOWN, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_DOWN, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
-  geckoEvent.button = nsMouseEvent::eRightButton;
+  geckoEvent.button = WidgetMouseEvent::eRightButton;
   geckoEvent.clickCount = [theEvent clickCount];
 
   // create event for use by plugins
   NPCocoaEvent cocoaEvent;
   ChildViewMouseTracker::AttachPluginEvent(geckoEvent, self, theEvent,
                                            NPCocoaEventMouseDown,
                                            &cocoaEvent);
 
@@ -4565,19 +4571,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if (!mGeckoChild)
     return;
 
   NPCocoaEvent cocoaEvent;
 
-  nsMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_UP, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_UP, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
-  geckoEvent.button = nsMouseEvent::eRightButton;
+  geckoEvent.button = WidgetMouseEvent::eRightButton;
   geckoEvent.clickCount = [theEvent clickCount];
 
   // create event for use by plugins
   ChildViewMouseTracker::AttachPluginEvent(geckoEvent, self, theEvent,
                                            NPCocoaEventMouseUp,
                                            &cocoaEvent);
 
   nsAutoRetainCocoaObject kungFuDeathGrip(self);
@@ -4593,19 +4600,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (void)rightMouseDragged:(NSEvent*)theEvent
 {
   if (!mGeckoChild)
     return;
 
-  nsMouseEvent geckoEvent(true, NS_MOUSE_MOVE, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_MOVE, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
-  geckoEvent.button = nsMouseEvent::eRightButton;
+  geckoEvent.button = WidgetMouseEvent::eRightButton;
 
   // create event for use by plugins
   NPCocoaEvent cocoaEvent;
   ChildViewMouseTracker::AttachPluginEvent(geckoEvent, self, theEvent,
                                            NPCocoaEventMouseDragged,
                                            &cocoaEvent);
 
   // send event into Gecko by going directly to the
@@ -4621,19 +4629,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
 
   if ([self maybeRollup:theEvent] ||
       !ChildViewMouseTracker::WindowAcceptsEvent([self window], theEvent, self))
     return;
 
   if (!mGeckoChild)
     return;
 
-  nsMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_DOWN, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_DOWN, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
-  geckoEvent.button = nsMouseEvent::eMiddleButton;
+  geckoEvent.button = WidgetMouseEvent::eMiddleButton;
   geckoEvent.clickCount = [theEvent clickCount];
 
   // create event for use by plugins
   NPCocoaEvent cocoaEvent;
   ChildViewMouseTracker::AttachPluginEvent(geckoEvent, self, theEvent,
                                            NPCocoaEventMouseDown,
                                            &cocoaEvent);
 
@@ -4642,19 +4651,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (void)otherMouseUp:(NSEvent *)theEvent
 {
   if (!mGeckoChild)
     return;
 
-  nsMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_UP, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_BUTTON_UP, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
-  geckoEvent.button = nsMouseEvent::eMiddleButton;
+  geckoEvent.button = WidgetMouseEvent::eMiddleButton;
 
   // create event for use by plugins
   NPCocoaEvent cocoaEvent;
   ChildViewMouseTracker::AttachPluginEvent(geckoEvent, self, theEvent,
                                            NPCocoaEventMouseUp,
                                            &cocoaEvent);
 
   nsAutoRetainCocoaObject kungFuDeathGrip(self);
@@ -4668,19 +4678,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
   }
 }
 
 - (void)otherMouseDragged:(NSEvent*)theEvent
 {
   if (!mGeckoChild)
     return;
 
-  nsMouseEvent geckoEvent(true, NS_MOUSE_MOVE, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_MOVE, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
-  geckoEvent.button = nsMouseEvent::eMiddleButton;
+  geckoEvent.button = WidgetMouseEvent::eMiddleButton;
 
   // create event for use by plugins
   NPCocoaEvent cocoaEvent;
   ChildViewMouseTracker::AttachPluginEvent(geckoEvent, self, theEvent,
                                            NPCocoaEventMouseDragged,
                                            &cocoaEvent);
 
   // send event into Gecko by going directly to the
@@ -4802,19 +4813,20 @@ static int32_t RoundUp(double aDouble)
   // and expects the mouse down event before the context menu event, so
   // get that event sent first if this is a left mouse click.
   if ([theEvent type] == NSLeftMouseDown) {
     [self mouseDown:theEvent];
     if (!mGeckoChild)
       return nil;
   }
 
-  nsMouseEvent geckoEvent(true, NS_CONTEXTMENU, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_CONTEXTMENU, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
-  geckoEvent.button = nsMouseEvent::eRightButton;
+  geckoEvent.button = WidgetMouseEvent::eRightButton;
   mGeckoChild->DispatchWindowEvent(geckoEvent);
   if (!mGeckoChild)
     return nil;
 
   [self maybeInitContextMenuTracking];
 
   // Go up our view chain to fetch the correct menu to return.
   return [self contextMenu];
@@ -4854,29 +4866,29 @@ static int32_t RoundUp(double aDouble)
     mGeckoChild->CocoaPointsToDevPixels(localPoint));
 
   WidgetMouseEventBase* mouseEvent =
     static_cast<WidgetMouseEventBase*>(outGeckoEvent);
   mouseEvent->buttons = 0;
   NSUInteger mouseButtons = [NSEvent pressedMouseButtons];
 
   if (mouseButtons & 0x01) {
-    mouseEvent->buttons |= nsMouseEvent::eLeftButtonFlag;
+    mouseEvent->buttons |= WidgetMouseEvent::eLeftButtonFlag;
   }
   if (mouseButtons & 0x02) {
-    mouseEvent->buttons |= nsMouseEvent::eRightButtonFlag;
+    mouseEvent->buttons |= WidgetMouseEvent::eRightButtonFlag;
   }
   if (mouseButtons & 0x04) {
-    mouseEvent->buttons |= nsMouseEvent::eMiddleButtonFlag;
+    mouseEvent->buttons |= WidgetMouseEvent::eMiddleButtonFlag;
   }
   if (mouseButtons & 0x08) {
-    mouseEvent->buttons |= nsMouseEvent::e4thButtonFlag;
+    mouseEvent->buttons |= WidgetMouseEvent::e4thButtonFlag;
   }
   if (mouseButtons & 0x10) {
-    mouseEvent->buttons |= nsMouseEvent::e5thButtonFlag;
+    mouseEvent->buttons |= WidgetMouseEvent::e5thButtonFlag;
   }
 
   switch ([aMouseEvent type]) {
     case NSLeftMouseDown:
     case NSLeftMouseUp:
     case NSLeftMouseDragged:
     case NSRightMouseDown:
     case NSRightMouseUp:
@@ -5246,17 +5258,18 @@ static int32_t RoundUp(double aDouble)
 }
 
 - (BOOL)inactiveWindowAcceptsMouseEvent:(NSEvent*)aEvent
 {
   // If we're being destroyed assume the default -- return YES.
   if (!mGeckoChild)
     return YES;
 
-  nsMouseEvent geckoEvent(true, NS_MOUSE_ACTIVATE, mGeckoChild, nsMouseEvent::eReal);
+  WidgetMouseEvent geckoEvent(true, NS_MOUSE_ACTIVATE, mGeckoChild,
+                              WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:aEvent toGeckoEvent:&geckoEvent];
   return !mGeckoChild->DispatchWindowEvent(geckoEvent);
 }
 
 // Don't focus a plugin if the user has clicked on a DOM element above it.
 // In this case the user has actually clicked on the plugin's ChildView
 // (underneath the non-plugin DOM element).  But we shouldn't allow the
 // ChildView to be focused.  See bug 627649.
@@ -6073,21 +6086,22 @@ ChildViewMouseTracker::MouseExitedWindow
 
 void
 ChildViewMouseTracker::ReEvaluateMouseEnterState(NSEvent* aEvent, ChildView* aOldView)
 {
   ChildView* oldView = aOldView ? aOldView : sLastMouseEventView;
   sLastMouseEventView = ViewForEvent(aEvent);
   if (sLastMouseEventView != oldView) {
     // Send enter and / or exit events.
-    nsMouseEvent::exitType type = [sLastMouseEventView window] == [oldView window] ?
-                                    nsMouseEvent::eChild : nsMouseEvent::eTopLevel;
+    WidgetMouseEvent::exitType type =
+      [sLastMouseEventView window] == [oldView window] ?
+        WidgetMouseEvent::eChild : WidgetMouseEvent::eTopLevel;
     [oldView sendMouseEnterOrExitEvent:aEvent enter:NO type:type];
     // After the cursor exits the window set it to a visible regular arrow cursor.
-    if (type == nsMouseEvent::eTopLevel) {
+    if (type == WidgetMouseEvent::eTopLevel) {
       [[nsCursorManager sharedInstance] setCursor:eCursor_standard];
     }
     [sLastMouseEventView sendMouseEnterOrExitEvent:aEvent enter:YES type:type];
   }
 }
 
 void
 ChildViewMouseTracker::ResendLastMouseMoveEvent()
--- a/widget/cocoa/nsMenuX.mm
+++ b/widget/cocoa/nsMenuX.mm
@@ -40,16 +40,18 @@
 
 #include "jsapi.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptContext.h"
 #include "nsIXPConnect.h"
 
 #include "mozilla/MouseEvents.h"
 
+using namespace mozilla;
+
 static bool gConstructingMenu = false;
 static bool gMenuMethodsSwizzled = false;
 
 int32_t nsMenuX::sIndexingMenuLevel = 0;
 using mozilla::AutoPushJSContext;
 
 
 //
@@ -347,17 +349,18 @@ nsEventStatus nsMenuX::MenuOpened()
     if (mNeedsRebuild)
       RemoveAll();
 
     MenuConstruct();
     mConstructed = true;
   }
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(true, NS_XUL_POPUP_SHOWN, nullptr, nsMouseEvent::eReal);
+  WidgetMouseEvent event(true, NS_XUL_POPUP_SHOWN, nullptr,
+                         WidgetMouseEvent::eReal);
 
   nsCOMPtr<nsIContent> popupContent;
   GetMenuPopupContent(getter_AddRefs(popupContent));
   nsIContent* dispatchTo = popupContent ? popupContent : mContent;
   dispatchTo->DispatchDOMEvent(&event, nullptr, nullptr, &status);
   
   return nsEventStatus_eConsumeNoDefault;
 }
@@ -370,17 +373,18 @@ void nsMenuX::MenuClosed()
       return;
 
     if (mNeedsRebuild)
       mConstructed = false;
 
     mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::open, true);
 
     nsEventStatus status = nsEventStatus_eIgnore;
-    nsMouseEvent event(true, NS_XUL_POPUP_HIDDEN, nullptr, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_XUL_POPUP_HIDDEN, nullptr,
+                           WidgetMouseEvent::eReal);
 
     nsCOMPtr<nsIContent> popupContent;
     GetMenuPopupContent(getter_AddRefs(popupContent));
     nsIContent* dispatchTo = popupContent ? popupContent : mContent;
     dispatchTo->DispatchDOMEvent(&event, nullptr, nullptr, &status);
 
     mDestroyHandlerCalled = true;
     mConstructed = false;
@@ -555,18 +559,18 @@ void nsMenuX::LoadSubMenu(nsIContent* in
   menu.forget();
 }
 
 // This menu is about to open. Returns TRUE if we should keep processing the event,
 // FALSE if the handler wants to stop the opening of the menu.
 bool nsMenuX::OnOpen()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(true, NS_XUL_POPUP_SHOWING, nullptr,
-                     nsMouseEvent::eReal);
+  WidgetMouseEvent event(true, NS_XUL_POPUP_SHOWING, nullptr,
+                         WidgetMouseEvent::eReal);
   
   nsCOMPtr<nsIContent> popupContent;
   GetMenuPopupContent(getter_AddRefs(popupContent));
   
   nsresult rv = NS_OK;
   nsIContent* dispatchTo = popupContent ? popupContent : mContent;
   rv = dispatchTo->DispatchDOMEvent(&event, nullptr, nullptr, &status);
   if (NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault)
@@ -593,18 +597,18 @@ bool nsMenuX::OnOpen()
 // Returns TRUE if we should keep processing the event, FALSE if the handler
 // wants to stop the closing of the menu.
 bool nsMenuX::OnClose()
 {
   if (mDestroyHandlerCalled)
     return true;
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(true, NS_XUL_POPUP_HIDING, nullptr,
-                     nsMouseEvent::eReal);
+  WidgetMouseEvent event(true, NS_XUL_POPUP_HIDING, nullptr,
+                         WidgetMouseEvent::eReal);
 
   nsCOMPtr<nsIContent> popupContent;
   GetMenuPopupContent(getter_AddRefs(popupContent));
 
   nsresult rv = NS_OK;
   nsIContent* dispatchTo = popupContent ? popupContent : mContent;
   rv = dispatchTo->DispatchDOMEvent(&event, nullptr, nullptr, &status);
   
--- a/widget/gonk/nsAppShell.cpp
+++ b/widget/gonk/nsAppShell.cpp
@@ -140,23 +140,23 @@ struct UserInputData {
             ::Touch touches[MAX_POINTERS];
         } motion;
     };
 };
 
 static void
 sendMouseEvent(uint32_t msg, uint64_t timeMs, int x, int y, bool forwardToChildren)
 {
-    nsMouseEvent event(true, msg, NULL,
-                       nsMouseEvent::eReal, nsMouseEvent::eNormal);
+    WidgetMouseEvent event(true, msg, NULL,
+                           WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
 
     event.refPoint.x = x;
     event.refPoint.y = y;
     event.time = timeMs;
-    event.button = nsMouseEvent::eLeftButton;
+    event.button = WidgetMouseEvent::eLeftButton;
     event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
     if (msg != NS_MOUSE_MOVE)
         event.clickCount = 1;
 
     event.mFlags.mNoCrossProcessBoundaryForwarding = !forwardToChildren;
 
     nsWindow::DispatchInputEvent(event);
 }
--- a/widget/gtk/nsGtkKeyUtils.cpp
+++ b/widget/gtk/nsGtkKeyUtils.cpp
@@ -559,35 +559,35 @@ KeymapWrapper::InitInputEvent(WidgetInpu
         default:
             return;
     }
 
     WidgetMouseEventBase& mouseEvent =
       static_cast<WidgetMouseEventBase&>(aInputEvent);
     mouseEvent.buttons = 0;
     if (aModifierState & GDK_BUTTON1_MASK) {
-        mouseEvent.buttons |= nsMouseEvent::eLeftButtonFlag;
+        mouseEvent.buttons |= WidgetMouseEvent::eLeftButtonFlag;
     }
     if (aModifierState & GDK_BUTTON3_MASK) {
-        mouseEvent.buttons |= nsMouseEvent::eRightButtonFlag;
+        mouseEvent.buttons |= WidgetMouseEvent::eRightButtonFlag;
     }
     if (aModifierState & GDK_BUTTON2_MASK) {
-        mouseEvent.buttons |= nsMouseEvent::eMiddleButtonFlag;
+        mouseEvent.buttons |= WidgetMouseEvent::eMiddleButtonFlag;
     }
 
     PR_LOG(gKeymapWrapperLog, PR_LOG_DEBUG,
         ("KeymapWrapper(%p): InitInputEvent, aInputEvent has buttons, "
          "aInputEvent.buttons=0x%04X (Left: %s, Right: %s, Middle: %s, "
          "4th (BACK): %s, 5th (FORWARD): %s)",
          keymapWrapper, mouseEvent.buttons,
-         GetBoolName(mouseEvent.buttons & nsMouseEvent::eLeftButtonFlag),
-         GetBoolName(mouseEvent.buttons & nsMouseEvent::eRightButtonFlag),
-         GetBoolName(mouseEvent.buttons & nsMouseEvent::eMiddleButtonFlag),
-         GetBoolName(mouseEvent.buttons & nsMouseEvent::e4thButtonFlag),
-         GetBoolName(mouseEvent.buttons & nsMouseEvent::e5thButtonFlag)));
+         GetBoolName(mouseEvent.buttons & WidgetMouseEvent::eLeftButtonFlag),
+         GetBoolName(mouseEvent.buttons & WidgetMouseEvent::eRightButtonFlag),
+         GetBoolName(mouseEvent.buttons & WidgetMouseEvent::eMiddleButtonFlag),
+         GetBoolName(mouseEvent.buttons & WidgetMouseEvent::e4thButtonFlag),
+         GetBoolName(mouseEvent.buttons & WidgetMouseEvent::e5thButtonFlag)));
 }
 
 /* static */ uint32_t
 KeymapWrapper::ComputeDOMKeyCode(const GdkEventKey* aGdkKeyEvent)
 {
     // If the keyval indicates it's a modifier key, we should use unshifted
     // key's modifier keyval.
     guint keyval = aGdkKeyEvent->keyval;
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2427,17 +2427,17 @@ nsWindow::OnEnterNotifyEvent(GdkEventCro
 
     // Check before is_parent_ungrab_enter() as the button state may have
     // changed while a non-Gecko ancestor window had a pointer grab.
     DispatchMissedButtonReleases(aEvent);
 
     if (is_parent_ungrab_enter(aEvent))
         return;
 
-    nsMouseEvent event(true, NS_MOUSE_ENTER, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_ENTER, this, WidgetMouseEvent::eReal);
 
     event.refPoint.x = nscoord(aEvent->x);
     event.refPoint.y = nscoord(aEvent->y);
 
     event.time = aEvent->time;
 
     LOG(("OnEnterNotify: %p\n", (void *)this));
 
@@ -2469,25 +2469,25 @@ nsWindow::OnLeaveNotifyEvent(GdkEventCro
     // that window.
     //
     // XXXkt However, we will miss toplevel exits when the pointer directly
     // leaves a foreign (plugin) child window without passing over a visible
     // portion of a Gecko window.
     if (aEvent->subwindow != NULL)
         return;
 
-    nsMouseEvent event(true, NS_MOUSE_EXIT, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_EXIT, this, WidgetMouseEvent::eReal);
 
     event.refPoint.x = nscoord(aEvent->x);
     event.refPoint.y = nscoord(aEvent->y);
 
     event.time = aEvent->time;
 
     event.exit = is_top_level_mouse_exit(mGdkWindow, aEvent)
-        ? nsMouseEvent::eTopLevel : nsMouseEvent::eChild;
+        ? WidgetMouseEvent::eTopLevel : WidgetMouseEvent::eChild;
 
     LOG(("OnLeaveNotify: %p\n", (void *)this));
 
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
 
 void
@@ -2514,17 +2514,17 @@ nsWindow::OnMotionNotifyEvent(GdkEventMo
     // if plugins still keeps the focus, get it back
     if (gPluginFocusWindow && gPluginFocusWindow != this) {
         nsRefPtr<nsWindow> kungFuDeathGrip = gPluginFocusWindow;
         gPluginFocusWindow->LoseNonXEmbedPluginFocus();
     }
 #endif /* MOZ_WIDGET_GTK2 */
 #endif /* MOZ_X11 */
 
-    nsMouseEvent event(true, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_MOVE, this, WidgetMouseEvent::eReal);
 
     gdouble pressure = 0;
     gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
     // Sometime gdk generate 0 pressure value between normal values
     // We have to ignore that and use last valid value
     if (pressure)
       mLastMotionPressure = pressure;
     event.pressure = mLastMotionPressure;
@@ -2591,46 +2591,46 @@ nsWindow::DispatchMissedButtonReleases(G
     for (guint buttonMask = GDK_BUTTON1_MASK;
          buttonMask <= GDK_BUTTON3_MASK;
          buttonMask <<= 1) {
 
         if (released & buttonMask) {
             int16_t buttonType;
             switch (buttonMask) {
             case GDK_BUTTON1_MASK:
-                buttonType = nsMouseEvent::eLeftButton;
+                buttonType = WidgetMouseEvent::eLeftButton;
                 break;
             case GDK_BUTTON2_MASK:
-                buttonType = nsMouseEvent::eMiddleButton;
+                buttonType = WidgetMouseEvent::eMiddleButton;
                 break;
             default:
                 NS_ASSERTION(buttonMask == GDK_BUTTON3_MASK,
                              "Unexpected button mask");
-                buttonType = nsMouseEvent::eRightButton;
+                buttonType = WidgetMouseEvent::eRightButton;
             }
 
             LOG(("Synthesized button %u release on %p\n",
                  guint(buttonType + 1), (void *)this));
 
             // Dispatch a synthesized button up event to tell Gecko about the
             // change in state.  This event is marked as synthesized so that
             // it is not dispatched as a DOM event, because we don't know the
             // position, widget, modifiers, or time/order.
-            nsMouseEvent synthEvent(true, NS_MOUSE_BUTTON_UP, this,
-                                    nsMouseEvent::eSynthesized);
+            WidgetMouseEvent synthEvent(true, NS_MOUSE_BUTTON_UP, this,
+                                        WidgetMouseEvent::eSynthesized);
             synthEvent.button = buttonType;
             nsEventStatus status;
             DispatchEvent(&synthEvent, status);
         }
     }
 }
 
 void
-nsWindow::InitButtonEvent(nsMouseEvent &aEvent,
-                          GdkEventButton *aGdkEvent)
+nsWindow::InitButtonEvent(WidgetMouseEvent& aEvent,
+                          GdkEventButton* aGdkEvent)
 {
     // XXX see OnScrollEvent()
     if (aGdkEvent->window == mGdkWindow) {
         aEvent.refPoint.x = nscoord(aGdkEvent->x);
         aEvent.refPoint.y = nscoord(aGdkEvent->y);
     } else {
         LayoutDeviceIntPoint point(NSToIntFloor(aGdkEvent->x_root),
                                    NSToIntFloor(aGdkEvent->y_root));
@@ -2712,23 +2712,23 @@ nsWindow::OnButtonPressEvent(GdkEventBut
 
     gdouble pressure = 0;
     gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
     mLastMotionPressure = pressure;
 
     uint16_t domButton;
     switch (aEvent->button) {
     case 1:
-        domButton = nsMouseEvent::eLeftButton;
+        domButton = WidgetMouseEvent::eLeftButton;
         break;
     case 2:
-        domButton = nsMouseEvent::eMiddleButton;
+        domButton = WidgetMouseEvent::eMiddleButton;
         break;
     case 3:
-        domButton = nsMouseEvent::eRightButton;
+        domButton = WidgetMouseEvent::eRightButton;
         break;
     // These are mapped to horizontal scroll
     case 6:
     case 7:
         NS_WARNING("We're not supporting legacy horizontal scroll event");
         return;
     // Map buttons 8-9 to back/forward
     case 8:
@@ -2738,57 +2738,59 @@ nsWindow::OnButtonPressEvent(GdkEventBut
         DispatchCommandEvent(nsGkAtoms::Forward);
         return;
     default:
         return;
     }
 
     gButtonState |= ButtonMaskFromGDKButton(aEvent->button);
 
-    nsMouseEvent event(true, NS_MOUSE_BUTTON_DOWN, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_BUTTON_DOWN, this,
+                           WidgetMouseEvent::eReal);
     event.button = domButton;
     InitButtonEvent(event, aEvent);
     event.pressure = mLastMotionPressure;
 
     DispatchEvent(&event, status);
 
     // right menu click on linux should also pop up a context menu
-    if (domButton == nsMouseEvent::eRightButton &&
+    if (domButton == WidgetMouseEvent::eRightButton &&
         MOZ_LIKELY(!mIsDestroyed)) {
-        nsMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
-                                      nsMouseEvent::eReal);
+        WidgetMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
+                                          WidgetMouseEvent::eReal);
         InitButtonEvent(contextMenuEvent, aEvent);
         contextMenuEvent.pressure = mLastMotionPressure;
         DispatchEvent(&contextMenuEvent, status);
     }
 }
 
 void
 nsWindow::OnButtonReleaseEvent(GdkEventButton *aEvent)
 {
     LOG(("Button %u release on %p\n", aEvent->button, (void *)this));
 
     uint16_t domButton;
     switch (aEvent->button) {
     case 1:
-        domButton = nsMouseEvent::eLeftButton;
+        domButton = WidgetMouseEvent::eLeftButton;
         break;
     case 2:
-        domButton = nsMouseEvent::eMiddleButton;
+        domButton = WidgetMouseEvent::eMiddleButton;
         break;
     case 3:
-        domButton = nsMouseEvent::eRightButton;
+        domButton = WidgetMouseEvent::eRightButton;
         break;
     default:
         return;
     }
 
     gButtonState &= ~ButtonMaskFromGDKButton(aEvent->button);
 
-    nsMouseEvent event(true, NS_MOUSE_BUTTON_UP, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_BUTTON_UP, this,
+                           WidgetMouseEvent::eReal);
     event.button = domButton;
     InitButtonEvent(event, aEvent);
     gdouble pressure = 0;
     gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
     event.pressure = pressure ? pressure : mLastMotionPressure;
 
     nsEventStatus status;
     DispatchEvent(&event, status);
@@ -3017,19 +3019,19 @@ nsWindow::OnKeyPressEvent(GdkEventKey *a
 #endif /* MOZ_X11 */
 
     WidgetKeyboardEvent event(true, NS_KEY_PRESS, this);
     KeymapWrapper::InitKeyEvent(event, aEvent);
 
     // before we dispatch a key, check if it's the context menu key.
     // If so, send a context menu key event instead.
     if (is_context_menu_key(event)) {
-        nsMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
-                                      nsMouseEvent::eReal,
-                                      nsMouseEvent::eContextMenuKey);
+        WidgetMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
+                                          WidgetMouseEvent::eReal,
+                                          WidgetMouseEvent::eContextMenuKey);
 
         contextMenuEvent.refPoint = LayoutDeviceIntPoint(0, 0);
         contextMenuEvent.time = aEvent->time;
         contextMenuEvent.clickCount = 1;
         KeymapWrapper::InitInputEvent(contextMenuEvent, aEvent->state);
         DispatchEvent(&contextMenuEvent, status);
     }
     else {
@@ -6046,21 +6048,21 @@ nsWindow::GetThebesSurface(cairo_t *cr)
         mThebesSurface = nullptr;
     }
 
     return mThebesSurface;
 }
 
 // Code shared begin BeginMoveDrag and BeginResizeDrag
 bool
-nsWindow::GetDragInfo(nsMouseEvent* aMouseEvent,
+nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent,
                       GdkWindow** aWindow, gint* aButton,
                       gint* aRootX, gint* aRootY)
 {
-    if (aMouseEvent->button != nsMouseEvent::eLeftButton) {
+    if (aMouseEvent->button != WidgetMouseEvent::eLeftButton) {
         // we can only begin a move drag with the left mouse button
         return false;
     }
     *aButton = 1;
 
     // get the gdk window for this widget
     GdkWindow* gdk_window = mGdkWindow;
     if (!gdk_window) {
@@ -6086,17 +6088,17 @@ nsWindow::GetDragInfo(nsMouseEvent* aMou
     nsIntPoint offset = aMouseEvent->widget->WidgetToScreenOffset();
     *aRootX = aMouseEvent->refPoint.x + offset.x;
     *aRootY = aMouseEvent->refPoint.y + offset.y;
 
     return true;
 }
 
 NS_IMETHODIMP
-nsWindow::BeginMoveDrag(nsMouseEvent* aEvent)
+nsWindow::BeginMoveDrag(WidgetMouseEvent* aEvent)
 {
     NS_ABORT_IF_FALSE(aEvent, "must have event");
     NS_ABORT_IF_FALSE(aEvent->eventStructType == NS_MOUSE_EVENT,
                       "event must have correct struct type");
 
     GdkWindow *gdk_window;
     gint button, screenX, screenY;
     if (!GetDragInfo(aEvent, &gdk_window, &button, &screenX, &screenY)) {
@@ -6117,17 +6119,17 @@ nsWindow::BeginResizeDrag(WidgetGUIEvent
 {
     NS_ENSURE_ARG_POINTER(aEvent);
 
     if (aEvent->eventStructType != NS_MOUSE_EVENT) {
         // you can only begin a resize drag with a mouse event
         return NS_ERROR_INVALID_ARG;
     }
 
-    nsMouseEvent* mouse_event = static_cast<nsMouseEvent*>(aEvent);
+    WidgetMouseEvent* mouse_event = static_cast<WidgetMouseEvent*>(aEvent);
 
     GdkWindow *gdk_window;
     gint button, screenX, screenY;
     if (!GetDragInfo(mouse_event, &gdk_window, &button, &screenX, &screenY)) {
         return NS_ERROR_FAILURE;
     }
 
     // work out what GdkWindowEdge we're talking about
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -241,17 +241,17 @@ public:
     Window             mOldFocusWindow;
 #endif /* MOZ_X11 */
 
     static guint32     sLastButtonPressTime;
 
     NS_IMETHOD         BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
                                        int32_t aHorizontal,
                                        int32_t aVertical);
-    NS_IMETHOD         BeginMoveDrag(nsMouseEvent* aEvent);
+    NS_IMETHOD         BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent);
 
     MozContainer*      GetMozContainer() { return mContainer; }
     // GetMozContainerWidget returns the MozContainer even for undestroyed
     // descendant windows
     GtkWidget*         GetMozContainerWidget();
     GdkWindow*         GetGdkWindow() { return mGdkWindow; }
     bool               IsDestroyed() { return mIsDestroyed; }
 
@@ -334,24 +334,25 @@ protected:
 
 private:
     void               DestroyChildWindows();
     GtkWidget         *GetToplevelWidget();
     nsWindow          *GetContainerWindow();
     void               SetUrgencyHint(GtkWidget *top_window, bool state);
     void              *SetupPluginPort(void);
     void               SetDefaultIcon(void);
-    void               InitButtonEvent(nsMouseEvent &aEvent, GdkEventButton *aGdkEvent);
+    void               InitButtonEvent(mozilla::WidgetMouseEvent& aEvent,
+                                       GdkEventButton* aGdkEvent);
     bool               DispatchCommandEvent(nsIAtom* aCommand);
     bool               DispatchContentCommandEvent(int32_t aMsg);
     void               SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
                                            bool aIntersectWithExisting);
     bool               CheckForRollup(gdouble aMouseX, gdouble aMouseY,
                                       bool aIsWheel, bool aAlwaysRollup);
-    bool               GetDragInfo(nsMouseEvent* aMouseEvent,
+    bool               GetDragInfo(mozilla::WidgetMouseEvent* aMouseEvent,
                                    GdkWindow** aWindow, gint* aButton,
                                    gint* aRootX, gint* aRootY);
     void               ClearCachedResources();
 
     GtkWidget          *mShell;
     MozContainer       *mContainer;
     GdkWindow          *mGdkWindow;
 
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -167,19 +167,19 @@ struct ParamTraits<mozilla::WheelEvent>
       ReadParam(aMsg, aIter, &aResult->overflowDeltaY);
     aResult->scrollType =
       static_cast<mozilla::WheelEvent::ScrollType>(scrollType);
     return rv;
   }
 };
 
 template<>
-struct ParamTraits<nsMouseEvent>
+struct ParamTraits<mozilla::WidgetMouseEvent>
 {
-  typedef nsMouseEvent paramType;
+  typedef mozilla::WidgetMouseEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
     WriteParam(aMsg, aParam.ignoreRootScrollFrame);
     WriteParam(aMsg, (uint8_t) aParam.reason);
     WriteParam(aMsg, (uint8_t) aParam.context);
     WriteParam(aMsg, (uint8_t) aParam.exit);
@@ -192,19 +192,21 @@ struct ParamTraits<nsMouseEvent>
     uint8_t reason = 0, context = 0, exit = 0;
     rv = ReadParam(aMsg, aIter,
                    static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
          ReadParam(aMsg, aIter, &aResult->ignoreRootScrollFrame) &&
          ReadParam(aMsg, aIter, &reason) &&
          ReadParam(aMsg, aIter, &context) &&
          ReadParam(aMsg, aIter, &exit) &&
          ReadParam(aMsg, aIter, &aResult->clickCount);
-    aResult->reason = static_cast<nsMouseEvent::reasonType>(reason);
-    aResult->context = static_cast<nsMouseEvent::contextType>(context);
-    aResult->exit = static_cast<nsMouseEvent::exitType>(exit);
+    aResult->reason =
+      static_cast<mozilla::WidgetMouseEvent::reasonType>(reason);
+    aResult->context =
+      static_cast<mozilla::WidgetMouseEvent::contextType>(context);
+    aResult->exit = static_cast<mozilla::WidgetMouseEvent::exitType>(exit);
     return rv;
   }
 };
 
 template<>
 struct ParamTraits<mozilla::WidgetTouchEvent>
 {
   typedef mozilla::WidgetTouchEvent paramType;
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1439,17 +1439,17 @@ class nsIWidget : public nsISupports {
      */
     NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
                                int32_t aHorizontal,
                                int32_t aVertical) = 0;
 
     /**
      * Begin a window moving drag, based on the event passed in.
      */
-    NS_IMETHOD BeginMoveDrag(nsMouseEvent* aEvent) = 0;
+    NS_IMETHOD BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) = 0;
 
     enum Modifiers {
         CAPS_LOCK = 0x01, // when CapsLock is active
         NUM_LOCK = 0x02, // when NumLock is active
         SHIFT_L = 0x0100,
         SHIFT_R = 0x0200,
         CTRL_L = 0x0400,
         CTRL_R = 0x0800,
--- a/widget/os2/nsWindow.cpp
+++ b/widget/os2/nsWindow.cpp
@@ -1750,59 +1750,59 @@ MRESULT nsWindow::ProcessMessage(ULONG m
 
     case WM_BUTTON1DBLCLK:
       isDone = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, mp1, mp2);
       break;
 
     case WM_BUTTON2DOWN:
       WinSetCapture(HWND_DESKTOP, mWnd);
       isDone = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, mp1, mp2, false,
-                                  nsMouseEvent::eRightButton);
+                                  WidgetMouseEvent::eRightButton);
       break;
 
     case WM_BUTTON2UP:
       WinSetCapture(HWND_DESKTOP, 0);
       isDone = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, mp1, mp2, false,
-                                  nsMouseEvent::eRightButton);
+                                  WidgetMouseEvent::eRightButton);
       break;
 
     case WM_BUTTON2DBLCLK:
       isDone = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, mp1, mp2,
-                                  false, nsMouseEvent::eRightButton);
+                                  false, WidgetMouseEvent::eRightButton);
       break;
 
     case WM_BUTTON3DOWN:
       WinSetCapture(HWND_DESKTOP, mWnd);
       isDone = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, mp1, mp2, false,
-                                  nsMouseEvent::eMiddleButton);
+                                  WidgetMouseEvent::eMiddleButton);
       break;
 
     case WM_BUTTON3UP:
       WinSetCapture(HWND_DESKTOP, 0);
       isDone = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, mp1, mp2, false,
-                                  nsMouseEvent::eMiddleButton);
+                                  WidgetMouseEvent::eMiddleButton);
       break;
 
     case WM_BUTTON3DBLCLK:
       isDone = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, mp1, mp2, false,
-                                  nsMouseEvent::eMiddleButton);
+                                  WidgetMouseEvent::eMiddleButton);
       break;
 
     case WM_CONTEXTMENU:
       if (SHORT2FROMMP(mp2)) {
         HWND hFocus = WinQueryFocus(HWND_DESKTOP);
         if (hFocus != mWnd) {
           WinSendMsg(hFocus, msg, mp1, mp2);
         } else {
           isDone = DispatchMouseEvent(NS_CONTEXTMENU, mp1, mp2, true,
-                                      nsMouseEvent::eLeftButton);
+                                      WidgetMouseEvent::eLeftButton);
         }
       } else {
         isDone = DispatchMouseEvent(NS_CONTEXTMENU, mp1, mp2, false,
-                                    nsMouseEvent::eRightButton);
+                                    WidgetMouseEvent::eRightButton);
       }
       break;
 
     // If MB1 & MB2 are both pressed, perform a copy or paste.
     case WM_CHORD:
       isDone = OnMouseChord(mp1, mp2);
       break;
 
@@ -3139,20 +3139,20 @@ bool nsWindow::DispatchResizeEvent(int32
 //-----------------------------------------------------------------------------
 // Deal with all sorts of mouse events.
 
 bool nsWindow::DispatchMouseEvent(uint32_t aEventType, MPARAM mp1, MPARAM mp2,
                                     bool aIsContextMenuKey, int16_t aButton)
 {
   NS_ENSURE_TRUE(aEventType, false);
 
-  nsMouseEvent event(true, aEventType, this, nsMouseEvent::eReal,
-                     aIsContextMenuKey
-                     ? nsMouseEvent::eContextMenuKey
-                     : nsMouseEvent::eNormal);
+  WidgetMouseEvent event(true, aEventType, this, WidgetMouseEvent::eReal,
+                         aIsContextMenuKey ?
+                           WidgetMouseEvent::eContextMenuKey :
+                           WidgetMouseEvent::eNormal);
   event.button = aButton;
   if (aEventType == NS_MOUSE_BUTTON_DOWN && mIsComposing) {
     // If IME is composing, let it complete.
     HIMI himi;
 
     spfnImGetInstance(mWnd, &himi);
     spfnImRequestIME(himi, REQ_CONVERSIONSTRING, CNV_COMPLETE, 0);
     spfnImReleaseInstance(mWnd, himi);
@@ -3176,17 +3176,17 @@ bool nsWindow::DispatchMouseEvent(uint32
       while (hCur && hCur != hDesk) {
         hTop = hCur;
         hCur = WinQueryWindow(hCur, QW_PARENT);
       }
 
       // event.exit was init'ed to eChild, so we don't need an 'else'
       hTop = WinWindowFromID(hTop, FID_CLIENT);
       if (!hTop || !WinIsChild(HWNDFROMMP(mp2), hTop)) {
-        event.exit = nsMouseEvent::eTopLevel;
+        event.exit = WidgetMouseEvent::eTopLevel;
       }
     }
 
     InitEvent(event, nullptr);
     event.InitBasicModifiers(isKeyDown(VK_CTRL),
                              isKeyDown(VK_ALT) || isKeyDown(VK_ALTGRAF),
                              isKeyDown(VK_SHIFT), false);
   } else {
@@ -3204,70 +3204,71 @@ bool nsWindow::DispatchMouseEvent(uint32
 
     USHORT usFlags  = SHORT2FROMMP(mp2);
     event.InitBasicModifiers(usFlags & KC_CTRL, usFlags & KC_ALT,
                              usFlags & KC_SHIFT, false);
   }
 
   // Dblclicks are used to set the click count, then changed to mousedowns
   if (aEventType == NS_MOUSE_DOUBLECLICK &&
-      (aButton == nsMouseEvent::eLeftButton ||
-       aButton == nsMouseEvent::eRightButton)) {
+      (aButton == WidgetMouseEvent::eLeftButton ||
+       aButton == WidgetMouseEvent::eRightButton)) {
     event.message = NS_MOUSE_BUTTON_DOWN;
-    event.button = (aButton == nsMouseEvent::eLeftButton) ?
-                   nsMouseEvent::eLeftButton : nsMouseEvent::eRightButton;
+    event.button =
+      (aButton == WidgetMouseEvent::eLeftButton) ?
+        WidgetMouseEvent::eLeftButton : WidgetMouseEvent::eRightButton;
     event.clickCount = 2;
   } else {
     event.clickCount = 1;
   }
 
   NPEvent pluginEvent;
   switch (aEventType) {
 
     case NS_MOUSE_BUTTON_DOWN:
       switch (aButton) {
-        case nsMouseEvent::eLeftButton:
+        case WidgetMouseEvent::eLeftButton:
           pluginEvent.event = WM_BUTTON1DOWN;
           break;
-        case nsMouseEvent::eMiddleButton:
+        case WidgetMouseEvent::eMiddleButton:
           pluginEvent.event = WM_BUTTON3DOWN;
           break;
-        case nsMouseEvent::eRightButton:
+        case WidgetMouseEvent::eRightButton:
           pluginEvent.event = WM_BUTTON2DOWN;
           break;
         default:
           break;
       }
       break;
 
     case NS_MOUSE_BUTTON_UP:
       switch (aButton) {
-        case nsMouseEvent::eLeftButton:
+        case WidgetMouseEvent::eLeftButton:
           pluginEvent.event = WM_BUTTON1UP;
           break;
-        case nsMouseEvent::eMiddleButton:
+        case WidgetMouseEvent::eMiddleButton:
           pluginEvent.event = WM_BUTTON3UP;
           break;
-        case nsMouseEvent::eRightButton:
+        case WidgetMouseEvent::eRightButton:
           pluginEvent.event = WM_BUTTON2UP;
           break;
         default:
           break;
       }
       break;
 
     case NS_MOUSE_DOUBLECLICK:
       switch (aButton) {
-        case nsMouseEvent::eLeftButton:
+        case WidgetMouseEvent::eLeftButton:
           pluginEvent.event = WM_BUTTON1DBLCLK;
           break;
-        case nsMouseEvent::eMiddleButton:
+        case WidgetMouseEvent::eMiddleButton:
           pluginEvent.event = WM_BUTTON3DBLCLK;
           break;
-        case nsMouseEvent::eRightButton:
+        case WidgetMouseEvent::eRightButton:
           pluginEvent.event = WM_BUTTON2DBLCLK;
           break;
         default:
           break;
       }
       break;
 
     case NS_MOUSE_MOVE:
--- a/widget/os2/nsWindow.h
+++ b/widget/os2/nsWindow.h
@@ -243,17 +243,17 @@ protected:
   bool                  DispatchCommandEvent(uint32_t aEventCommand);
   bool                  DispatchDragDropEvent(uint32_t aMsg);
   bool                  DispatchMoveEvent(int32_t aX, int32_t aY);
   bool                  DispatchResizeEvent(int32_t aClientX, 
                                             int32_t aClientY);
   bool                  DispatchMouseEvent(uint32_t aEventType,
                                            MPARAM mp1, MPARAM mp2, 
                                            bool aIsContextMenuKey = false,
-                                           int16_t aButton = nsMouseEvent::eLeftButton);
+                                           int16_t aButton = mozilla::WidgetMouseEvent::eLeftButton);
   bool                  DispatchActivationEvent(uint32_t aEventType);
   bool                  DispatchScrollEvent(ULONG msg, MPARAM mp1, MPARAM mp2);
 
   friend MRESULT EXPENTRY fnwpNSWindow(HWND hwnd, ULONG msg,
                                        MPARAM mp1, MPARAM mp2);
   friend MRESULT EXPENTRY fnwpFrame(HWND hwnd, ULONG msg,
                                     MPARAM mp1, MPARAM mp2);
   friend class os2FrameWindow;
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -1239,30 +1239,30 @@ nsWindow::OnCloseEvent(QCloseEvent *aEve
         return nsEventStatus_eIgnore;
     mWidgetListener->RequestWindowClose(this);
     return nsEventStatus_eConsumeNoDefault;
 }
 
 nsEventStatus
 nsWindow::OnEnterNotifyEvent(QGraphicsSceneHoverEvent *aEvent)
 {
-    nsMouseEvent event(true, NS_MOUSE_ENTER, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_ENTER, this, WidgetMouseEvent::eReal);
 
     event.refPoint.x = nscoord(aEvent->pos().x());
     event.refPoint.y = nscoord(aEvent->pos().y());
 
     LOG(("OnEnterNotify: %p\n", (void *)this));
 
     return DispatchEvent(&event);
 }
 
 nsEventStatus
 nsWindow::OnLeaveNotifyEvent(QGraphicsSceneHoverEvent *aEvent)
 {
-    nsMouseEvent event(true, NS_MOUSE_EXIT, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_EXIT, this, WidgetMouseEvent::eReal);
 
     event.refPoint.x = nscoord(aEvent->pos().x());
     event.refPoint.y = nscoord(aEvent->pos().y());
 
     LOG(("OnLeaveNotify: %p\n", (void *)this));
 
     return DispatchEvent(&event);
 }
@@ -1293,18 +1293,19 @@ nsWindow::OnMotionNotifyEvent(QPointF aP
     mMoveEvent.modifiers = aModifiers;
     mMoveEvent.needDispatch = true;
     DispatchMotionToMainThread();
 
     return nsEventStatus_eIgnore;
 }
 
 void
-nsWindow::InitButtonEvent(nsMouseEvent &aMoveEvent,
-                          QGraphicsSceneMouseEvent *aEvent, int aClickCount)
+nsWindow::InitButtonEvent(WidgetMouseEvent& aMoveEvent,
+                          QGraphicsSceneMouseEvent* aEvent,
+                          int aClickCount)
 {
     aMoveEvent.refPoint.x = nscoord(aEvent->pos().x());
     aMoveEvent.refPoint.y = nscoord(aEvent->pos().y());
 
     aMoveEvent.InitBasicModifiers(aEvent->modifiers() & Qt::ControlModifier,
                                   aEvent->modifiers() & Qt::AltModifier,
                                   aEvent->modifiers() & Qt::ShiftModifier,
                                   aEvent->modifiers() & Qt::MetaModifier);
@@ -1327,39 +1328,40 @@ nsWindow::OnButtonPressEvent(QGraphicsSc
         pos = mWidget->mapToParent(pos);
 
     if (CheckForRollup( pos.x(), pos.y(), false))
         return nsEventStatus_eIgnore;
 
     uint16_t      domButton;
     switch (aEvent->button()) {
     case Qt::MidButton:
-        domButton = nsMouseEvent::eMiddleButton;
+        domButton = WidgetMouseEvent::eMiddleButton;
         break;
     case Qt::RightButton:
-        domButton = nsMouseEvent::eRightButton;
+        domButton = WidgetMouseEvent::eRightButton;
         break;
     default:
-        domButton = nsMouseEvent::eLeftButton;
+        domButton = WidgetMouseEvent::eLeftButton;
         break;
     }
 
-    nsMouseEvent event(true, NS_MOUSE_BUTTON_DOWN, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_BUTTON_DOWN, this,
+                           WidgetMouseEvent::eReal);
     event.button = domButton;
     InitButtonEvent(event, aEvent, 1);
 
     LOG(("%s [%p] button: %d\n", __PRETTY_FUNCTION__, (void*)this, domButton));
 
     nsEventStatus status = DispatchEvent(&event);
 
     // right menu click on linux should also pop up a context menu
-    if (domButton == nsMouseEvent::eRightButton &&
+    if (domButton == WidgetMouseEvent::eRightButton &&
         MOZ_LIKELY(!mIsDestroyed)) {
-        nsMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
-                                      nsMouseEvent::eReal);
+        WidgetMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
+                                          WidgetMouseEvent::eReal);
         InitButtonEvent(contextMenuEvent, aEvent, 1);
         DispatchEvent(&contextMenuEvent, status);
     }
 
     return status;
 }
 
 nsEventStatus
@@ -1370,55 +1372,57 @@ nsWindow::OnButtonReleaseEvent(QGraphics
 
     // The user has done something.
     UserActivity();
 
     uint16_t domButton;
 
     switch (aEvent->button()) {
     case Qt::MidButton:
-        domButton = nsMouseEvent::eMiddleButton;
+        domButton = WidgetMouseEvent::eMiddleButton;
         break;
     case Qt::RightButton:
-        domButton = nsMouseEvent::eRightButton;
+        domButton = WidgetMouseEvent::eRightButton;
         break;
     default:
-        domButton = nsMouseEvent::eLeftButton;
+        domButton = WidgetMouseEvent::eLeftButton;
         break;
     }
 
     LOG(("%s [%p] button: %d\n", __PRETTY_FUNCTION__, (void*)this, domButton));
 
-    nsMouseEvent event(true, NS_MOUSE_BUTTON_UP, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_BUTTON_UP, this,
+                           WidgetMouseEvent::eReal);
     event.button = domButton;
     InitButtonEvent(event, aEvent, 1);
 
     nsEventStatus status = DispatchEvent(&event);
 
     return status;
 }
 
 nsEventStatus
 nsWindow::OnMouseDoubleClickEvent(QGraphicsSceneMouseEvent *aEvent)
 {
     uint32_t eventType;
 
     switch (aEvent->button()) {
     case Qt::MidButton:
-        eventType = nsMouseEvent::eMiddleButton;
+        eventType = WidgetMouseEvent::eMiddleButton;
         break;
     case Qt::RightButton:
-        eventType = nsMouseEvent::eRightButton;
+        eventType = WidgetMouseEvent::eRightButton;
         break;
     default:
-        eventType = nsMouseEvent::eLeftButton;
+        eventType = WidgetMouseEvent::eLeftButton;
         break;
     }
 
-    nsMouseEvent event(true, NS_MOUSE_DOUBLECLICK, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_MOUSE_DOUBLECLICK, this,
+                           WidgetMouseEvent::eReal);
     event.button = eventType;
 
     InitButtonEvent(event, aEvent, 2);
     //pressed
     return DispatchEvent(&event);
 }
 
 nsEventStatus
@@ -1489,19 +1493,19 @@ nsWindow::OnKeyPressEvent(QKeyEvent *aEv
     if (aEvent->key() == Qt::Key_AltGr) {
         sAltGrModifier = true;
     }
 
 #ifdef MOZ_X11
     // before we dispatch a key, check if it's the context menu key.
     // If so, send a context menu key event instead.
     if (isContextMenuKeyEvent(aEvent)) {
-        nsMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
-                                      nsMouseEvent::eReal,
-                                      nsMouseEvent::eContextMenuKey);
+        WidgetMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
+                                          WidgetMouseEvent::eReal,
+                                          WidgetMouseEvent::eContextMenuKey);
         //keyEventToContextMenuEvent(&event, &contextMenuEvent);
         return DispatchEvent(&contextMenuEvent);
     }
 
     uint32_t domCharCode = 0;
     uint32_t domKeyCode = QtKeyCodeToDOMKeyCode(aEvent->key());
 
     // get keymap and modifier map from the Xserver
@@ -1794,19 +1798,19 @@ nsWindow::OnKeyPressEvent(QKeyEvent *aEv
 #else
 
     //:TODO: fix shortcuts hebrew for non X11,
     //see Bug 562195##51
 
     // before we dispatch a key, check if it's the context menu key.
     // If so, send a context menu key event instead.
     if (isContextMenuKeyEvent(aEvent)) {
-        nsMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
-                                      nsMouseEvent::eReal,
-                                      nsMouseEvent::eContextMenuKey);
+        WidgetMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
+                                          WidgetMouseEvent::eReal,
+                                          WidgetMouseEvent::eContextMenuKey);
         //keyEventToContextMenuEvent(&event, &contextMenuEvent);
         return DispatchEvent(&contextMenuEvent);
     }
 
     uint32_t domCharCode = 0;
     uint32_t domKeyCode = QtKeyCodeToDOMKeyCode(aEvent->key());
 
     if (aEvent->text().length() && aEvent->text()[0].isPrint())
@@ -2114,43 +2118,42 @@ nsWindow::ThemeChanged()
     NotifyThemeChanged();
 }
 
 nsEventStatus
 nsWindow::OnDragMotionEvent(QGraphicsSceneDragDropEvent *aEvent)
 {
     LOG(("nsWindow::OnDragMotionSignal\n"));
 
-    nsMouseEvent event(true, NS_DRAGDROP_OVER, 0,
-                       nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_DRAGDROP_OVER, 0, WidgetMouseEvent::eReal);
     return nsEventStatus_eIgnore;
 }
 
 nsEventStatus
 nsWindow::OnDragLeaveEvent(QGraphicsSceneDragDropEvent *aEvent)
 {
     // XXX Do we want to pass this on only if the event's subwindow is null?
     LOG(("nsWindow::OnDragLeaveSignal(%p)\n", this));
-    nsMouseEvent event(true, NS_DRAGDROP_EXIT, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_DRAGDROP_EXIT, this,
+                           WidgetMouseEvent::eReal);
 
     return DispatchEvent(&event);
 }
 
 nsEventStatus
 nsWindow::OnDragDropEvent(QGraphicsSceneDragDropEvent *aDropEvent)
 {
     if (aDropEvent->proposedAction() == Qt::CopyAction)
     {
         printf("text version of the data: %s\n", aDropEvent->mimeData()->text().toUtf8().data());
         aDropEvent->acceptProposedAction();
     }
 
     LOG(("nsWindow::OnDragDropSignal\n"));
-    nsMouseEvent event(true, NS_DRAGDROP_OVER, 0,
-                       nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_DRAGDROP_OVER, 0, WidgetMouseEvent::eReal);
     return nsEventStatus_eIgnore;
 }
 
 nsEventStatus
 nsWindow::OnDragEnter(QGraphicsSceneDragDropEvent *aDragEvent)
 {
     // Is it some format we think we can support?
     if ( aDragEvent->mimeData()->hasFormat(kURLMime)
@@ -2163,17 +2166,18 @@ nsWindow::OnDragEnter(QGraphicsSceneDrag
     {
         aDragEvent->acceptProposedAction();
     }
 
     // XXX Do we want to pass this on only if the event's subwindow is null?
 
     LOG(("nsWindow::OnDragEnter(%p)\n", this));
 
-    nsMouseEvent event(true, NS_DRAGDROP_ENTER, this, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_DRAGDROP_ENTER, this,
+                           WidgetMouseEvent::eReal);
     return DispatchEvent(&event);
 }
 
 static void
 GetBrandName(nsXPIDLString& brandName)
 {
     nsCOMPtr<nsIStringBundleService> bundleService =
         mozilla::services::GetStringBundleService();
@@ -2510,17 +2514,17 @@ nsWindow::HideWindowChrome(bool aShouldH
 
     return NS_OK;
 }
 
 //////////////////////////////////////////////////////////////////////
 // These are all of our drag and drop operations
 
 void
-nsWindow::InitDragEvent(nsMouseEvent &aEvent)
+nsWindow::InitDragEvent(WidgetMouseEvent& aEvent)
 {
     // set the keyboard modifiers
 }
 
 // This will update the drag action based on the information in the
 // drag context.
 
 /* static */
@@ -2538,18 +2542,18 @@ is_context_menu_key(const WidgetKeyboard
              !aKeyEvent.IsControl() && !aKeyEvent.IsMeta() &&
              !aKeyEvent.IsAlt()) ||
             (aKeyEvent.keyCode == NS_VK_CONTEXT_MENU && !aKeyEvent.IsShift() &&
              !aKeyEvent.IsControl() && !aKeyEvent.IsMeta() &&
              !aKeyEvent.IsAlt()));
 }
 
 void
-key_event_to_context_menu_event(nsMouseEvent &aEvent,
-                                QKeyEvent *aGdkEvent)
+key_event_to_context_menu_event(WidgetMouseEvent& aEvent,
+                                QKeyEvent* aGdkEvent)
 {
     aEvent.refPoint = LayoutDeviceIntPoint(0, 0);
     aEvent.modifiers = 0;
     aEvent.time = 0;
     aEvent.clickCount = 1;
 }
 
 // nsChildWindow class
@@ -2738,19 +2742,19 @@ nsWindow::BeginResizeDrag(WidgetGUIEvent
 {
     NS_ENSURE_ARG_POINTER(aEvent);
 
     if (aEvent->eventStructType != NS_MOUSE_EVENT) {
         // you can only begin a resize drag with a mouse event
         return NS_ERROR_INVALID_ARG;
     }
 
-    nsMouseEvent* mouse_event = static_cast<nsMouseEvent*>(aEvent);
-
-    if (mouse_event->button != nsMouseEvent::eLeftButton) {
+    WidgetMouseEvent* mouse_event = static_cast<WidgetMouseEvent*>(aEvent);
+
+    if (mouse_event->button != WidgetMouseEvent::eLeftButton) {
         // you can only begin a resize drag with the left mouse button
         return NS_ERROR_INVALID_ARG;
     }
 
     return NS_OK;
 }
 
 nsEventStatus
--- a/widget/qt/nsWindow.h
+++ b/widget/qt/nsWindow.h
@@ -308,17 +308,19 @@ private:
         Qt::KeyboardModifiers modifiers;
         bool needDispatch;
     } MozCachedMoveEvent;
 
     bool               CheckForRollup(double aMouseX, double aMouseY, bool aIsWheel);
     void*              SetupPluginPort(void);
     nsresult           SetWindowIconList(const nsTArray<nsCString> &aIconList);
     void               SetDefaultIcon(void);
-    void               InitButtonEvent(nsMouseEvent &event, QGraphicsSceneMouseEvent *aEvent, int aClickCount = 1);
+    void               InitButtonEvent(mozilla::WidgetMouseEvent& event,
+                                       QGraphicsSceneMouseEvent* aEvent,
+                                       int aClickCount = 1);
     nsEventStatus      DispatchCommandEvent(nsIAtom* aCommand);
     nsEventStatus      DispatchContentCommandEvent(int32_t aMsg);
     MozQWidget*        createQWidget(MozQWidget* parent,
                                      nsNativeWidget nativeParent,
                                      nsWidgetInitData* aInitData);
     void               SetSoftwareKeyboardState(bool aOpen, const InputContextAction& aAction);
     void               ClearCachedResources();
 
@@ -331,17 +333,17 @@ private:
 
     nsRefPtr<gfxASurface> mThebesSurface;
     nsCOMPtr<nsIIdleServiceInternal> mIdleService;
 
     bool         mIsTransparent;
 
     // all of our DND stuff
     // this is the last window that had a drag event happen on it.
-    void   InitDragEvent         (nsMouseEvent &aEvent);
+    void   InitDragEvent(mozilla::WidgetMouseEvent& aEvent);
 
     // this is everything we need to be able to fire motion events
     // repeatedly
     uint32_t mKeyDownFlags[8];
 
     /* Helper methods for DOM Key Down event suppression. */
     uint32_t* GetFlagWord32(uint32_t aKeyCode, uint32_t* aMask) {
         /* Mozilla DOM Virtual Key Code is from 0 to 224. */
@@ -382,17 +384,18 @@ private:
             distance *= 2;
             mPinchEvent.delta = distance - mPinchEvent.prevDistance;
             nsIntPoint centerPoint(mPinchEvent.centerPoint.x(), mPinchEvent.centerPoint.y());
             DispatchGestureEvent(NS_SIMPLE_GESTURE_MAGNIFY_UPDATE,
                                  0, mPinchEvent.delta, centerPoint);
             mPinchEvent.prevDistance = distance;
         }
         if (mMoveEvent.needDispatch) {
-            nsMouseEvent event(true, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
+            WidgetMouseEvent event(true, NS_MOUSE_MOVE, this,
+                                   WidgetMouseEvent::eReal);
 
             event.refPoint.x = nscoord(mMoveEvent.pos.x());
             event.refPoint.y = nscoord(mMoveEvent.pos.y());
 
             event.InitBasicModifiers(mMoveEvent.modifiers & Qt::ControlModifier,
                                      mMoveEvent.modifiers & Qt::AltModifier,
                                      mMoveEvent.modifiers & Qt::ShiftModifier,
                                      mMoveEvent.modifiers & Qt::MetaModifier);
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -150,29 +150,29 @@ ModifierKeyState::InitMouseEvent(WidgetI
                aMouseEvent.eventStructType == NS_DRAG_EVENT ||
                aMouseEvent.eventStructType == NS_SIMPLE_GESTURE_EVENT,
                "called with non-mouse event");
 
   WidgetMouseEventBase& mouseEvent =
     static_cast<WidgetMouseEventBase&>(aMouseEvent);
   mouseEvent.buttons = 0;
   if (::GetKeyState(VK_LBUTTON) < 0) {
-    mouseEvent.buttons |= nsMouseEvent::eLeftButtonFlag;
+    mouseEvent.buttons |= WidgetMouseEvent::eLeftButtonFlag;
   }
   if (::GetKeyState(VK_RBUTTON) < 0) {
-    mouseEvent.buttons |= nsMouseEvent::eRightButtonFlag;
+    mouseEvent.buttons |= WidgetMouseEvent::eRightButtonFlag;
   }
   if (::GetKeyState(VK_MBUTTON) < 0) {
-    mouseEvent.buttons |= nsMouseEvent::eMiddleButtonFlag;
+    mouseEvent.buttons |= WidgetMouseEvent::eMiddleButtonFlag;
   }
   if (::GetKeyState(VK_XBUTTON1) < 0) {
-    mouseEvent.buttons |= nsMouseEvent::e4thButtonFlag;
+    mouseEvent.buttons |= WidgetMouseEvent::e4thButtonFlag;
   }
   if (::GetKeyState(VK_XBUTTON2) < 0) {
-    mouseEvent.buttons |= nsMouseEvent::e5thButtonFlag;
+    mouseEvent.buttons |= WidgetMouseEvent::e5thButtonFlag;
   }
 }
 
 /*****************************************************************************
  * mozilla::widget::UniCharsAndModifiers
  *****************************************************************************/
 
 void
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1507,18 +1507,18 @@ nsWindow::BeginResizeDrag(WidgetGUIEvent
 {
   NS_ENSURE_ARG_POINTER(aEvent);
 
   if (aEvent->eventStructType != NS_MOUSE_EVENT) {
     // you can only begin a resize drag with a mouse event
     return NS_ERROR_INVALID_ARG;
   }
 
-  nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aEvent);
-  if (mouseEvent->button != nsMouseEvent::eLeftButton) {
+  WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(aEvent);
+  if (mouseEvent->button != WidgetMouseEvent::eLeftButton) {
     // you can only begin a resize drag with the left mouse button
     return NS_ERROR_INVALID_ARG;
   }
 
   // work out what sizemode we're talking about
   WPARAM syscommand;
   if (aVertical < 0) {
     if (aHorizontal < 0) {
@@ -3853,20 +3853,19 @@ bool nsWindow::DispatchMouseEvent(uint32
       break;
 
   } // switch
 
   nsIntPoint eventPoint;
   eventPoint.x = GET_X_LPARAM(lParam);
   eventPoint.y = GET_Y_LPARAM(lParam);
 
-  nsMouseEvent event(true, aEventType, this, nsMouseEvent::eReal,
-                     aIsContextMenuKey
-                     ? nsMouseEvent::eContextMenuKey
-                     : nsMouseEvent::eNormal);
+  WidgetMouseEvent event(true, aEventType, this, WidgetMouseEvent::eReal,
+                         aIsContextMenuKey ? WidgetMouseEvent::eContextMenuKey :
+                                             WidgetMouseEvent::eNormal);
   if (aEventType == NS_CONTEXTMENU && aIsContextMenuKey) {
     nsIntPoint zero(0, 0);
     InitEvent(event, &zero);
   } else {
     InitEvent(event, &eventPoint);
   }
 
   ModifierKeyState modifierKeyState;
@@ -3885,23 +3884,23 @@ bool nsWindow::DispatchMouseEvent(uint32
     sLastMouseMovePoint.y = mpScreen.y;
   }
 
   bool insideMovementThreshold = (DeprecatedAbs(sLastMousePoint.x - eventPoint.x) < (short)::GetSystemMetrics(SM_CXDOUBLECLK)) &&
                                    (DeprecatedAbs(sLastMousePoint.y - eventPoint.y) < (short)::GetSystemMetrics(SM_CYDOUBLECLK));
 
   BYTE eventButton;
   switch (aButton) {
-    case nsMouseEvent::eLeftButton:
+    case WidgetMouseEvent::eLeftButton:
       eventButton = VK_LBUTTON;
       break;
-    case nsMouseEvent::eMiddleButton:
+    case WidgetMouseEvent::eMiddleButton:
       eventButton = VK_MBUTTON;
       break;
-    case nsMouseEvent::eRightButton:
+    case WidgetMouseEvent::eRightButton:
       eventButton = VK_RBUTTON;
       break;
     default:
       eventButton = 0;
       break;
   }
 
   // Doubleclicks are used to set the click count, then changed to mousedowns
@@ -3930,68 +3929,69 @@ bool nsWindow::DispatchMouseEvent(uint32
     }
     // Set last Click time on MouseDown only
     sLastMouseDownTime = curMsgTime;
   }
   else if (aEventType == NS_MOUSE_MOVE && !insideMovementThreshold) {
     sLastClickCount = 0;
   }
   else if (aEventType == NS_MOUSE_EXIT) {
-    event.exit = IsTopLevelMouseExit(mWnd) ? nsMouseEvent::eTopLevel : nsMouseEvent::eChild;
+    event.exit = IsTopLevelMouseExit(mWnd) ?
+                   WidgetMouseEvent::eTopLevel : WidgetMouseEvent::eChild;
   }
   event.clickCount = sLastClickCount;
 
 #ifdef NS_DEBUG_XX
   PR_LOG(gWindowsLog, PR_LOG_ALWAYS,
          ("Msg Time: %d Click Count: %d\n", curMsgTime, event.clickCount));
 #endif
 
   NPEvent pluginEvent;
 
   switch (aEventType)
   {
     case NS_MOUSE_BUTTON_DOWN:
       switch (aButton) {
-        case nsMouseEvent::eLeftButton:
+        case WidgetMouseEvent::eLeftButton:
           pluginEvent.event = WM_LBUTTONDOWN;
           break;
-        case nsMouseEvent::eMiddleButton:
+        case WidgetMouseEvent::eMiddleButton:
           pluginEvent.event = WM_MBUTTONDOWN;
           break;
-        case nsMouseEvent::eRightButton:
+        case WidgetMouseEvent::eRightButton:
           pluginEvent.event = WM_RBUTTONDOWN;
           break;
         default:
           break;
       }
       break;
     case NS_MOUSE_BUTTON_UP:
       switch (aButton) {
-        case nsMouseEvent::eLeftButton:
+        case WidgetMouseEvent::eLeftButton:
           pluginEvent.event = WM_LBUTTONUP;
           break;
-        case nsMouseEvent::eMiddleButton:
+        case WidgetMouseEvent::eMiddleButton:
           pluginEvent.event = WM_MBUTTONUP;
           break;
-        case nsMouseEvent::eRightButton:
+        case WidgetMouseEvent::eRightButton:
           pluginEvent.event = WM_RBUTTONUP;
           break;
         default:
           break;
       }
       break;
     case NS_MOUSE_DOUBLECLICK:
       switch (aButton) {
-        case nsMouseEvent::eLeftButton:
+        case WidgetMouseEvent::eLeftButton:
           pluginEvent.event = WM_LBUTTONDBLCLK;
           break;
-        case nsMouseEvent::eMiddleButton:
+        case WidgetMouseEvent::eMiddleButton:
           pluginEvent.event = WM_MBUTTONDBLCLK;
           break;
-        case nsMouseEvent::eRightButton:
+        case WidgetMouseEvent::eRightButton:
           pluginEvent.event = WM_RBUTTONDBLCLK;
           break;
         default:
           break;
       }
       break;
     case NS_MOUSE_MOVE:
       pluginEvent.event = WM_MOUSEMOVE;
@@ -4022,23 +4022,25 @@ bool nsWindow::DispatchMouseEvent(uint32
       rect.x = 0;
       rect.y = 0;
 
       if (rect.Contains(LayoutDeviceIntPoint::ToUntyped(event.refPoint))) {
         if (sCurrentWindow == NULL || sCurrentWindow != this) {
           if ((nullptr != sCurrentWindow) && (!sCurrentWindow->mInDtor)) {
             LPARAM pos = sCurrentWindow->lParamToClient(lParamToScreen(lParam));
             sCurrentWindow->DispatchMouseEvent(NS_MOUSE_EXIT, wParam, pos, false, 
-                                               nsMouseEvent::eLeftButton, aInputSource);
+                                               WidgetMouseEvent::eLeftButton,
+                                               aInputSource);
           }
           sCurrentWindow = this;
           if (!mInDtor) {
             LPARAM pos = sCurrentWindow->lParamToClient(lParamToScreen(lParam));
             sCurrentWindow->DispatchMouseEvent(NS_MOUSE_ENTER, wParam, pos, false,
-                                               nsMouseEvent::eLeftButton, aInputSource);
+                                               WidgetMouseEvent::eLeftButton,
+                                               aInputSource);
           }
         }
       }
     } else if (aEventType == NS_MOUSE_EXIT) {
       if (sCurrentWindow == this) {
         sCurrentWindow = nullptr;
       }
     }
@@ -4860,42 +4862,45 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       mp.x      = GET_X_LPARAM(lParamScreen);
       mp.y      = GET_Y_LPARAM(lParamScreen);
       bool userMovedMouse = false;
       if ((sLastMouseMovePoint.x != mp.x) || (sLastMouseMovePoint.y != mp.y)) {
         userMovedMouse = true;
       }
 
       result = DispatchMouseEvent(NS_MOUSE_MOVE, wParam, lParam,
-                                  false, nsMouseEvent::eLeftButton, MOUSE_INPUT_SOURCE());
+                                  false, WidgetMouseEvent::eLeftButton,
+                                  MOUSE_INPUT_SOURCE());
       if (userMovedMouse) {
         DispatchPendingEvents();
       }
     }
     break;
 
     case WM_NCMOUSEMOVE:
       // If we receive a mouse move event on non-client chrome, make sure and
       // send an NS_MOUSE_EXIT event as well.
       if (mMousePresent && !sIsInMouseCapture)
         SendMessage(mWnd, WM_MOUSELEAVE, 0, 0);
     break;
 
     case WM_LBUTTONDOWN:
     {
       result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam, lParam,
-                                  false, nsMouseEvent::eLeftButton, MOUSE_INPUT_SOURCE());
+                                  false, WidgetMouseEvent::eLeftButton,
+                                  MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
     }
     break;
 
     case WM_LBUTTONUP:
     {
       result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, wParam, lParam,
-                                  false, nsMouseEvent::eLeftButton, MOUSE_INPUT_SOURCE());
+                                  false, WidgetMouseEvent::eLeftButton,
+                                  MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
     }
     break;
 
     case WM_MOUSELEAVE:
     {
       if (!mMousePresent)
         break;
@@ -4905,17 +4910,17 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       // wParam.
       WPARAM mouseState = (GetKeyState(VK_LBUTTON) ? MK_LBUTTON : 0)
         | (GetKeyState(VK_MBUTTON) ? MK_MBUTTON : 0)
         | (GetKeyState(VK_RBUTTON) ? MK_RBUTTON : 0);
       // Synthesize an event position because we don't get one from
       // WM_MOUSELEAVE.
       LPARAM pos = lParamToClient(::GetMessagePos());
       DispatchMouseEvent(NS_MOUSE_EXIT, mouseState, pos, false,
-                         nsMouseEvent::eLeftButton, MOUSE_INPUT_SOURCE());
+                         WidgetMouseEvent::eLeftButton, MOUSE_INPUT_SOURCE());
     }
     break;
 
     case WM_CONTEXTMENU:
     {
       // if the context menu is brought up from the keyboard, |lParam|
       // will be -1.
       LPARAM pos;
@@ -4927,127 +4932,152 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       }
       else
       {
         pos = lParamToClient(lParam);
       }
 
       result = DispatchMouseEvent(NS_CONTEXTMENU, wParam, pos, contextMenukey,
                                   contextMenukey ?
-                                    nsMouseEvent::eLeftButton :
-                                    nsMouseEvent::eRightButton, MOUSE_INPUT_SOURCE());
+                                    WidgetMouseEvent::eLeftButton :
+                                    WidgetMouseEvent::eRightButton,
+                                  MOUSE_INPUT_SOURCE());
       if (lParam != -1 && !result && mCustomNonClient) {
-        nsMouseEvent event(true, NS_MOUSE_MOZHITTEST, this, nsMouseEvent::eReal,
-                           nsMouseEvent::eNormal);
+        WidgetMouseEvent event(true, NS_MOUSE_MOZHITTEST, this,
+                               WidgetMouseEvent::eReal,
+                               WidgetMouseEvent::eNormal);
         event.refPoint = LayoutDeviceIntPoint(GET_X_LPARAM(pos), GET_Y_LPARAM(pos));
         event.inputSource = MOUSE_INPUT_SOURCE();
         event.mFlags.mOnlyChromeDispatch = true;
         if (DispatchWindowEvent(&event)) {
           // Blank area hit, throw up the system menu.
           DisplaySystemMenu(mWnd, mSizeMode, mIsRTL, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
           result = true;
         }
       }
     }
     break;
 
     case WM_LBUTTONDBLCLK:
-      result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, wParam, lParam, false,
-                                  nsMouseEvent::eLeftButton, MOUSE_INPUT_SOURCE());
+      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, lParam, false,
-                                  nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
+      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam,
+                                  lParam, false,
+                                  WidgetMouseEvent::eMiddleButton,
+                                  MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_MBUTTONUP:
-      result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, wParam, lParam, false,
-                                  nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
+      result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, wParam,
+                                  lParam, false,
+                                  WidgetMouseEvent::eMiddleButton,
+                                  MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_MBUTTONDBLCLK:
-      result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, wParam, lParam, false,
-                                  nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
+      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, lParamToClient(lParam), false,
-                                  nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
+      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, 0,
+                                  lParamToClient(lParam), false,
+                                  WidgetMouseEvent::eMiddleButton,
+                                  MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_NCMBUTTONUP:
-      result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, 0, lParamToClient(lParam), false,
-                                  nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
+      result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, 0,
+                                  lParamToClient(lParam), false,
+                                  WidgetMouseEvent::eMiddleButton,
+                                  MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_NCMBUTTONDBLCLK:
-      result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, 0, lParamToClient(lParam), false,
-                                  nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
+      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, lParam, false,
-                                  nsMouseEvent::eRightButton, MOUSE_INPUT_SOURCE());
+      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam,
+                                  lParam, false,
+                                  WidgetMouseEvent::eRightButton,
+                                  MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_RBUTTONUP:
-      result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, wParam, lParam, false,
-                                  nsMouseEvent::eRightButton, MOUSE_INPUT_SOURCE());
+      result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, wParam,
+                                  lParam, false,
+                                  WidgetMouseEvent::eRightButton,
+                                  MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_RBUTTONDBLCLK:
-      result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, wParam, lParam, false,
-                                  nsMouseEvent::eRightButton, MOUSE_INPUT_SOURCE());
+      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, lParamToClient(lParam), 
-                                  false, nsMouseEvent::eRightButton,
+      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, 0,
+                                  lParamToClient(lParam), false,
+                                  WidgetMouseEvent::eRightButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_NCRBUTTONUP:
-      result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, 0, lParamToClient(lParam),
-                                  false, nsMouseEvent::eRightButton,
+      result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, 0,
+                                  lParamToClient(lParam), false,
+                                  WidgetMouseEvent::eRightButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_NCRBUTTONDBLCLK:
-      result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, 0, lParamToClient(lParam),
-                                  false, nsMouseEvent::eRightButton,
+      result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, 0,
+                                  lParamToClient(lParam), false,
+                                  WidgetMouseEvent::eRightButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_EXITSIZEMOVE:
       if (!sIsInMouseCapture) {
         NotifySizeMoveDone();
       }
       break;
 
     case WM_NCLBUTTONDBLCLK:
       DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, 0, lParamToClient(lParam),
-                         false, nsMouseEvent::eLeftButton,
+                         false, WidgetMouseEvent::eLeftButton,
                          MOUSE_INPUT_SOURCE());
       result = 
         DispatchMouseEvent(NS_MOUSE_BUTTON_UP, 0, lParamToClient(lParam),
-                           false, nsMouseEvent::eLeftButton,
+                           false, WidgetMouseEvent::eLeftButton,
                            MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_APPCOMMAND:
     {
       uint32_t appCommand = GET_APPCOMMAND_LPARAM(lParam);
       uint32_t contentCommandMessage = NS_EVENT_NULL;
@@ -5132,18 +5162,18 @@ nsWindow::ProcessMessage(UINT msg, WPARA
 
           if (mIsTopWidgetWindow)
             mLastKeyboardLayout = KeyboardLayout::GetInstance()->GetLayout();
 
         } else {
           StopFlashing();
 
           sJustGotActivate = true;
-          nsMouseEvent event(true, NS_MOUSE_ACTIVATE, this,
-                             nsMouseEvent::eReal);
+          WidgetMouseEvent event(true, NS_MOUSE_ACTIVATE, this,
+                                 WidgetMouseEvent::eReal);
           InitEvent(event);
           ModifierKeyState modifierKeyState;
           modifierKeyState.InitInputEvent(event);
           DispatchWindowEvent(&event);
           if (sSwitchKeyboardLayout && mLastKeyboardLayout)
             ActivateKeyboardLayout(mLastKeyboardLayout, 0);
         }
       }
@@ -5619,18 +5649,19 @@ nsWindow::ClientMarginHitTestPoint(int32
 
   if (!sIsInMouseCapture && allowContentOverride) {
     POINT pt = { mx, my };
     ::ScreenToClient(mWnd, &pt);
     if (pt.x == mCachedHitTestPoint.x && pt.y == mCachedHitTestPoint.y &&
         TimeStamp::Now() - mCachedHitTestTime < TimeDuration::FromMilliseconds(HITTEST_CACHE_LIFETIME_MS)) {
       testResult = mCachedHitTestResult;
     } else {
-      nsMouseEvent event(true, NS_MOUSE_MOZHITTEST, this, nsMouseEvent::eReal,
-                         nsMouseEvent::eNormal);
+      WidgetMouseEvent event(true, NS_MOUSE_MOZHITTEST, this,
+                             WidgetMouseEvent::eReal,
+                             WidgetMouseEvent::eNormal);
       event.refPoint = LayoutDeviceIntPoint(pt.x, pt.y);
       event.inputSource = MOUSE_INPUT_SOURCE();
       event.mFlags.mOnlyChromeDispatch = true;
       bool result = DispatchWindowEvent(&event);
       if (result) {
         // The mouse is over a blank area
         testResult = testResult == HTCLIENT ? HTCAPTION : testResult;
 
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -202,17 +202,17 @@ public:
   virtual void            EndRemoteDrawing() MOZ_OVERRIDE;
 
   /**
    * Event helpers
    */
   virtual bool            DispatchMouseEvent(uint32_t aEventType, WPARAM wParam,
                                              LPARAM lParam,
                                              bool aIsContextMenuKey = false,
-                                             int16_t aButton = nsMouseEvent::eLeftButton,
+                                             int16_t aButton = mozilla::WidgetMouseEvent::eLeftButton,
                                              uint16_t aInputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE);
   virtual bool            DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent,
                                               nsEventStatus& aStatus);
   void                    DispatchPendingEvents();
   bool                    DispatchPluginEvent(UINT aMessage,
                                               WPARAM aWParam,
                                               LPARAM aLParam,
                                               bool aDispatchPendingEvents);
--- a/widget/windows/winrt/MetroInput.cpp
+++ b/widget/windows/winrt/MetroInput.cpp
@@ -353,48 +353,46 @@ MetroInput::OnEdgeGestureCompleted(UI::I
 void
 MetroInput::OnPointerNonTouch(UI::Input::IPointerPoint* aPoint) {
   WRL::ComPtr<UI::Input::IPointerPointProperties> props;
   UI::Input::PointerUpdateKind pointerUpdateKind;
 
   aPoint->get_Properties(props.GetAddressOf());
   props->get_PointerUpdateKind(&pointerUpdateKind);
 
-  nsMouseEvent* event =
-    new nsMouseEvent(true,
-                     NS_MOUSE_MOVE,
-                     mWidget.Get(),
-                     nsMouseEvent::eReal,
-                     nsMouseEvent::eNormal);
+  WidgetMouseEvent* event =
+    new WidgetMouseEvent(true, NS_MOUSE_MOVE, mWidget.Get(),
+                         WidgetMouseEvent::eReal,
+                         WidgetMouseEvent::eNormal);
 
   switch (pointerUpdateKind) {
     case UI::Input::PointerUpdateKind::PointerUpdateKind_LeftButtonPressed:
       // We don't bother setting mouseEvent.button because it is already
-      // set to nsMouseEvent::buttonType::eLeftButton whose value is 0.
+      // set to WidgetMouseEvent::buttonType::eLeftButton whose value is 0.
       event->message = NS_MOUSE_BUTTON_DOWN;
       break;
     case UI::Input::PointerUpdateKind::PointerUpdateKind_MiddleButtonPressed:
-      event->button = nsMouseEvent::buttonType::eMiddleButton;
+      event->button = WidgetMouseEvent::buttonType::eMiddleButton;
       event->message = NS_MOUSE_BUTTON_DOWN;
       break;
     case UI::Input::PointerUpdateKind::PointerUpdateKind_RightButtonPressed:
-      event->button = nsMouseEvent::buttonType::eRightButton;
+      event->button = WidgetMouseEvent::buttonType::eRightButton;
       event->message = NS_MOUSE_BUTTON_DOWN;
       break;
     case UI::Input::PointerUpdateKind::PointerUpdateKind_LeftButtonReleased:
       // We don't bother setting mouseEvent.button because it is already
-      // set to nsMouseEvent::buttonType::eLeftButton whose value is 0.
+      // set to WidgetMouseEvent::buttonType::eLeftButton whose value is 0.
       event->message = NS_MOUSE_BUTTON_UP;
       break;
     case UI::Input::PointerUpdateKind::PointerUpdateKind_MiddleButtonReleased:
-      event->button = nsMouseEvent::buttonType::eMiddleButton;
+      event->button = WidgetMouseEvent::buttonType::eMiddleButton;
       event->message = NS_MOUSE_BUTTON_UP;
       break;
     case UI::Input::PointerUpdateKind::PointerUpdateKind_RightButtonReleased:
-      event->button = nsMouseEvent::buttonType::eRightButton;
+      event->button = WidgetMouseEvent::buttonType::eRightButton;
       event->message = NS_MOUSE_BUTTON_UP;
       break;
   }
   InitGeckoMouseEventFromPointerPoint(event, aPoint);
   DispatchAsyncEventIgnoreStatus(event);
 }
 
 void
@@ -656,17 +654,18 @@ MetroInput::OnPointerReleased(UI::Core::
 
 // Tests for chrome vs. content target so we know whether input coordinates need
 // to be transformed through the apz. Eventually this hit testing should move
 // into the apz (bug 918288).
 bool
 MetroInput::HitTestChrome(const LayoutDeviceIntPoint& pt)
 {
   // Confirm this event targets content. We pick this up in browser's input.js.
-  nsMouseEvent hittest(true, NS_MOUSE_MOZHITTEST, mWidget.Get(), nsMouseEvent::eReal, nsMouseEvent::eNormal);
+  WidgetMouseEvent hittest(true, NS_MOUSE_MOZHITTEST, mWidget.Get(),
+                           WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
   hittest.refPoint = pt;
   nsEventStatus status;
   mWidget->DispatchEvent(&hittest, status);
   return (status == nsEventStatus_eConsumeNoDefault);
 }
 
 void
 MetroInput::TransformRefPoint(const Foundation::Point& aPosition, LayoutDeviceIntPoint& aRefPointOut)
@@ -676,30 +675,28 @@ MetroInput::TransformRefPoint(const Foun
   LayoutDeviceIntPoint pt = LayoutDeviceIntPoint::FromUntyped(MetroUtils::LogToPhys(aPosition));
   aRefPointOut = pt;
   // This is currently a general contained rect hit test, it may produce a false positive for
   // overlay chrome elements.
   bool apzIntersect = mWidget->HitTestAPZC(mozilla::ScreenPoint(pt.x, pt.y));
   if (apzIntersect && HitTestChrome(pt)) {
     return;
   }
-  nsMouseEvent event(true,
-                     NS_MOUSE_MOVE,
-                     mWidget.Get(),
-                     nsMouseEvent::eReal,
-                     nsMouseEvent::eNormal);
+  WidgetMouseEvent event(true, NS_MOUSE_MOVE, mWidget.Get(),
+                         WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
   event.refPoint = aRefPointOut;
   mWidget->ApzReceiveInputEvent(&event);
   aRefPointOut = event.refPoint;
 }
 
 void
 MetroInput::InitGeckoMouseEventFromPointerPoint(
-                                  nsMouseEvent* aEvent,
-                                  UI::Input::IPointerPoint* aPointerPoint) {
+                                  WidgetMouseEvent* aEvent,
+                                  UI::Input::IPointerPoint* aPointerPoint)
+{
   NS_ASSERTION(aPointerPoint, "InitGeckoMouseEventFromPointerPoint "
                               "called with null PointerPoint!");
 
   WRL::ComPtr<UI::Input::IPointerPointProperties> props;
   WRL::ComPtr<Devices::Input::IPointerDevice> device;
   Devices::Input::PointerDeviceType deviceType;
   Foundation::Point position;
   uint64_t timestamp;
@@ -743,21 +740,19 @@ MetroInput::OnPointerEntered(UI::Core::I
 
   aArgs->get_CurrentPoint(currentPoint.GetAddressOf());
   currentPoint->get_PointerDevice(device.GetAddressOf());
   device->get_PointerDeviceType(&deviceType);
 
   // We only dispatch mouseenter and mouseexit events for mouse and pen input.
   if (deviceType !=
           Devices::Input::PointerDeviceType::PointerDeviceType_Touch) {
-    nsMouseEvent* event = new nsMouseEvent(true,
-                                           NS_MOUSE_ENTER,
-                                           mWidget.Get(),
-                                           nsMouseEvent::eReal,
-                                           nsMouseEvent::eNormal);
+    WidgetMouseEvent* event =
+      new WidgetMouseEvent(true, NS_MOUSE_ENTER, mWidget.Get(),
+                           WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
     InitGeckoMouseEventFromPointerPoint(event, currentPoint.Get());
     DispatchAsyncEventIgnoreStatus(event);
   }
   return S_OK;
 }
 
 // This event is raised when a precise pointer leaves the bounding box of
 // our window.  For touch input, this will be raised before the
@@ -776,21 +771,19 @@ MetroInput::OnPointerExited(UI::Core::IC
 
   aArgs->get_CurrentPoint(currentPoint.GetAddressOf());
   currentPoint->get_PointerDevice(device.GetAddressOf());
   device->get_PointerDeviceType(&deviceType);
 
   // We only dispatch mouseenter and mouseexit events for mouse and pen input.
   if (deviceType !=
           Devices::Input::PointerDeviceType::PointerDeviceType_Touch) {
-    nsMouseEvent* event = new nsMouseEvent(true,
-                                           NS_MOUSE_EXIT,
-                                           mWidget.Get(),
-                                           nsMouseEvent::eReal,
-                                           nsMouseEvent::eNormal);
+    WidgetMouseEvent* event =
+      new WidgetMouseEvent(true, NS_MOUSE_EXIT, mWidget.Get(),
+                           WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
     InitGeckoMouseEventFromPointerPoint(event, currentPoint.Get());
     DispatchAsyncEventIgnoreStatus(event);
   }
   return S_OK;
 }
 
 /**
  * This helper function is called by our processing of "manipulation events".
@@ -1044,61 +1037,53 @@ MetroInput::HandleSingleTap(const Founda
 #ifdef DEBUG_INPUT
   LogFunction();
 #endif
   
   LayoutDeviceIntPoint refPoint;
   TransformRefPoint(aPoint, refPoint);
 
   // send mousemove
-  nsMouseEvent* mouseEvent = new nsMouseEvent(true,
-                                              NS_MOUSE_MOVE,
-                                              mWidget.Get(),
-                                              nsMouseEvent::eReal,
-                                              nsMouseEvent::eNormal);
+  WidgetMouseEvent* mouseEvent =
+    new WidgetMouseEvent(true, NS_MOUSE_MOVE, mWidget.Get(),
+                         WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
   mouseEvent->refPoint = refPoint;
   mouseEvent->clickCount = 1;
   mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
   DispatchAsyncEventIgnoreStatus(mouseEvent);
 
   // Send the mousedown
-  mouseEvent = new nsMouseEvent(true,
-                                NS_MOUSE_BUTTON_DOWN,
-                                mWidget.Get(),
-                                nsMouseEvent::eReal,
-                                nsMouseEvent::eNormal);
+  mouseEvent =
+    new WidgetMouseEvent(true, NS_MOUSE_BUTTON_DOWN, mWidget.Get(),
+                         WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
   mouseEvent->refPoint = refPoint;
   mouseEvent->clickCount = 1;
   mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
-  mouseEvent->button = nsMouseEvent::buttonType::eLeftButton;
+  mouseEvent->button = WidgetMouseEvent::buttonType::eLeftButton;
   DispatchAsyncEventIgnoreStatus(mouseEvent);
 
-  mouseEvent = new nsMouseEvent(true,
-                                NS_MOUSE_BUTTON_UP,
-                                mWidget.Get(),
-                                nsMouseEvent::eReal,
-                                nsMouseEvent::eNormal);
+  mouseEvent =
+    new WidgetMouseEvent(true, NS_MOUSE_BUTTON_UP, mWidget.Get(),
+                         WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
   mouseEvent->refPoint = refPoint;
   mouseEvent->clickCount = 1;
   mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
-  mouseEvent->button = nsMouseEvent::buttonType::eLeftButton;
+  mouseEvent->button = WidgetMouseEvent::buttonType::eLeftButton;
   DispatchAsyncEventIgnoreStatus(mouseEvent);
 
   // Send one more mousemove to avoid getting a hover state.
   // In the Metro environment for any application, a tap does not imply a
   // mouse cursor move.  In desktop environment for any application a tap
   // does imply a cursor move.
   POINT point;
   if (GetCursorPos(&point)) {
     ScreenToClient((HWND)mWidget->GetNativeData(NS_NATIVE_WINDOW), &point);
-    mouseEvent = new nsMouseEvent(true,
-                                  NS_MOUSE_MOVE,
-                                  mWidget.Get(),
-                                  nsMouseEvent::eReal,
-                                  nsMouseEvent::eNormal);
+    mouseEvent =
+      new WidgetMouseEvent(true, NS_MOUSE_MOVE, mWidget.Get(),
+                           WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
     mouseEvent->refPoint = LayoutDeviceIntPoint(point.x, point.y);
     mouseEvent->clickCount = 1;
     mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
     DispatchAsyncEventIgnoreStatus(mouseEvent);
   }
 
 }
 
@@ -1106,21 +1091,19 @@ void
 MetroInput::HandleLongTap(const Foundation::Point& aPoint)
 {
 #ifdef DEBUG_INPUT
   LogFunction();
 #endif
   LayoutDeviceIntPoint refPoint;
   TransformRefPoint(aPoint, refPoint);
 
-  nsMouseEvent* contextEvent = new nsMouseEvent(true,
-                                                NS_CONTEXTMENU,
-                                                mWidget.Get(),
-                                                nsMouseEvent::eReal,
-                                                nsMouseEvent::eNormal);
+  WidgetMouseEvent* contextEvent =
+    new WidgetMouseEvent(true, NS_CONTEXTMENU, mWidget.Get(),
+                         WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
   contextEvent->refPoint = refPoint;
   contextEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
   DispatchAsyncEventIgnoreStatus(contextEvent);
 }
 
 /**
  * Implementation Details
  */
--- a/widget/windows/winrt/MetroInput.h
+++ b/widget/windows/winrt/MetroInput.h
@@ -163,17 +163,17 @@ private:
   bool mChromeHitTestCacheForTouch;
   bool HitTestChrome(const LayoutDeviceIntPoint& pt);
 
   // Event processing helpers.  See function definitions for more info.
   void TransformRefPoint(const Point& aPosition,
                          LayoutDeviceIntPoint& aRefPointOut);
   void OnPointerNonTouch(IPointerPoint* aPoint);
   void AddPointerMoveDataToRecognizer(IPointerEventArgs* aArgs);
-  void InitGeckoMouseEventFromPointerPoint(nsMouseEvent* aEvent,
+  void InitGeckoMouseEventFromPointerPoint(WidgetMouseEvent* aEvent,
                                            IPointerPoint* aPoint);
   void ProcessManipulationDelta(ManipulationDelta const& aDelta,
                                 Point const& aPosition,
                                 uint32_t aMagEventType,
                                 uint32_t aRotEventType);
 
   // The W3C spec states that "whether preventDefault has been called" should
   // be tracked on a per-touchpoint basis, but it also states that touchstart
--- a/widget/xpwidgets/InputData.cpp
+++ b/widget/xpwidgets/InputData.cpp
@@ -62,27 +62,27 @@ MultiTouchInput::MultiTouchInput(const W
                          ScreenSize(radiusX, radiusY),
                          rotationAngle,
                          force);
 
     mTouches.AppendElement(data);
   }
 }
 
-// This conversion from nsMouseEvent to MultiTouchInput is needed because on
+// This conversion from WidgetMouseEvent to MultiTouchInput is needed because on
 // the B2G emulator we can only receive mouse events, but we need to be able
 // to pan correctly. To do this, we convert the events into a format that the
 // panning code can handle. This code is very limited and only supports
 // SingleTouchData. It also sends garbage for the identifier, radius, force
 // and rotation angle.
-MultiTouchInput::MultiTouchInput(const nsMouseEvent& aMouseEvent)
+MultiTouchInput::MultiTouchInput(const WidgetMouseEvent& aMouseEvent)
   : InputData(MULTITOUCH_INPUT, aMouseEvent.time)
 {
   NS_ABORT_IF_FALSE(NS_IsMainThread(),
-                    "Can only copy from nsMouseEvent on main thread");
+                    "Can only copy from WidgetMouseEvent on main thread");
   switch (aMouseEvent.message) {
   case NS_MOUSE_BUTTON_DOWN:
     mType = MULTITOUCH_START;
     break;
   case NS_MOUSE_MOVE:
     mType = MULTITOUCH_MOVE;
     break;
   case NS_MOUSE_BUTTON_UP:
--- a/widget/xpwidgets/nsBaseWidget.cpp
+++ b/widget/xpwidgets/nsBaseWidget.cpp
@@ -1407,17 +1407,17 @@ NS_IMETHODIMP
 nsBaseWidget::BeginResizeDrag(WidgetGUIEvent* aEvent,
                               int32_t aHorizontal,
                               int32_t aVertical)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsBaseWidget::BeginMoveDrag(nsMouseEvent* aEvent)
+nsBaseWidget::BeginMoveDrag(WidgetMouseEvent* aEvent)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 uint32_t
 nsBaseWidget::GetGLFrameBufferFormat()
 {
   if (mLayerManager &&
--- a/widget/xpwidgets/nsBaseWidget.h
+++ b/widget/xpwidgets/nsBaseWidget.h
@@ -171,17 +171,17 @@ public:
   NS_IMETHOD              SetIcon(const nsAString &anIconSpec);
   NS_IMETHOD              SetWindowTitlebarColor(nscolor aColor, bool aActive);
   virtual void            SetDrawsInTitlebar(bool aState) {}
   virtual bool            ShowsResizeIndicator(nsIntRect* aResizerRect);
   virtual void            FreeNativeData(void * data, uint32_t aDataType) {}
   NS_IMETHOD              BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
                                           int32_t aHorizontal,
                                           int32_t aVertical);
-  NS_IMETHOD              BeginMoveDrag(nsMouseEvent* aEvent);
+  NS_IMETHOD              BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent);
   virtual nsresult        ActivateNativeMenuItemAt(const nsAString& indexString) { return NS_ERROR_NOT_IMPLEMENTED; }
   virtual nsresult        ForceUpdateNativeMenuAt(const nsAString& indexString) { return NS_ERROR_NOT_IMPLEMENTED; }
   NS_IMETHOD              NotifyIME(NotificationToIME aNotification) MOZ_OVERRIDE { return NS_ERROR_NOT_IMPLEMENTED; }
   NS_IMETHOD              SetLayersAcceleration(bool aEnabled);
   virtual bool            GetLayersAcceleration() { return mUseLayersAcceleration; }
   virtual bool            ComputeShouldAccelerate(bool aDefault);
   NS_IMETHOD              GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState) { return NS_ERROR_NOT_IMPLEMENTED; }
   NS_IMETHOD              NotifyIMEOfTextChange(uint32_t aStart, uint32_t aOldEnd, uint32_t aNewEnd) MOZ_OVERRIDE { return NS_ERROR_NOT_IMPLEMENTED; }
--- a/xpfe/appshell/src/nsWebShellWindow.cpp
+++ b/xpfe/appshell/src/nsWebShellWindow.cpp
@@ -301,17 +301,18 @@ nsWebShellWindow::RequestWindowClose(nsI
   if (!presShell) {
     bool dying;
     MOZ_ASSERT(NS_SUCCEEDED(mDocShell->IsBeingDestroyed(&dying)) && dying,
                "No presShell, but window is not being destroyed");
   } else if (eventTarget) {
     nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
 
     nsEventStatus status = nsEventStatus_eIgnore;
-    nsMouseEvent event(true, NS_XUL_CLOSE, nullptr, nsMouseEvent::eReal);
+    WidgetMouseEvent event(true, NS_XUL_CLOSE, nullptr,
+                           WidgetMouseEvent::eReal);
     if (NS_SUCCEEDED(eventTarget->DispatchDOMEvent(&event, nullptr, presContext, &status)) &&
         status == nsEventStatus_eConsumeNoDefault)
       return false;
   }
 
   Destroy();
   return false;
 }
@@ -688,18 +689,18 @@ bool nsWebShellWindow::ExecuteCloseHandl
   if (eventTarget) {
     nsCOMPtr<nsIContentViewer> contentViewer;
     mDocShell->GetContentViewer(getter_AddRefs(contentViewer));
     if (contentViewer) {
       nsRefPtr<nsPresContext> presContext;
       contentViewer->GetPresContext(getter_AddRefs(presContext));
 
       nsEventStatus status = nsEventStatus_eIgnore;
-      nsMouseEvent event(true, NS_XUL_CLOSE, nullptr,
-                         nsMouseEvent::eReal);
+      WidgetMouseEvent event(true, NS_XUL_CLOSE, nullptr,
+                             WidgetMouseEvent::eReal);
 
       nsresult rv =
         eventTarget->DispatchDOMEvent(&event, nullptr, presContext, &status);
       if (NS_SUCCEEDED(rv) && status == nsEventStatus_eConsumeNoDefault)
         return true;
       // else fall through and return false
     }
   }