Bug 1446711 part 8. Get rid of nsIDOMMouseEvent. r=qdot
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 20 Mar 2018 00:16:07 -0400
changeset 408950 7a1e55aa1a6b3bacede832a123c29b7ae68fd3c3
parent 408949 3073cf6d1124f9427bd8fb71f1a6478202a6baa6
child 408951 7c62a4dbbaf33f26bbe3adda95b381f908812eb0
push id33665
push usershindli@mozilla.com
push dateTue, 20 Mar 2018 10:11:03 +0000
treeherdermozilla-central@827c686c5709 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1446711
milestone61.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 1446711 part 8. Get rid of nsIDOMMouseEvent. r=qdot MozReview-Commit-ID: 2FK1MA4LGZj
browser/modules/BrowserUsageTelemetry.jsm
devtools/client/sourceeditor/tern/browser.js
devtools/server/actors/object.js
dom/events/MouseEvent.cpp
dom/events/MouseEvent.h
dom/events/MouseScrollEvent.h
dom/events/WheelEvent.h
dom/interfaces/base/nsIDOMWindowUtils.idl
dom/interfaces/events/moz.build
dom/interfaces/events/nsIDOMMouseEvent.idl
dom/xbl/nsXBLPrototypeHandler.cpp
dom/xul/nsXULPopupListener.h
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorEventListener.cpp
editor/libeditor/EditorEventListener.h
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditor.h
editor/libeditor/HTMLEditorEventListener.cpp
editor/libeditor/HTMLEditorEventListener.h
layout/forms/nsListControlFrame.cpp
layout/xul/nsListBoxBodyFrame.cpp
layout/xul/nsSliderFrame.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
testing/marionette/event.js
widget/nsBaseDragService.h
widget/windows/WinUtils.cpp
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
--- a/browser/modules/BrowserUsageTelemetry.jsm
+++ b/browser/modules/BrowserUsageTelemetry.jsm
@@ -545,18 +545,20 @@ let BrowserUsageTelemetry = {
       "FX_SEARCHBAR_SELECTED_RESULT_METHOD",
       "none"
     );
   },
 
   _recordUrlOrSearchbarSelectedResultMethod(event, highlightedIndex, histogramID, userSelectionBehavior) {
     let histogram = Services.telemetry.getHistogramById(histogramID);
     // command events are from the one-off context menu.  Treat them as clicks.
-    let isClick = event instanceof Ci.nsIDOMMouseEvent ||
-                  (event && event.type == "command");
+    // Note that we don't care about MouseEvent subclasses here, since
+    // those are not clicks.
+    let isClick = event && (ChromeUtils.getClassName(event) == "MouseEvent" ||
+                            event.type == "command");
     let category;
     if (isClick) {
       category = "click";
     } else if (highlightedIndex >= 0) {
       switch (userSelectionBehavior) {
       case "tab":
         category = "tabEnterSelection";
         break;
--- a/devtools/client/sourceeditor/tern/browser.js
+++ b/devtools/client/sourceeditor/tern/browser.js
@@ -1689,17 +1689,17 @@ module.exports = {
     "prototype": "Event.prototype",
     "!url": "https://developer.mozilla.org/en/docs/DOM/WheelEvent",
     "!doc": "The DOM WheelEvent represents events that occur due to the user moving a mouse wheel or similar input device."
   },
   "MouseEvent": {
     "!type": "fn()",
     "prototype": "Event.prototype",
     "!url": "https://developer.mozilla.org/en/docs/DOM/MouseEvent",
-    "!doc": "The DOM MouseEvent represents events that occur due to the user interacting with a pointing device (such as a mouse). It's represented by the nsINSDOMMouseEvent interface, which extends the nsIDOMMouseEvent interface."
+    "!doc": "The DOM MouseEvent represents events that occur due to the user interacting with a pointing device (such as a mouse)."
   },
   "KeyboardEvent": {
     "!type": "fn()",
     "prototype": "Event.prototype",
     "!url": "https://developer.mozilla.org/en/docs/DOM/KeyboardEvent",
     "!doc": "KeyboardEvent objects describe a user interaction with the keyboard. Each event describes a key; the event type (keydown, keypress, or keyup) identifies what kind of activity was performed."
   },
   "HashChangeEvent": {
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -1890,17 +1890,21 @@ DebuggerServer.ObjectActorPreviewers.Obj
     };
 
     if (hooks.getGripDepth() < 2) {
       let target = obj.makeDebuggeeValue(rawObj.target);
       preview.target = hooks.createValueGrip(target);
     }
 
     let props = [];
-    if (rawObj instanceof Ci.nsIDOMMouseEvent) {
+    if (obj.class == "MouseEvent" ||
+        obj.class == "DragEvent" ||
+        obj.class == "PointerEvent" ||
+        obj.class == "SimpleGestureEvent" ||
+        obj.class == "WheelEvent") {
       props.push("buttons", "clientX", "clientY", "layerX", "layerY");
     } else if (obj.class == "KeyboardEvent") {
       let modifiers = [];
       if (rawObj.altKey) {
         modifiers.push("Alt");
       }
       if (rawObj.ctrlKey) {
         modifiers.push("Control");
--- a/dom/events/MouseEvent.cpp
+++ b/dom/events/MouseEvent.cpp
@@ -38,23 +38,16 @@ MouseEvent::MouseEvent(EventTarget* aOwn
 
   if (mouseEvent) {
     MOZ_ASSERT(mouseEvent->mReason != WidgetMouseEvent::eSynthesized,
                "Don't dispatch DOM events from synthesized mouse events");
     mDetail = mouseEvent->mClickCount;
   }
 }
 
-NS_IMPL_ADDREF_INHERITED(MouseEvent, UIEvent)
-NS_IMPL_RELEASE_INHERITED(MouseEvent, UIEvent)
-
-NS_INTERFACE_MAP_BEGIN(MouseEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
-NS_INTERFACE_MAP_END_INHERITING(UIEvent)
-
 void
 MouseEvent::InitMouseEvent(const nsAString& aType,
                            bool aCanBubble,
                            bool aCancelable,
                            nsGlobalWindowInner* aView,
                            int32_t aDetail,
                            int32_t aScreenX,
                            int32_t aScreenY,
--- a/dom/events/MouseEvent.h
+++ b/dom/events/MouseEvent.h
@@ -6,36 +6,28 @@
 
 #ifndef mozilla_dom_MouseEvent_h_
 #define mozilla_dom_MouseEvent_h_
 
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/UIEvent.h"
 #include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/EventForwards.h"
-#include "nsIDOMMouseEvent.h"
 
 namespace mozilla {
 namespace dom {
 
-class MouseEvent : public UIEvent,
-                   public nsIDOMMouseEvent
+class MouseEvent : public UIEvent
 {
 public:
   MouseEvent(EventTarget* aOwner,
              nsPresContext* aPresContext,
              WidgetMouseEventBase* aEvent);
 
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsIDOMMouseEvent Interface
-  NS_DECL_NSIDOMMOUSEEVENT
-
-  // Forward to base class
-  NS_FORWARD_TO_UIEVENT
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(MouseEvent, UIEvent)
 
   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return MouseEventBinding::Wrap(aCx, this, aGivenProto);
   }
 
   virtual MouseEvent* AsMouseEvent() override
   {
@@ -115,18 +107,14 @@ protected:
                       int16_t aButton,
                       EventTarget* aRelatedTarget,
                       const nsAString& aModifiersList);
 };
 
 } // namespace dom
 } // namespace mozilla
 
-#define NS_FORWARD_TO_MOUSEEVENT \
-  NS_FORWARD_NSIDOMMOUSEEVENT(MouseEvent::) \
-  NS_FORWARD_TO_UIEVENT
-
 already_AddRefed<mozilla::dom::MouseEvent>
 NS_NewDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
                     nsPresContext* aPresContext,
                     mozilla::WidgetMouseEvent* aEvent);
 
 #endif // mozilla_dom_MouseEvent_h_
--- a/dom/events/MouseScrollEvent.h
+++ b/dom/events/MouseScrollEvent.h
@@ -17,19 +17,16 @@ class MouseScrollEvent : public MouseEve
 {
 public:
   MouseScrollEvent(EventTarget* aOwner,
                    nsPresContext* aPresContext,
                    WidgetMouseScrollEvent* aEvent);
 
   NS_INLINE_DECL_REFCOUNTING_INHERITED(MouseScrollEvent, MouseEvent)
 
-  // Forward to base class
-  NS_FORWARD_TO_MOUSEEVENT
-
   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return MouseScrollEventBinding::Wrap(aCx, this, aGivenProto);
   }
 
   int32_t Axis();
 
   void InitMouseScrollEvent(const nsAString& aType, bool aCanBubble,
--- a/dom/events/WheelEvent.h
+++ b/dom/events/WheelEvent.h
@@ -18,19 +18,16 @@ class WheelEvent : public MouseEvent
 {
 public:
   WheelEvent(EventTarget* aOwner,
              nsPresContext* aPresContext,
              WidgetWheelEvent* aWheelEvent);
 
   NS_INLINE_DECL_REFCOUNTING_INHERITED(WheelEvent, MouseEvent)
 
-  // Forward to base class
-  NS_FORWARD_TO_MOUSEEVENT
-
   static
   already_AddRefed<WheelEvent> Constructor(const GlobalObject& aGlobal,
                                            const nsAString& aType,
                                            const WheelEventInit& aParam,
                                            ErrorResult& aRv);
 
   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -309,17 +309,17 @@ interface nsIDOMWindowUtils : nsISupport
    * @param aX x offset in CSS pixels
    * @param aY y offset in CSS pixels
    * @param aButton button to synthesize
    * @param aClickCount number of clicks that have been performed
    * @param aModifiers modifiers pressed, using constants defined as MODIFIER_*
    * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
    *                           during dispatch
    * @param aPressure touch input pressure: 0.0 -> 1.0
-   * @param aInputSourceArg input source, see nsIDOMMouseEvent for values,
+   * @param aInputSourceArg input source, see MouseEvent for values,
    *        defaults to mouse input.
    * @param aIsDOMEventSynthesized controls nsIDOMEvent.isSynthesized value
    *                               that helps identifying test related events,
    *                               defaults to true
    * @param aIsWidgetEventSynthesized controls WidgetMouseEvent.mReason value
    *                                  defaults to false (WidgetMouseEvent::eReal)
    * @param aIdentifier A unique identifier for the pointer causing the event,
    *                    defaulting to nsIDOMWindowUtils::DEFAULT_MOUSE_POINTER_ID.
--- a/dom/interfaces/events/moz.build
+++ b/dom/interfaces/events/moz.build
@@ -7,16 +7,15 @@
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM: Events")
 
 XPIDL_SOURCES += [
     'nsIDOMCustomEvent.idl',
     'nsIDOMEvent.idl',
     'nsIDOMEventListener.idl',
     'nsIDOMEventTarget.idl',
-    'nsIDOMMouseEvent.idl',
     'nsIDOMNotifyPaintEvent.idl',
     'nsIDOMNSEvent.idl',
     'nsIDOMUIEvent.idl',
 ]
 
 XPIDL_MODULE = 'dom_events'
 
deleted file mode 100644
--- a/dom/interfaces/events/nsIDOMMouseEvent.idl
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: IDL; 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 "nsIDOMUIEvent.idl"
-
-/**
- * The nsIDOMMouseEvent interface is the datatype for all mouse events
- * in the Document Object Model.
- *
- * For more information on this interface please see
- * http://www.w3.org/TR/DOM-Level-2-Events/
- */
-
-[builtinclass, uuid(5bdab8d8-7933-4c5c-b6d1-ab34481237f7)]
-interface nsIDOMMouseEvent : nsIDOMUIEvent
-{
-};
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -736,18 +736,17 @@ nsXBLPrototypeHandler::MouseEventMatched
   if (mDetail != -1 && (aMouseEvent->Button() != mDetail)) {
     return false;
   }
 
   if (mMisc != 0 && (aMouseEvent->Detail() != mMisc)) {
     return false;
   }
 
-  return ModifiersMatchMask(static_cast<nsIDOMMouseEvent*>(aMouseEvent),
-                            IgnoreModifierState());
+  return ModifiersMatchMask(aMouseEvent, IgnoreModifierState());
 }
 
 struct keyCodeData {
   const char* str;
   uint16_t strlength;
   uint16_t keycode;
 };
 
--- a/dom/xul/nsXULPopupListener.h
+++ b/dom/xul/nsXULPopupListener.h
@@ -9,17 +9,16 @@
 
 #ifndef nsXULPopupListener_h___
 #define nsXULPopupListener_h___
 
 #include "nsCOMPtr.h"
 
 #include "mozilla/dom/Element.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMMouseEvent.h"
 #include "nsIDOMEventListener.h"
 #include "nsCycleCollectionParticipant.h"
 
 namespace mozilla {
 namespace dom {
 class MouseEvent;
 } // namespace dom
 } // namespace mozilla
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -70,17 +70,16 @@
 #include "nsIAbsorbingTransaction.h"    // for nsIAbsorbingTransaction
 #include "nsAtom.h"                    // for nsAtom
 #include "nsIContent.h"                 // for nsIContent
 #include "nsIDOMDocument.h"             // for nsIDOMDocument
 #include "nsIDOMElement.h"              // for nsIDOMElement
 #include "nsIDOMEvent.h"                // for nsIDOMEvent
 #include "nsIDOMEventListener.h"        // for nsIDOMEventListener
 #include "nsIDOMEventTarget.h"          // for nsIDOMEventTarget
-#include "nsIDOMMouseEvent.h"           // for nsIDOMMouseEvent
 #include "nsIDOMNode.h"                 // for nsIDOMNode, etc.
 #include "nsIDOMNodeList.h"             // for nsIDOMNodeList
 #include "nsIDocumentStateListener.h"   // for nsIDocumentStateListener
 #include "nsIEditActionListener.h"      // for nsIEditActionListener
 #include "nsIEditorObserver.h"          // for nsIEditorObserver
 #include "nsIEditorSpellCheck.h"        // for nsIEditorSpellCheck
 #include "nsIFrame.h"                   // for nsIFrame
 #include "nsIHTMLDocument.h"            // for nsIHTMLDocument
--- a/editor/libeditor/EditorEventListener.cpp
+++ b/editor/libeditor/EditorEventListener.cpp
@@ -29,17 +29,16 @@
 #include "nsIController.h"              // for nsIController
 #include "nsID.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "mozilla/dom/DragEvent.h"
 #include "nsIDOMDocument.h"             // for nsIDOMDocument
 #include "nsIDOMEvent.h"                // for nsIDOMEvent
 #include "nsIDOMEventTarget.h"          // for nsIDOMEventTarget
-#include "nsIDOMMouseEvent.h"           // for nsIDOMMouseEvent
 #include "nsIDOMNode.h"                 // for nsIDOMNode
 #include "nsIDocument.h"                // for nsIDocument
 #include "nsIFocusManager.h"            // for nsIFocusManager
 #include "nsIFormControl.h"             // for nsIFormControl, etc.
 #include "nsINode.h"                    // for nsINode, ::NODE_IS_EDITABLE, etc.
 #include "nsIPlaintextEditor.h"         // for nsIPlaintextEditor, etc.
 #include "nsIPresShell.h"               // for nsIPresShell
 #include "nsISelectionController.h"     // for nsISelectionController, etc.
@@ -445,17 +444,17 @@ EditorEventListener::HandleEvent(nsIDOME
       if (mMouseDownOrUpConsumedByIME) {
         return NS_OK;
       }
       MouseEvent* mouseEvent = aEvent->InternalDOMEvent()->AsMouseEvent();
       return NS_WARN_IF(!mouseEvent) ? NS_OK : MouseUp(mouseEvent);
     }
     // click
     case eMouseClick: {
-      nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
+      MouseEvent* mouseEvent = aEvent->InternalDOMEvent()->AsMouseEvent();
       NS_ENSURE_TRUE(mouseEvent, NS_OK);
       // If the preceding mousedown event or mouseup event was consumed,
       // editor shouldn't handle this click event.
       if (mMouseDownOrUpConsumedByIME) {
         mMouseDownOrUpConsumedByIME = false;
         mouseEvent->AsEvent()->PreventDefault();
         return NS_OK;
       }
@@ -631,25 +630,25 @@ EditorEventListener::KeyPress(WidgetKeyb
                         nsIWidget::NativeKeyBindingsForRichTextEditor,
                         DoCommandCallback, doc)) {
     aKeyboardEvent->PreventDefault();
   }
   return NS_OK;
 }
 
 nsresult
-EditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
+EditorEventListener::MouseClick(MouseEvent* aMouseEvent)
 {
   if (NS_WARN_IF(!aMouseEvent) || DetachedFromEditor()) {
     return NS_OK;
   }
   // nothing to do if editor isn't editable or clicked on out of the editor.
   RefPtr<EditorBase> editorBase(mEditorBase);
   WidgetMouseEvent* clickEvent =
-    aMouseEvent->AsEvent()->WidgetEventPtr()->AsMouseEvent();
+    aMouseEvent->WidgetEventPtr()->AsMouseEvent();
   if (editorBase->IsReadonly() || editorBase->IsDisabled() ||
       !editorBase->IsAcceptableInputEvent(clickEvent)) {
     return NS_OK;
   }
 
   // Notifies clicking on editor to IMEStateManager even when the event was
   // consumed.
   if (EditorHasFocus()) {
@@ -676,22 +675,22 @@ EditorEventListener::MouseClick(nsIDOMMo
 
   if (clickEvent->button == 1) {
     return HandleMiddleClickPaste(aMouseEvent);
   }
   return NS_OK;
 }
 
 nsresult
-EditorEventListener::HandleMiddleClickPaste(nsIDOMMouseEvent* aMouseEvent)
+EditorEventListener::HandleMiddleClickPaste(MouseEvent* aMouseEvent)
 {
   MOZ_ASSERT(aMouseEvent);
 
   WidgetMouseEvent* clickEvent =
-    aMouseEvent->AsEvent()->WidgetEventPtr()->AsMouseEvent();
+    aMouseEvent->WidgetEventPtr()->AsMouseEvent();
   MOZ_ASSERT(!DetachedFromEditorOrDefaultPrevented(clickEvent));
 
   if (!Preferences::GetBool("middlemouse.paste", false)) {
     // Middle click paste isn't enabled.
     return NS_OK;
   }
 
   // Set the selection to the point under the mouse cursor:
--- a/editor/libeditor/EditorEventListener.h
+++ b/editor/libeditor/EditorEventListener.h
@@ -12,17 +12,16 @@
 #include "nsError.h"
 #include "nsIDOMEventListener.h"
 #include "nsISupportsImpl.h"
 #include "nscore.h"
 
 class nsCaret;
 class nsIContent;
 class nsIDOMEvent;
-class nsIDOMMouseEvent;
 class nsIPresShell;
 class nsPresContext;
 
 // X.h defines KeyPress
 #ifdef KeyPress
 #undef KeyPress
 #endif
 
@@ -65,17 +64,17 @@ protected:
   nsresult KeyUp(const WidgetKeyboardEvent* aKeyboardEvent);
 #endif
   nsresult KeyPress(WidgetKeyboardEvent* aKeyboardEvent);
   nsresult HandleChangeComposition(WidgetCompositionEvent* aCompositionEvent);
   nsresult HandleStartComposition(WidgetCompositionEvent* aCompositionEvent);
   void HandleEndComposition(WidgetCompositionEvent* aCompositionEvent);
   virtual nsresult MouseDown(dom::MouseEvent* aMouseEvent);
   virtual nsresult MouseUp(dom::MouseEvent* aMouseEvent) { return NS_OK; }
-  virtual nsresult MouseClick(nsIDOMMouseEvent* aMouseEvent);
+  virtual nsresult MouseClick(dom::MouseEvent* aMouseEvent);
   nsresult Focus(InternalFocusEvent* aFocusEvent);
   nsresult Blur(InternalFocusEvent* aBlurEvent);
   nsresult DragEnter(dom::DragEvent* aDragEvent);
   nsresult DragOver(dom::DragEvent* aDragEvent);
   nsresult DragExit(dom::DragEvent* aDragEvent);
   nsresult Drop(dom::DragEvent* aDragEvent);
 
   bool CanDrop(dom::DragEvent* aEvent);
@@ -83,17 +82,17 @@ protected:
   nsIPresShell* GetPresShell() const;
   nsPresContext* GetPresContext() const;
   nsIContent* GetFocusedRootContent();
   // Returns true if IME consumes the mouse event.
   bool NotifyIMEOfMouseButtonEvent(WidgetMouseEvent* aMouseEvent);
   bool EditorHasFocus();
   bool IsFileControlTextBox();
   bool ShouldHandleNativeKeyBindings(WidgetKeyboardEvent* aKeyboardEvent);
-  nsresult HandleMiddleClickPaste(nsIDOMMouseEvent* aMouseEvent);
+  nsresult HandleMiddleClickPaste(dom::MouseEvent* aMouseEvent);
 
   /**
    * DetachedFromEditor() returns true if editor was detached.
    * Otherwise, false.
    */
   bool DetachedFromEditor() const;
 
   /**
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -23,17 +23,16 @@
 #include "HTMLURIRefObject.h"
 #include "StyleSheetTransactions.h"
 #include "TextEditUtils.h"
 #include "TypeInState.h"
 
 #include "nsIDOMDocument.h"
 #include "nsIDocumentInlines.h"
 #include "nsIDOMEventTarget.h"
-#include "nsIDOMMouseEvent.h"
 #include "nsISelectionController.h"
 #include "nsILinkHandler.h"
 #include "nsIInlineSpellChecker.h"
 
 #include "mozilla/css/Loader.h"
 
 #include "nsIContent.h"
 #include "nsIContentIterator.h"
--- a/editor/libeditor/HTMLEditor.h
+++ b/editor/libeditor/HTMLEditor.h
@@ -34,17 +34,16 @@
 #include "nsStubMutationObserver.h"
 #include "nsTArray.h"
 
 class nsDocumentFragment;
 class nsITransferable;
 class nsIClipboard;
 class nsIDOMDocument;
 class nsIDOMElement;
-class nsIDOMMouseEvent;
 class nsILinkHandler;
 class nsTableWrapperFrame;
 class nsIDOMRange;
 class nsRange;
 class nsISelection;
 
 namespace mozilla {
 class AutoSelectionSetterAfterTableEdit;
--- a/editor/libeditor/HTMLEditorEventListener.cpp
+++ b/editor/libeditor/HTMLEditorEventListener.cpp
@@ -188,25 +188,23 @@ HTMLEditorEventListener::MouseDown(Mouse
     int32_t clientY = aMouseEvent->ClientY();
     htmlEditor->OnMouseDown(clientX, clientY, element, aMouseEvent);
   }
 
   return EditorEventListener::MouseDown(aMouseEvent);
 }
 
 nsresult
-HTMLEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
+HTMLEditorEventListener::MouseClick(MouseEvent* aMouseEvent)
 {
   if (NS_WARN_IF(DetachedFromEditor())) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsIDOMEventTarget> target;
-  nsresult rv = aMouseEvent->AsEvent()->GetTarget(getter_AddRefs(target));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nsCOMPtr<nsIDOMEventTarget> target = aMouseEvent->GetTarget();
   NS_ENSURE_TRUE(target, NS_ERROR_NULL_POINTER);
   nsCOMPtr<Element> element = do_QueryInterface(target);
   if (NS_WARN_IF(!element)) {
     return NS_ERROR_FAILURE;
   }
 
   RefPtr<HTMLEditor> htmlEditor = mEditorBase->AsHTMLEditor();
   MOZ_ASSERT(htmlEditor);
--- a/editor/libeditor/HTMLEditorEventListener.h
+++ b/editor/libeditor/HTMLEditorEventListener.h
@@ -27,14 +27,14 @@ public:
   /**
    * Connect() fails if aEditorBase isn't an HTMLEditor instance.
    */
   virtual nsresult Connect(EditorBase* aEditorBase) override;
 
 protected:
   virtual nsresult MouseDown(dom::MouseEvent* aMouseEvent) override;
   virtual nsresult MouseUp(dom::MouseEvent* aMouseEvent) override;
-  virtual nsresult MouseClick(nsIDOMMouseEvent* aMouseEvent) override;
+  virtual nsresult MouseClick(dom::MouseEvent* aMouseEvent) override;
 };
 
 } // namespace mozilla
 
 #endif // #ifndef HTMLEditorEventListener_h
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -7,17 +7,16 @@
 #include "nscore.h"
 #include "nsCOMPtr.h"
 #include "nsUnicharUtils.h"
 #include "nsListControlFrame.h"
 #include "nsCheckboxRadioFrame.h" // for COMPARE macro
 #include "nsGkAtoms.h"
 #include "nsComboboxControlFrame.h"
 #include "nsIPresShell.h"
-#include "nsIDOMMouseEvent.h"
 #include "nsIXULRuntime.h"
 #include "nsFontMetrics.h"
 #include "nsIScrollableFrame.h"
 #include "nsCSSRendering.h"
 #include "nsIDOMEventListener.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "nsContentUtils.h"
@@ -1602,17 +1601,17 @@ nsListControlFrame::CalcIntrinsicBSize(n
 //----------------------------------------------------------------------
 // nsIDOMMouseListener
 //----------------------------------------------------------------------
 nsresult
 nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
 {
   NS_ASSERTION(aMouseEvent != nullptr, "aMouseEvent is null.");
 
-  nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
+  MouseEvent* mouseEvent = aMouseEvent->InternalDOMEvent()->AsMouseEvent();
   NS_ENSURE_TRUE(mouseEvent, NS_ERROR_FAILURE);
 
   UpdateInListState(aMouseEvent);
 
   mButtonDown = false;
 
   EventStates eventStates = mContent->AsElement()->State();
   if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
@@ -1886,17 +1885,17 @@ nsListControlFrame::MouseDown(nsIDOMEven
 
 //----------------------------------------------------------------------
 // nsIDOMMouseMotionListener
 //----------------------------------------------------------------------
 nsresult
 nsListControlFrame::MouseMove(nsIDOMEvent* aMouseEvent)
 {
   NS_ASSERTION(aMouseEvent, "aMouseEvent is null.");
-  nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
+  MouseEvent* mouseEvent = aMouseEvent->InternalDOMEvent()->AsMouseEvent();
   NS_ENSURE_TRUE(mouseEvent, NS_ERROR_FAILURE);
 
   UpdateInListState(aMouseEvent);
 
   if (IsInDropDownMode()) {
     if (mComboboxFrame->IsDroppedDown()) {
       int32_t selectedIndex;
       if (NS_SUCCEEDED(GetIndexFromDOMEvent(aMouseEvent, selectedIndex))) {
--- a/layout/xul/nsListBoxBodyFrame.cpp
+++ b/layout/xul/nsListBoxBodyFrame.cpp
@@ -11,17 +11,16 @@
 #include "mozilla/MathAlgorithms.h"
 #include "nsCOMPtr.h"
 #include "nsGridRowGroupLayout.h"
 #include "nsIServiceManager.h"
 #include "nsGkAtoms.h"
 #include "nsIContent.h"
 #include "nsNameSpaceManager.h"
 #include "nsIDocument.h"
-#include "nsIDOMMouseEvent.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNodeList.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsIScrollableFrame.h"
 #include "nsScrollbarFrame.h"
 #include "nsView.h"
 #include "nsViewManager.h"
 #include "nsStyleContext.h"
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -19,17 +19,16 @@
 #include "nsIContent.h"
 #include "nsCOMPtr.h"
 #include "nsNameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsHTMLParts.h"
 #include "nsIPresShell.h"
 #include "nsCSSRendering.h"
 #include "nsIDOMEvent.h"
-#include "nsIDOMMouseEvent.h"
 #include "nsScrollbarButtonFrame.h"
 #include "nsISliderListener.h"
 #include "nsIScrollableFrame.h"
 #include "nsIScrollbarMediator.h"
 #include "nsISupportsImpl.h"
 #include "nsScrollbarFrame.h"
 #include "nsRepeatService.h"
 #include "nsBoxLayoutState.h"
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -30,17 +30,16 @@
 #include "nsGkAtoms.h"
 #include "nsCSSAnonBoxes.h"
 
 #include "gfxContext.h"
 #include "nsIContent.h"
 #include "nsStyleContext.h"
 #include "nsIBoxObject.h"
 #include "nsIDOMCustomEvent.h"
-#include "nsIDOMMouseEvent.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDocument.h"
 #ifdef MOZ_OLD_STYLE
 #include "mozilla/css/StyleRule.h"
 #endif
 #include "nsCSSRendering.h"
--- a/testing/marionette/event.js
+++ b/testing/marionette/event.js
@@ -80,17 +80,17 @@ event.DoubleClickTracker = {
   cancelTimer() {
     dblclickTimer.cancel();
   },
 };
 
 /**
  * Sends a mouse event to given target.
  *
- * @param {nsIDOMMouseEvent} mouseEvent
+ * @param {MouseEvent} mouseEvent
  *     Event to send.
  * @param {(DOMElement|string)} target
  *     Target of event.  Can either be an element or the ID of an element.
  * @param {Window=} window
  *     Window object.  Defaults to the current window.
  *
  * @throws {TypeError}
  *     If the event is unsupported.
--- a/widget/nsBaseDragService.h
+++ b/widget/nsBaseDragService.h
@@ -186,15 +186,15 @@ protected:
   // drag image.
   mozilla::CSSIntPoint mScreenPosition;
 
   // the screen position where the drag ended
   mozilla::LayoutDeviceIntPoint mEndDragPoint;
 
   uint32_t mSuppressLevel;
 
-  // The input source of the drag event. Possible values are from nsIDOMMouseEvent.
+  // The input source of the drag event. Possible values are from MouseEvent.
   uint16_t mInputSource;
 
   nsTArray<RefPtr<mozilla::dom::ContentParent>> mChildProcesses;
 };
 
 #endif // nsBaseDragService_h__
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -9,17 +9,16 @@
 #include <knownfolders.h>
 #include <winioctl.h>
 
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 #include "nsWindow.h"
 #include "nsWindowDefs.h"
 #include "KeyboardLayout.h"
-#include "nsIDOMMouseEvent.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"
 #include "mozilla/HangMonitor.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/WindowsVersion.h"
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -80,17 +80,16 @@
 
 #include "mozilla/Logging.h"
 #include "prtime.h"
 #include "prenv.h"
 
 #include "mozilla/WidgetTraceEvent.h"
 #include "nsIAppShell.h"
 #include "nsISupportsPrimitives.h"
-#include "nsIDOMMouseEvent.h"
 #include "nsIKeyEventInPluginCallback.h"
 #include "nsITheme.h"
 #include "nsIObserverService.h"
 #include "nsIScreenManager.h"
 #include "imgIContainer.h"
 #include "nsIFile.h"
 #include "nsIRollupListener.h"
 #include "nsIServiceManager.h"
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -41,17 +41,16 @@
 #include "TaskbarWindowPreview.h"
 
 #ifdef ACCESSIBILITY
 #include "oleacc.h"
 #include "mozilla/a11y/Accessible.h"
 #endif
 
 #include "nsUXThemeData.h"
-#include "nsIDOMMouseEvent.h"
 #include "nsIIdleServiceInternal.h"
 
 #include "IMMHandler.h"
 
 /**
  * Forward class definitions
  */
 
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -16,17 +16,16 @@
 #include "nsIDOMDOMRequest.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMGeoPositionError.h"
 #include "nsIDOMHTMLInputElement.h"
-#include "nsIDOMMouseEvent.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMNotifyPaintEvent.h"
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMOfflineResourceList.h"
 #include "nsIDOMParser.h"
 #include "nsIDOMRange.h"
 #include "nsIDOMScreen.h"
@@ -60,17 +59,16 @@
 #include "mozilla/dom/HTMLAreaElementBinding.h"
 #include "mozilla/dom/HTMLButtonElementBinding.h"
 #include "mozilla/dom/HTMLFrameSetElementBinding.h"
 #include "mozilla/dom/HTMLHtmlElementBinding.h"
 #include "mozilla/dom/HTMLInputElementBinding.h"
 #include "mozilla/dom/ListBoxObjectBinding.h"
 #include "mozilla/dom/MediaListBinding.h"
 #include "mozilla/dom/MessageEventBinding.h"
-#include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/dom/NodeListBinding.h"
 #include "mozilla/dom/NodeBinding.h"
 #include "mozilla/dom/NotifyPaintEventBinding.h"
 #include "mozilla/dom/EventBinding.h"
 #include "mozilla/dom/OfflineResourceListBinding.h"
 #include "mozilla/dom/PositionErrorBinding.h"
 #include "mozilla/dom/RangeBinding.h"
 #ifdef MOZ_WEBRTC
@@ -153,17 +151,16 @@ const ComponentsInterfaceShimEntry kComp
   DEFINE_SHIM(DocumentFragment),
   DEFINE_SHIM(Element),
   DEFINE_SHIM(Event),
   DEFINE_SHIM(EventTarget),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIFrameLoader, FrameLoader),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMGeoPositionError, PositionError),
   DEFINE_SHIM(HTMLInputElement),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),
-  DEFINE_SHIM(MouseEvent),
   DEFINE_SHIM(NodeList),
   DEFINE_SHIM(Node),
   DEFINE_SHIM(NotifyPaintEvent),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMNSEvent, Event),
   DEFINE_SHIM(OfflineResourceList),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMParser, DOMParser),
   DEFINE_SHIM(Range),
 #ifdef MOZ_WEBRTC