Bug 975688 part.15 Rename nsDOMMouseEvent to mozilla::dom::MouseEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 27 Feb 2014 19:51:15 +0900
changeset 189231 b3ee0a6cbd75b5f821645847534bff3e227c4d17
parent 189230 a9bc5bd8dc5a058d140dc81a67531237b7956ea0
child 189232 fa3367ca202d4a3fd607103f8115c48711bd9e55
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs975688
milestone30.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 975688 part.15 Rename nsDOMMouseEvent to mozilla::dom::MouseEvent r=smaug
dom/base/nsDOMClassInfoID.h
dom/bindings/Bindings.conf
dom/events/DragEvent.cpp
dom/events/DragEvent.h
dom/events/MouseEvent.cpp
dom/events/MouseEvent.h
dom/events/MouseScrollEvent.cpp
dom/events/MouseScrollEvent.h
dom/events/PointerEvent.cpp
dom/events/PointerEvent.h
dom/events/SimpleGestureEvent.cpp
dom/events/SimpleGestureEvent.h
dom/events/WheelEvent.cpp
dom/events/WheelEvent.h
dom/events/moz.build
dom/events/nsDOMMouseEvent.cpp
dom/events/nsDOMMouseEvent.h
js/xpconnect/src/nsDOMQS.h
--- a/dom/base/nsDOMClassInfoID.h
+++ b/dom/base/nsDOMClassInfoID.h
@@ -57,31 +57,33 @@ DOMCI_CASTABLE_NODECL_INTERFACE(mozilla:
 DOMCI_CASTABLE_INTERFACE(nsDOMEvent, nsIDOMEvent, 3, _extra)                  \
 DOMCI_CASTABLE_INTERFACE(nsIDocument, nsIDocument, 4, _extra)                 \
 DOMCI_CASTABLE_INTERFACE(nsDocument, nsIDocument, 5, _extra)                  \
 DOMCI_CASTABLE_INTERFACE(nsGenericHTMLElement, nsIContent, 6, _extra)         \
 DOMCI_CASTABLE_INTERFACE(nsHTMLDocument, nsIDocument, 7, _extra)              \
 DOMCI_CASTABLE_INTERFACE(nsStyledElement, nsStyledElement, 8, _extra)         \
 DOMCI_CASTABLE_INTERFACE(nsSVGElement, nsIContent, 9, _extra)                 \
 /* NOTE: When removing the casts below, remove the nsDOMEventBase class */    \
-DOMCI_CASTABLE_INTERFACE(nsDOMMouseEvent, nsDOMEventBase, 10, _extra)         \
+DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::MouseEvent,                     \
+                                nsDOMEventBase, 10, _extra)                   \
 DOMCI_CASTABLE_INTERFACE(nsDOMUIEvent, nsDOMEventBase, 11, _extra)            \
 DOMCI_CASTABLE_INTERFACE(nsGlobalWindow, nsIDOMEventTarget, 12, _extra)
 
 // Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
 // have been declared.
 #define DOMCI_CASTABLE_NODECL_INTERFACE(_interface, _u1, _u2, _u3) /* Nothing */
 #define DOMCI_CASTABLE_INTERFACE(_interface, _u1, _u2, _u3) class _interface;
 DOMCI_CASTABLE_INTERFACES(unused)
 #undef DOMCI_CASTABLE_INTERFACE
 #undef DOMCI_CASTABLE_NODECL_INTERFACE
 namespace mozilla {
 namespace dom {
 class Element;
 class EventTarget;
+class MouseEvent;
 } // namespace dom
 } // namespace mozilla
 
 #define DOMCI_CASTABLE_NODECL_INTERFACE DOMCI_CASTABLE_INTERFACE
 
 #ifdef MOZILLA_INTERNAL_API
 
 #define DOMCI_CLASS(_dom_class)                                               \
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -756,20 +756,16 @@ DOMInterfaces = {
     'resultNotAddRefed': [ 'enabledPlugin' ]
 },
 
 'MimeTypeArray': {
     'nativeType': 'nsMimeTypeArray',
     'resultNotAddRefed': [ 'item', 'namedItem' ]
 },
 
-'MouseEvent': {
-    'nativeType': 'nsDOMMouseEvent',
-},
-
 'MozCanvasPrintState': {
     'headerFile': 'mozilla/dom/HTMLCanvasElement.h',
     'nativeType': 'mozilla::dom::HTMLCanvasPrintState',
 },
 
 'MozChannel': [
 {
     'nativeType': 'nsIChannel',
--- a/dom/events/DragEvent.cpp
+++ b/dom/events/DragEvent.cpp
@@ -9,36 +9,36 @@
 #include "prtime.h"
 
 namespace mozilla {
 namespace dom {
 
 DragEvent::DragEvent(EventTarget* aOwner,
                      nsPresContext* aPresContext,
                      WidgetDragEvent* aEvent)
-  : nsDOMMouseEvent(aOwner, aPresContext, aEvent ? aEvent :
-                    new WidgetDragEvent(false, 0, nullptr))
+  : MouseEvent(aOwner, aPresContext,
+               aEvent ? aEvent : new WidgetDragEvent(false, 0, nullptr))
 {
   if (aEvent) {
     mEventIsInternal = false;
   }
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
     mEvent->refPoint.x = mEvent->refPoint.y = 0;
     mEvent->AsMouseEvent()->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
   }
 }
 
-NS_IMPL_ADDREF_INHERITED(DragEvent, nsDOMMouseEvent)
-NS_IMPL_RELEASE_INHERITED(DragEvent, nsDOMMouseEvent)
+NS_IMPL_ADDREF_INHERITED(DragEvent, MouseEvent)
+NS_IMPL_RELEASE_INHERITED(DragEvent, MouseEvent)
 
 NS_INTERFACE_MAP_BEGIN(DragEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMDragEvent)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
+NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
 
 void
 DragEvent::InitDragEvent(const nsAString& aType,
                          bool aCanBubble,
                          bool aCancelable,
                          nsIDOMWindow* aView,
                          int32_t aDetail,
                          int32_t aScreenX,
@@ -50,21 +50,20 @@ DragEvent::InitDragEvent(const nsAString
                          bool aShiftKey,
                          bool aMetaKey,
                          uint16_t aButton,
                          EventTarget* aRelatedTarget,
                          DataTransfer* aDataTransfer,
                          ErrorResult& aError)
 {
   aError =
-    nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
-                                    aView, aDetail, aScreenX, aScreenY,
-                                    aClientX, aClientY, aCtrlKey, aAltKey,
-                                    aShiftKey, aMetaKey, aButton,
-                                    aRelatedTarget);
+    MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
+                               aView, aDetail, aScreenX, aScreenY,
+                               aClientX, aClientY, aCtrlKey, aAltKey,
+                               aShiftKey, aMetaKey, aButton, aRelatedTarget);
   if (aError.Failed()) {
     return;
   }
 
   if (mEventIsInternal && mEvent) {
     mEvent->AsDragEvent()->dataTransfer = aDataTransfer;
   }
 }
@@ -85,20 +84,21 @@ DragEvent::InitDragEvent(const nsAString
                          bool aMetaKey,
                          uint16_t aButton,
                          nsIDOMEventTarget* aRelatedTarget,
                          nsIDOMDataTransfer* aDataTransfer)
 {
   nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(aDataTransfer);
   NS_ENSURE_ARG(dataTransfer);
 
-  nsresult rv = nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
-                  aView, aDetail, aScreenX, aScreenY, aClientX, aClientY,
-                  aCtrlKey, aAltKey, aShiftKey, aMetaKey, aButton,
-                  aRelatedTarget);
+  nsresult rv =
+    MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
+                               aScreenX, aScreenY, aClientX, aClientY,
+                               aCtrlKey, aAltKey, aShiftKey, aMetaKey, aButton,
+                               aRelatedTarget);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (mEventIsInternal && mEvent) {
     mEvent->AsDragEvent()->dataTransfer = dataTransfer;
   }
 
   return NS_OK;
 }
--- a/dom/events/DragEvent.h
+++ b/dom/events/DragEvent.h
@@ -2,38 +2,38 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_DragEvent_h_
 #define mozilla_dom_DragEvent_h_
 
 #include "nsIDOMDragEvent.h"
-#include "nsDOMMouseEvent.h"
+#include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/DragEventBinding.h"
 #include "mozilla/EventForwards.h"
 
 namespace mozilla {
 namespace dom {
 
 class DataTransfer;
 
-class DragEvent : public nsDOMMouseEvent,
+class DragEvent : public MouseEvent,
                   public nsIDOMDragEvent
 {
 public:
   DragEvent(EventTarget* aOwner,
             nsPresContext* aPresContext,
             WidgetDragEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_NSIDOMDRAGEVENT
 
-  NS_FORWARD_TO_NSDOMMOUSEEVENT
+  NS_FORWARD_TO_MOUSEEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
     return DragEventBinding::Wrap(aCx, aScope, this);
   }
 
   DataTransfer* GetDataTransfer();
rename from dom/events/nsDOMMouseEvent.cpp
rename to dom/events/MouseEvent.cpp
--- a/dom/events/nsDOMMouseEvent.cpp
+++ b/dom/events/MouseEvent.cpp
@@ -1,24 +1,25 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsDOMMouseEvent.h"
-#include "nsIContent.h"
+#include "mozilla/dom/MouseEvent.h"
+#include "mozilla/MouseEvents.h"
 #include "nsContentUtils.h"
+#include "nsIContent.h"
 #include "prtime.h"
-#include "mozilla/MouseEvents.h"
 
-using namespace mozilla;
+namespace mozilla {
+namespace dom {
 
-nsDOMMouseEvent::nsDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
-                                 nsPresContext* aPresContext,
-                                 WidgetMouseEventBase* aEvent)
+MouseEvent::MouseEvent(EventTarget* aOwner,
+                       nsPresContext* aPresContext,
+                       WidgetMouseEventBase* aEvent)
   : nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
                  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.
 
@@ -35,29 +36,39 @@ nsDOMMouseEvent::nsDOMMouseEvent(mozilla
 
   if (mouseEvent) {
     MOZ_ASSERT(mouseEvent->reason != WidgetMouseEvent::eSynthesized,
                "Don't dispatch DOM events from synthesized mouse events");
     mDetail = mouseEvent->clickCount;
   }
 }
 
-NS_IMPL_ADDREF_INHERITED(nsDOMMouseEvent, nsDOMUIEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMMouseEvent, nsDOMUIEvent)
+NS_IMPL_ADDREF_INHERITED(MouseEvent, nsDOMUIEvent)
+NS_IMPL_RELEASE_INHERITED(MouseEvent, nsDOMUIEvent)
 
-NS_INTERFACE_MAP_BEGIN(nsDOMMouseEvent)
+NS_INTERFACE_MAP_BEGIN(MouseEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
 
 NS_IMETHODIMP
-nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
-                                nsIDOMWindow* aView, int32_t aDetail, int32_t aScreenX, 
-                                int32_t aScreenY, int32_t aClientX, int32_t aClientY, 
-                                bool aCtrlKey, bool aAltKey, bool aShiftKey, 
-                                bool aMetaKey, uint16_t aButton, nsIDOMEventTarget *aRelatedTarget)
+MouseEvent::InitMouseEvent(const nsAString& aType,
+                           bool aCanBubble,
+                           bool aCancelable,
+                           nsIDOMWindow* aView,
+                           int32_t aDetail,
+                           int32_t aScreenX,
+                           int32_t aScreenY,
+                           int32_t aClientX,
+                           int32_t aClientY, 
+                           bool aCtrlKey,
+                           bool aAltKey,
+                           bool aShiftKey,
+                           bool aMetaKey,
+                           uint16_t aButton,
+                           nsIDOMEventTarget* aRelatedTarget)
 {
   nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
   NS_ENSURE_SUCCESS(rv, rv);
 
   switch(mEvent->eventStructType) {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
@@ -82,28 +93,28 @@ nsDOMMouseEvent::InitMouseEvent(const ns
     default:
        break;
   }
 
   return NS_OK;
 }   
 
 nsresult
-nsDOMMouseEvent::InitMouseEvent(const nsAString& aType,
-                                bool aCanBubble,
-                                bool aCancelable,
-                                nsIDOMWindow* aView,
-                                int32_t aDetail,
-                                int32_t aScreenX,
-                                int32_t aScreenY,
-                                int32_t aClientX,
-                                int32_t aClientY,
-                                int16_t aButton,
-                                nsIDOMEventTarget *aRelatedTarget,
-                                const nsAString& aModifiersList)
+MouseEvent::InitMouseEvent(const nsAString& aType,
+                           bool aCanBubble,
+                           bool aCancelable,
+                           nsIDOMWindow* aView,
+                           int32_t aDetail,
+                           int32_t aScreenX,
+                           int32_t aScreenY,
+                           int32_t aClientX,
+                           int32_t aClientY,
+                           int16_t aButton,
+                           nsIDOMEventTarget* aRelatedTarget,
+                           const nsAString& aModifiersList)
 {
   Modifiers modifiers = ComputeModifierState(aModifiersList);
 
   nsresult rv = InitMouseEvent(aType, aCanBubble, aCancelable, aView,
                                aDetail, aScreenX, aScreenY, aClientX, aClientY,
                                (modifiers & MODIFIER_CONTROL) != 0,
                                (modifiers & MODIFIER_ALT) != 0,
                                (modifiers & MODIFIER_SHIFT) != 0,
@@ -120,24 +131,24 @@ nsDOMMouseEvent::InitMouseEvent(const ns
     case NS_SIMPLE_GESTURE_EVENT:
       mEvent->AsInputEvent()->modifiers = modifiers;
       return NS_OK;
     default:
       MOZ_CRASH("There is no space to store the modifiers");
   }
 }
 
-already_AddRefed<nsDOMMouseEvent>
-nsDOMMouseEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
-                             const nsAString& aType,
-                             const mozilla::dom::MouseEventInit& aParam,
-                             mozilla::ErrorResult& aRv)
+already_AddRefed<MouseEvent>
+MouseEvent::Constructor(const GlobalObject& aGlobal,
+                        const nsAString& aType,
+                        const MouseEventInit& aParam,
+                        ErrorResult& aRv)
 {
-  nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
-  nsRefPtr<nsDOMMouseEvent> e = new nsDOMMouseEvent(t, nullptr, nullptr);
+  nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
+  nsRefPtr<MouseEvent> e = new MouseEvent(t, nullptr, nullptr);
   bool trusted = e->Init(t);
   e->InitMouseEvent(aType, aParam.mBubbles, aParam.mCancelable,
                     aParam.mView, aParam.mDetail, aParam.mScreenX,
                     aParam.mScreenY, aParam.mClientX, aParam.mClientY,
                     aParam.mCtrlKey, aParam.mAltKey, aParam.mShiftKey,
                     aParam.mMetaKey, aParam.mButton, aParam.mRelatedTarget,
                     aRv);
   e->SetTrusted(trusted);
@@ -154,45 +165,57 @@ nsDOMMouseEvent::Constructor(const mozil
     default:
       break;
   }
 
   return e.forget();
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
-                                  nsIDOMWindow *aView, int32_t aDetail, int32_t aScreenX,
-                                  int32_t aScreenY, int32_t aClientX, int32_t aClientY,
-                                  bool aCtrlKey, bool aAltKey, bool aShiftKey,
-                                  bool aMetaKey, uint16_t aButton, nsIDOMEventTarget *aRelatedTarget,
-                                  float aPressure, uint16_t aInputSource)
+MouseEvent::InitNSMouseEvent(const nsAString& aType,
+                             bool aCanBubble,
+                             bool aCancelable,
+                             nsIDOMWindow* aView,
+                             int32_t aDetail,
+                             int32_t aScreenX,
+                             int32_t aScreenY,
+                             int32_t aClientX,
+                             int32_t aClientY,
+                             bool aCtrlKey,
+                             bool aAltKey,
+                             bool aShiftKey,
+                             bool aMetaKey,
+                             uint16_t aButton,
+                             nsIDOMEventTarget* aRelatedTarget,
+                             float aPressure,
+                             uint16_t aInputSource)
 {
-  nsresult rv = nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
-                                                aView, aDetail, aScreenX, aScreenY,
-                                                aClientX, aClientY, aCtrlKey, aAltKey, aShiftKey,
-                                                aMetaKey, aButton, aRelatedTarget);
+  nsresult rv = MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
+                                           aView, aDetail, aScreenX, aScreenY,
+                                           aClientX, aClientY,
+                                           aCtrlKey, aAltKey, aShiftKey,
+                                           aMetaKey, aButton, aRelatedTarget);
   NS_ENSURE_SUCCESS(rv, rv);
 
   WidgetMouseEventBase* mouseEventBase = mEvent->AsMouseEventBase();
   mouseEventBase->pressure = aPressure;
   mouseEventBase->inputSource = aInputSource;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetButton(int16_t* aButton)
+MouseEvent::GetButton(int16_t* aButton)
 {
   NS_ENSURE_ARG_POINTER(aButton);
   *aButton = Button();
   return NS_OK;
 }
 
 int16_t
-nsDOMMouseEvent::Button()
+MouseEvent::Button()
 {
   switch(mEvent->eventStructType)
   {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_POINTER_EVENT:
@@ -200,52 +223,52 @@ nsDOMMouseEvent::Button()
       return mEvent->AsMouseEventBase()->button;
     default:
       NS_WARNING("Tried to get mouse button for non-mouse event!");
       return WidgetMouseEvent::eLeftButton;
   }
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetButtons(uint16_t* aButtons)
+MouseEvent::GetButtons(uint16_t* aButtons)
 {
   NS_ENSURE_ARG_POINTER(aButtons);
   *aButtons = Buttons();
   return NS_OK;
 }
 
 uint16_t
-nsDOMMouseEvent::Buttons()
+MouseEvent::Buttons()
 {
   switch(mEvent->eventStructType)
   {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_POINTER_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
       return mEvent->AsMouseEventBase()->buttons;
     default:
       MOZ_CRASH("Tried to get mouse buttons for non-mouse event!");
   }
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
+MouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
 {
   NS_ENSURE_ARG_POINTER(aRelatedTarget);
   *aRelatedTarget = GetRelatedTarget().get();
   return NS_OK;
 }
 
-already_AddRefed<mozilla::dom::EventTarget>
-nsDOMMouseEvent::GetRelatedTarget()
+already_AddRefed<EventTarget>
+MouseEvent::GetRelatedTarget()
 {
-  nsCOMPtr<mozilla::dom::EventTarget> relatedTarget;
+  nsCOMPtr<EventTarget> relatedTarget;
   switch(mEvent->eventStructType)
   {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_POINTER_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
@@ -267,192 +290,201 @@ nsDOMMouseEvent::GetRelatedTarget()
       relatedTarget = relatedTarget->GetTargetForDOMEvent();
     }
     return relatedTarget.forget();
   }
   return nullptr;
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetMozMovementX(int32_t* aMovementX)
+MouseEvent::GetMozMovementX(int32_t* aMovementX)
 {
   NS_ENSURE_ARG_POINTER(aMovementX);
   *aMovementX = MozMovementX();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetMozMovementY(int32_t* aMovementY)
+MouseEvent::GetMozMovementY(int32_t* aMovementY)
 {
   NS_ENSURE_ARG_POINTER(aMovementY);
   *aMovementY = MozMovementY();
 
   return NS_OK;
 }
 
-NS_METHOD nsDOMMouseEvent::GetScreenX(int32_t* aScreenX)
+NS_IMETHODIMP
+MouseEvent::GetScreenX(int32_t* aScreenX)
 {
   NS_ENSURE_ARG_POINTER(aScreenX);
   *aScreenX = ScreenX();
   return NS_OK;
 }
 
 int32_t
-nsDOMMouseEvent::ScreenX()
+MouseEvent::ScreenX()
 {
   return nsDOMEvent::GetScreenCoords(mPresContext,
                                      mEvent,
                                      mEvent->refPoint).x;
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetScreenY(int32_t* aScreenY)
+MouseEvent::GetScreenY(int32_t* aScreenY)
 {
   NS_ENSURE_ARG_POINTER(aScreenY);
   *aScreenY = ScreenY();
   return NS_OK;
 }
 
 int32_t
-nsDOMMouseEvent::ScreenY()
+MouseEvent::ScreenY()
 {
   return nsDOMEvent::GetScreenCoords(mPresContext,
                                      mEvent,
                                      mEvent->refPoint).y;
 }
 
 
-NS_METHOD nsDOMMouseEvent::GetClientX(int32_t* aClientX)
+NS_IMETHODIMP
+MouseEvent::GetClientX(int32_t* aClientX)
 {
   NS_ENSURE_ARG_POINTER(aClientX);
   *aClientX = ClientX();
   return NS_OK;
 }
 
 int32_t
-nsDOMMouseEvent::ClientX()
+MouseEvent::ClientX()
 {
   return nsDOMEvent::GetClientCoords(mPresContext,
                                      mEvent,
                                      mEvent->refPoint,
                                      mClientPoint).x;
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetClientY(int32_t* aClientY)
+MouseEvent::GetClientY(int32_t* aClientY)
 {
   NS_ENSURE_ARG_POINTER(aClientY);
   *aClientY = ClientY();
   return NS_OK;
 }
 
 int32_t
-nsDOMMouseEvent::ClientY()
+MouseEvent::ClientY()
 {
   return nsDOMEvent::GetClientCoords(mPresContext,
                                      mEvent,
                                      mEvent->refPoint,
                                      mClientPoint).y;
 }
 
 bool
-nsDOMMouseEvent::AltKey()
+MouseEvent::AltKey()
 {
   return mEvent->AsInputEvent()->IsAlt();
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetAltKey(bool* aIsDown)
+MouseEvent::GetAltKey(bool* aIsDown)
 {
   NS_ENSURE_ARG_POINTER(aIsDown);
   *aIsDown = AltKey();
   return NS_OK;
 }
 
 bool
-nsDOMMouseEvent::CtrlKey()
+MouseEvent::CtrlKey()
 {
   return mEvent->AsInputEvent()->IsControl();
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetCtrlKey(bool* aIsDown)
+MouseEvent::GetCtrlKey(bool* aIsDown)
 {
   NS_ENSURE_ARG_POINTER(aIsDown);
   *aIsDown = CtrlKey();
   return NS_OK;
 }
 
 bool
-nsDOMMouseEvent::ShiftKey()
+MouseEvent::ShiftKey()
 {
   return mEvent->AsInputEvent()->IsShift();
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetShiftKey(bool* aIsDown)
+MouseEvent::GetShiftKey(bool* aIsDown)
 {
   NS_ENSURE_ARG_POINTER(aIsDown);
   *aIsDown = ShiftKey();
   return NS_OK;
 }
 
 bool
-nsDOMMouseEvent::MetaKey()
+MouseEvent::MetaKey()
 {
   return mEvent->AsInputEvent()->IsMeta();
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetMetaKey(bool* aIsDown)
+MouseEvent::GetMetaKey(bool* aIsDown)
 {
   NS_ENSURE_ARG_POINTER(aIsDown);
   *aIsDown = MetaKey();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetModifierState(const nsAString& aKey,
+MouseEvent::GetModifierState(const nsAString& aKey,
                                   bool* aState)
 {
   NS_ENSURE_ARG_POINTER(aState);
 
   *aState = GetModifierState(aKey);
   return NS_OK;
 }
 
 float
-nsDOMMouseEvent::MozPressure() const
+MouseEvent::MozPressure() const
 {
   return mEvent->AsMouseEventBase()->pressure;
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetMozPressure(float* aPressure)
+MouseEvent::GetMozPressure(float* aPressure)
 {
   NS_ENSURE_ARG_POINTER(aPressure);
   *aPressure = MozPressure();
   return NS_OK;
 }
 
 uint16_t
-nsDOMMouseEvent::MozInputSource() const
+MouseEvent::MozInputSource() const
 {
   return mEvent->AsMouseEventBase()->inputSource;
 }
 
 NS_IMETHODIMP
-nsDOMMouseEvent::GetMozInputSource(uint16_t* aInputSource)
+MouseEvent::GetMozInputSource(uint16_t* aInputSource)
 {
   NS_ENSURE_ARG_POINTER(aInputSource);
   *aInputSource = MozInputSource();
   return NS_OK;
 }
 
-nsresult NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
-                             mozilla::dom::EventTarget* aOwner,
-                             nsPresContext* aPresContext,
-                             WidgetMouseEvent* aEvent)
+} // namespace dom
+} // namespace mozilla
+
+using namespace mozilla;
+using namespace mozilla::dom;
+
+nsresult
+NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
+                    EventTarget* aOwner,
+                    nsPresContext* aPresContext,
+                    WidgetMouseEvent* aEvent)
 {
-  nsDOMMouseEvent* it = new nsDOMMouseEvent(aOwner, aPresContext, aEvent);
+  MouseEvent* it = new MouseEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(it, aInstancePtrResult);
 }
rename from dom/events/nsDOMMouseEvent.h
rename to dom/events/MouseEvent.h
--- a/dom/events/nsDOMMouseEvent.h
+++ b/dom/events/MouseEvent.h
@@ -1,41 +1,44 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef nsDOMMouseEvent_h__
-#define nsDOMMouseEvent_h__
+#ifndef mozilla_dom_MouseEvent_h_
+#define mozilla_dom_MouseEvent_h_
 
 #include "nsIDOMMouseEvent.h"
 #include "nsDOMUIEvent.h"
 #include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/EventForwards.h"
 
-class nsDOMMouseEvent : public nsDOMUIEvent,
-                        public nsIDOMMouseEvent
+namespace mozilla {
+namespace dom {
+
+class MouseEvent : public nsDOMUIEvent,
+                   public nsIDOMMouseEvent
 {
 public:
-  nsDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
-                  nsPresContext* aPresContext,
-                  mozilla::WidgetMouseEventBase* aEvent);
+  MouseEvent(EventTarget* aOwner,
+             nsPresContext* aPresContext,
+             WidgetMouseEventBase* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMMouseEvent Interface
   NS_DECL_NSIDOMMOUSEEVENT
 
   // Forward to base class
   NS_FORWARD_TO_NSDOMUIEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
-    return mozilla::dom::MouseEventBinding::Wrap(aCx, aScope, this);
+    return MouseEventBinding::Wrap(aCx, aScope, this);
   }
 
   // Web IDL binding methods
   virtual uint32_t Which() MOZ_OVERRIDE
   {
     return Button() + 1;
   }
 
@@ -44,57 +47,57 @@ public:
   int32_t ClientX();
   int32_t ClientY();
   bool CtrlKey();
   bool ShiftKey();
   bool AltKey();
   bool MetaKey();
   int16_t Button();
   uint16_t Buttons();
-  already_AddRefed<mozilla::dom::EventTarget> GetRelatedTarget();
-  void InitMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
+  already_AddRefed<EventTarget> GetRelatedTarget();
+  void InitMouseEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
                       nsIDOMWindow* aView, int32_t aDetail, int32_t aScreenX,
                       int32_t aScreenY, int32_t aClientX, int32_t aClientY,
                       bool aCtrlKey, bool aAltKey, bool aShiftKey,
                       bool aMetaKey, uint16_t aButton,
-                      mozilla::dom::EventTarget *aRelatedTarget,
-                      mozilla::ErrorResult& aRv)
+                      EventTarget* aRelatedTarget, ErrorResult& aRv)
   {
     aRv = InitMouseEvent(aType, aCanBubble, aCancelable,
                          aView, aDetail, aScreenX, aScreenY,
                          aClientX, aClientY, aCtrlKey, aAltKey,
                          aShiftKey, aMetaKey, aButton,
                          aRelatedTarget);
   }
   bool GetModifierState(const nsAString& aKeyArg)
   {
     return GetModifierStateInternal(aKeyArg);
   }
-  static already_AddRefed<nsDOMMouseEvent> Constructor(const mozilla::dom::GlobalObject& aGlobal,
-                                                       const nsAString& aType,
-                                                       const mozilla::dom::MouseEventInit& aParam,
-                                                       mozilla::ErrorResult& aRv);
+  static already_AddRefed<MouseEvent> Constructor(const GlobalObject& aGlobal,
+                                                  const nsAString& aType,
+                                                  const MouseEventInit& aParam,
+                                                  ErrorResult& aRv);
   int32_t MozMovementX()
   {
     return GetMovementPoint().x;
   }
   int32_t MozMovementY()
   {
     return GetMovementPoint().y;
   }
   float MozPressure() const;
   uint16_t MozInputSource() const;
-  void InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
-                        nsIDOMWindow *aView, int32_t aDetail, int32_t aScreenX,
+  void InitNSMouseEvent(const nsAString& aType,
+                        bool aCanBubble, bool aCancelable,
+                        nsIDOMWindow* aView, int32_t aDetail, int32_t aScreenX,
                         int32_t aScreenY, int32_t aClientX, int32_t aClientY,
                         bool aCtrlKey, bool aAltKey, bool aShiftKey,
                         bool aMetaKey, uint16_t aButton,
-                        mozilla::dom::EventTarget *aRelatedTarget,
+                        EventTarget* aRelatedTarget,
                         float aPressure, uint16_t aInputSource,
-                        mozilla::ErrorResult& aRv)
+                        ErrorResult& aRv)
   {
     aRv = InitNSMouseEvent(aType, aCanBubble, aCancelable,
                            aView, aDetail, aScreenX, aScreenY,
                            aClientX, aClientY, aCtrlKey, aAltKey,
                            aShiftKey, aMetaKey, aButton,
                            aRelatedTarget, aPressure, aInputSource);
   }
 
@@ -104,17 +107,20 @@ protected:
                           bool aCancelable,
                           nsIDOMWindow* aView,
                           int32_t aDetail,
                           int32_t aScreenX,
                           int32_t aScreenY,
                           int32_t aClientX,
                           int32_t aClientY,
                           int16_t aButton,
-                          nsIDOMEventTarget *aRelatedTarget,
+                          nsIDOMEventTarget* aRelatedTarget,
                           const nsAString& aModifiersList);
 };
 
-#define NS_FORWARD_TO_NSDOMMOUSEEVENT         \
-  NS_FORWARD_NSIDOMMOUSEEVENT(nsDOMMouseEvent::) \
+} // namespace dom
+} // namespace mozilla
+
+#define NS_FORWARD_TO_MOUSEEVENT \
+  NS_FORWARD_NSIDOMMOUSEEVENT(MouseEvent::) \
   NS_FORWARD_TO_NSDOMUIEVENT
 
-#endif // nsDOMMouseEvent_h__
+#endif // mozilla_dom_MouseEvent_h_
--- a/dom/events/MouseScrollEvent.cpp
+++ b/dom/events/MouseScrollEvent.cpp
@@ -8,39 +8,38 @@
 #include "prtime.h"
 
 namespace mozilla {
 namespace dom {
 
 MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
                                    nsPresContext* aPresContext,
                                    WidgetMouseScrollEvent* aEvent)
-  : nsDOMMouseEvent(aOwner, aPresContext,
-                    aEvent ? aEvent :
-                             new WidgetMouseScrollEvent(false, 0, nullptr))
+  : MouseEvent(aOwner, aPresContext,
+               aEvent ? aEvent : 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<WidgetMouseEventBase*>(mEvent)->inputSource =
       nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
   }
 
   mDetail = mEvent->AsMouseScrollEvent()->delta;
 }
 
-NS_IMPL_ADDREF_INHERITED(MouseScrollEvent, nsDOMMouseEvent)
-NS_IMPL_RELEASE_INHERITED(MouseScrollEvent, nsDOMMouseEvent)
+NS_IMPL_ADDREF_INHERITED(MouseScrollEvent, MouseEvent)
+NS_IMPL_RELEASE_INHERITED(MouseScrollEvent, MouseEvent)
 
 NS_INTERFACE_MAP_BEGIN(MouseScrollEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMMouseScrollEvent)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
+NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
 
 NS_IMETHODIMP
 MouseScrollEvent::InitMouseScrollEvent(const nsAString& aType,
                                        bool aCanBubble,
                                        bool aCancelable,
                                        nsIDOMWindow* aView,
                                        int32_t aDetail,
                                        int32_t aScreenX,
@@ -50,19 +49,21 @@ MouseScrollEvent::InitMouseScrollEvent(c
                                        bool aCtrlKey,
                                        bool aAltKey,
                                        bool aShiftKey,
                                        bool aMetaKey,
                                        uint16_t aButton,
                                        nsIDOMEventTarget* aRelatedTarget,
                                        int32_t aAxis)
 {
-  nsresult rv = nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
-                                                aScreenX, aScreenY, aClientX, aClientY, aCtrlKey,
-                                                aAltKey, aShiftKey, aMetaKey, aButton, aRelatedTarget);
+  nsresult rv =
+    MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
+                               aScreenX, aScreenY, aClientX, aClientY,
+                               aCtrlKey, aAltKey, aShiftKey, aMetaKey, aButton,
+                               aRelatedTarget);
   NS_ENSURE_SUCCESS(rv, rv);
   mEvent->AsMouseScrollEvent()->isHorizontal = (aAxis == HORIZONTAL_AXIS);
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 MouseScrollEvent::GetAxis(int32_t* aResult)
--- a/dom/events/MouseScrollEvent.h
+++ b/dom/events/MouseScrollEvent.h
@@ -2,37 +2,37 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_MouseScrollEvent_h_
 #define mozilla_dom_MouseScrollEvent_h_
 
 #include "nsIDOMMouseScrollEvent.h"
-#include "nsDOMMouseEvent.h"
+#include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/MouseScrollEventBinding.h"
 
 namespace mozilla {
 namespace dom {
 
-class MouseScrollEvent : public nsDOMMouseEvent,
+class MouseScrollEvent : public MouseEvent,
                          public nsIDOMMouseScrollEvent
 {
 public:
   MouseScrollEvent(EventTarget* aOwner,
                    nsPresContext* aPresContext,
                    WidgetMouseScrollEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMMouseScrollEvent Interface
   NS_DECL_NSIDOMMOUSESCROLLEVENT
 
   // Forward to base class
-  NS_FORWARD_TO_NSDOMMOUSEEVENT
+  NS_FORWARD_TO_MOUSEEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
     return MouseScrollEventBinding::Wrap(aCx, aScope, this);
   }
 
   int32_t Axis();
--- a/dom/events/PointerEvent.cpp
+++ b/dom/events/PointerEvent.cpp
@@ -10,17 +10,18 @@
 #include "prtime.h"
 
 namespace mozilla {
 namespace dom {
 
 PointerEvent::PointerEvent(EventTarget* aOwner,
                            nsPresContext* aPresContext,
                            WidgetPointerEvent* aEvent)
-  : nsDOMMouseEvent(aOwner, aPresContext, aEvent ? aEvent : new WidgetPointerEvent(false, 0, nullptr))
+  : MouseEvent(aOwner, aPresContext,
+               aEvent ? aEvent : new WidgetPointerEvent(false, 0, nullptr))
 {
   NS_ASSERTION(mEvent->eventStructType == NS_POINTER_EVENT, "event type mismatch NS_POINTER_EVENT");
 
   WidgetMouseEvent* mouseEvent = mEvent->AsMouseEvent();
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
--- a/dom/events/PointerEvent.h
+++ b/dom/events/PointerEvent.h
@@ -2,25 +2,25 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * Portions Copyright 2013 Microsoft Open Technologies, Inc. */
 
 #ifndef PointerEvent_h__
 #define PointerEvent_h__
 
-#include "nsDOMMouseEvent.h"
+#include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/PointerEventBinding.h"
 
 class nsPresContext;
 
 namespace mozilla {
 namespace dom {
 
-class PointerEvent : public nsDOMMouseEvent
+class PointerEvent : public MouseEvent
 {
 public:
   PointerEvent(EventTarget* aOwner,
                nsPresContext* aPresContext,
                WidgetPointerEvent* aEvent);
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
--- a/dom/events/SimpleGestureEvent.cpp
+++ b/dom/events/SimpleGestureEvent.cpp
@@ -8,39 +8,39 @@
 #include "prtime.h"
 
 namespace mozilla {
 namespace dom {
 
 SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
                                        nsPresContext* aPresContext,
                                        WidgetSimpleGestureEvent* aEvent)
-  : nsDOMMouseEvent(aOwner, aPresContext,
-                    aEvent ? aEvent :
-                             new WidgetSimpleGestureEvent(false, 0, nullptr))
+  : MouseEvent(aOwner, aPresContext,
+               aEvent ? aEvent :
+                        new WidgetSimpleGestureEvent(false, 0, nullptr))
 {
   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<WidgetMouseEventBase*>(mEvent)->inputSource =
       nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
   }
 }
 
-NS_IMPL_ADDREF_INHERITED(SimpleGestureEvent, nsDOMUIEvent)
-NS_IMPL_RELEASE_INHERITED(SimpleGestureEvent, nsDOMUIEvent)
+NS_IMPL_ADDREF_INHERITED(SimpleGestureEvent, MouseEvent)
+NS_IMPL_RELEASE_INHERITED(SimpleGestureEvent, MouseEvent)
 
 NS_INTERFACE_MAP_BEGIN(SimpleGestureEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMSimpleGestureEvent)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
+NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
 
 /* attribute unsigned long allowedDirections; */
 uint32_t
 SimpleGestureEvent::AllowedDirections()
 {
   return mEvent->AsSimpleGestureEvent()->allowedDirections;
 }
 
@@ -120,31 +120,22 @@ SimpleGestureEvent::InitSimpleGestureEve
                                            bool aMetaKeyArg,
                                            uint16_t aButton,
                                            nsIDOMEventTarget* aRelatedTarget,
                                            uint32_t aAllowedDirectionsArg,
                                            uint32_t aDirectionArg,
                                            double aDeltaArg,
                                            uint32_t aClickCountArg)
 {
-  nsresult rv = nsDOMMouseEvent::InitMouseEvent(aTypeArg,
-                                                aCanBubbleArg,
-                                                aCancelableArg,
-                                                aViewArg,
-                                                aDetailArg,
-                                                aScreenX, 
-                                                aScreenY,
-                                                aClientX,
-                                                aClientY,
-                                                aCtrlKeyArg,
-                                                aAltKeyArg,
-                                                aShiftKeyArg,
-                                                aMetaKeyArg,
-                                                aButton,
-                                                aRelatedTarget);
+  nsresult rv =
+    MouseEvent::InitMouseEvent(aTypeArg, aCanBubbleArg, aCancelableArg,
+                               aViewArg, aDetailArg,
+                               aScreenX, aScreenY, aClientX, aClientY,
+                               aCtrlKeyArg, aAltKeyArg, aShiftKeyArg,
+                               aMetaKeyArg, aButton, aRelatedTarget);
   NS_ENSURE_SUCCESS(rv, rv);
 
   WidgetSimpleGestureEvent* simpleGestureEvent = mEvent->AsSimpleGestureEvent();
   simpleGestureEvent->allowedDirections = aAllowedDirectionsArg;
   simpleGestureEvent->direction = aDirectionArg;
   simpleGestureEvent->delta = aDeltaArg;
   simpleGestureEvent->clickCount = aClickCountArg;
 
--- a/dom/events/SimpleGestureEvent.h
+++ b/dom/events/SimpleGestureEvent.h
@@ -1,39 +1,39 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_SimpleGestureEvent_h_
 #define mozilla_dom_SimpleGestureEvent_h_
 
 #include "nsIDOMSimpleGestureEvent.h"
-#include "nsDOMMouseEvent.h"
+#include "mozilla/dom/MouseEvent.h"
+#include "mozilla/dom/SimpleGestureEventBinding.h"
 #include "mozilla/EventForwards.h"
-#include "mozilla/dom/SimpleGestureEventBinding.h"
 
 class nsPresContext;
 
 namespace mozilla {
 namespace dom {
 
-class SimpleGestureEvent : public nsDOMMouseEvent,
+class SimpleGestureEvent : public MouseEvent,
                            public nsIDOMSimpleGestureEvent
 {
 public:
   SimpleGestureEvent(EventTarget* aOwner,
                      nsPresContext* aPresContext,
                      WidgetSimpleGestureEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_NSIDOMSIMPLEGESTUREEVENT
 
   // Forward to base class
-  NS_FORWARD_TO_NSDOMMOUSEEVENT
+  NS_FORWARD_TO_MOUSEEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
     return SimpleGestureEventBinding::Wrap(aCx, aScope, this);
   }
 
   uint32_t AllowedDirections();
--- a/dom/events/WheelEvent.cpp
+++ b/dom/events/WheelEvent.cpp
@@ -9,36 +9,36 @@
 #include "prtime.h"
 
 namespace mozilla {
 namespace dom {
 
 WheelEvent::WheelEvent(EventTarget* aOwner,
                        nsPresContext* aPresContext,
                        WidgetWheelEvent* aWheelEvent)
-  : nsDOMMouseEvent(aOwner, aPresContext,
-                    aWheelEvent ? aWheelEvent :
-                                  new WidgetWheelEvent(false, 0, nullptr))
+  : MouseEvent(aOwner, aPresContext,
+               aWheelEvent ? aWheelEvent :
+                             new WidgetWheelEvent(false, 0, nullptr))
 {
   if (aWheelEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
     mEvent->refPoint.x = mEvent->refPoint.y = 0;
     mEvent->AsWheelEvent()->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
   }
 }
 
-NS_IMPL_ADDREF_INHERITED(WheelEvent, nsDOMMouseEvent)
-NS_IMPL_RELEASE_INHERITED(WheelEvent, nsDOMMouseEvent)
+NS_IMPL_ADDREF_INHERITED(WheelEvent, MouseEvent)
+NS_IMPL_RELEASE_INHERITED(WheelEvent, MouseEvent)
 
 NS_INTERFACE_MAP_BEGIN(WheelEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMWheelEvent)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
+NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
 
 NS_IMETHODIMP
 WheelEvent::InitWheelEvent(const nsAString& aType,
                            bool aCanBubble,
                            bool aCancelable,
                            nsIDOMWindow* aView,
                            int32_t aDetail,
                            int32_t aScreenX,
@@ -49,20 +49,19 @@ WheelEvent::InitWheelEvent(const nsAStri
                            nsIDOMEventTarget* aRelatedTarget,
                            const nsAString& aModifiersList,
                            double aDeltaX,
                            double aDeltaY,
                            double aDeltaZ,
                            uint32_t aDeltaMode)
 {
   nsresult rv =
-    nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView,
-                                    aDetail, aScreenX, aScreenY,
-                                    aClientX, aClientY, aButton,
-                                    aRelatedTarget, aModifiersList);
+    MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
+                               aScreenX, aScreenY, aClientX, aClientY, aButton,
+                               aRelatedTarget, aModifiersList);
   NS_ENSURE_SUCCESS(rv, rv);
 
   WidgetWheelEvent* wheelEvent = mEvent->AsWheelEvent();
   wheelEvent->deltaX = aDeltaX;
   wheelEvent->deltaY = aDeltaY;
   wheelEvent->deltaZ = aDeltaZ;
   wheelEvent->deltaMode = aDeltaMode;
 
--- a/dom/events/WheelEvent.h
+++ b/dom/events/WheelEvent.h
@@ -3,38 +3,38 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_WheelEvent_h_
 #define mozilla_dom_WheelEvent_h_
 
 #include "nsIDOMWheelEvent.h"
-#include "nsDOMMouseEvent.h"
+#include "mozilla/dom/MouseEvent.h"
+#include "mozilla/dom/WheelEventBinding.h"
 #include "mozilla/EventForwards.h"
-#include "mozilla/dom/WheelEventBinding.h"
 
 namespace mozilla {
 namespace dom {
 
-class WheelEvent : public nsDOMMouseEvent,
+class WheelEvent : public MouseEvent,
                    public nsIDOMWheelEvent
 {
 public:
   WheelEvent(EventTarget* aOwner,
              nsPresContext* aPresContext,
              WidgetWheelEvent* aWheelEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMWheelEvent Interface
   NS_DECL_NSIDOMWHEELEVENT
   
   // Forward to base class
-  NS_FORWARD_TO_NSDOMMOUSEEVENT
+  NS_FORWARD_TO_MOUSEEVENT
 
   static
   already_AddRefed<WheelEvent> Constructor(const GlobalObject& aGlobal,
                                            const nsAString& aType,
                                            const WheelEventInit& aParam,
                                            ErrorResult& aRv);
 
   virtual JSObject* WrapObject(JSContext* aCx,
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -44,16 +44,17 @@ EXPORTS.mozilla.dom += [
     'DataContainerEvent.h',
     'DataTransfer.h',
     'DeviceMotionEvent.h',
     'DragEvent.h',
     'EventTarget.h',
     'FocusEvent.h',
     'KeyboardEvent.h',
     'MessageEvent.h',
+    'MouseEvent.h',
     'MouseScrollEvent.h',
     'PointerEvent.h',
     'SimpleGestureEvent.h',
     'Touch.h',
     'WheelEvent.h',
 ]
 
 if CONFIG['MOZ_WEBSPEECH']:
@@ -68,21 +69,21 @@ UNIFIED_SOURCES += [
     'DataContainerEvent.cpp',
     'DataTransfer.cpp',
     'DeviceMotionEvent.cpp',
     'DragEvent.cpp',
     'EventTarget.cpp',
     'FocusEvent.cpp',
     'KeyboardEvent.cpp',
     'MessageEvent.cpp',
+    'MouseEvent.cpp',
     'MouseScrollEvent.cpp',
     'nsAsyncDOMEvent.cpp',
     'nsContentEventHandler.cpp',
     'nsDOMEventTargetHelper.cpp',
-    'nsDOMMouseEvent.cpp',
     'nsDOMMutationEvent.cpp',
     'nsDOMNotifyAudioAvailableEvent.cpp',
     'nsDOMTextEvent.cpp',
     'nsDOMTouchEvent.cpp',
     'nsDOMTransitionEvent.cpp',
     'nsDOMXULCommandEvent.cpp',
     'nsEventDispatcher.cpp',
     'nsEventListenerService.cpp',
--- a/js/xpconnect/src/nsDOMQS.h
+++ b/js/xpconnect/src/nsDOMQS.h
@@ -12,18 +12,18 @@
 #include "mozilla/dom/HTMLImageElement.h"
 #include "mozilla/dom/HTMLOptionElement.h"
 #include "HTMLOptGroupElement.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "nsHTMLDocument.h"
 #include "nsICSSDeclaration.h"
 #include "nsSVGElement.h"
 #include "nsDOMEvent.h"
-#include "nsDOMMouseEvent.h"
 #include "nsDOMUIEvent.h"
+#include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/EventTargetBinding.h"
 #include "mozilla/dom/NodeBinding.h"
 #include "mozilla/dom/ElementBinding.h"
 #include "mozilla/dom/HTMLElementBinding.h"
 #include "mozilla/dom/DocumentBinding.h"
 #include "mozilla/dom/SVGElementBinding.h"
 #include "mozilla/dom/HTMLDocumentBinding.h"
 #include "XPCQuickStubs.h"
@@ -53,18 +53,18 @@ NEW_BINDING(mozilla::dom::EventTarget, E
 NEW_BINDING(nsINode, Node);
 NEW_BINDING(mozilla::dom::Element, Element);
 NEW_BINDING(nsGenericHTMLElement, HTMLElement);
 NEW_BINDING(nsIDocument, Document);
 NEW_BINDING(nsDocument, Document);
 NEW_BINDING(nsHTMLDocument, HTMLDocument);
 NEW_BINDING(nsSVGElement, SVGElement);
 NEW_BINDING(nsDOMEvent, Event);
-NEW_BINDING(nsDOMMouseEvent, MouseEvent);
 NEW_BINDING(nsDOMUIEvent, UIEvent);
+NEW_BINDING(mozilla::dom::MouseEvent, MouseEvent);
 
 #define DEFINE_UNWRAP_CAST(_interface, _base, _bit)                           \
 template <>                                                                   \
 MOZ_ALWAYS_INLINE bool                                                        \
 xpc_qsUnwrapThis<_interface>(JSContext *cx,                                   \
                              JS::HandleObject obj,                            \
                              _interface **ppThis,                             \
                              nsISupports **pThisRef,                          \