Bug 1446527 part 6. Remove nsIDOMUIEvent. r=qdot
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 26 Mar 2018 14:53:03 -0400
changeset 463587 357845bfcad250c3954292ef21e93d2db576b252
parent 463586 be7e5f1bd0a1c884106731213fc7fa352cbdf3b6
child 463588 dc93e64c63e9b158430b7e0e8f7c989bc90c1acb
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1446527
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 1446527 part 6. Remove nsIDOMUIEvent. r=qdot MozReview-Commit-ID: 7GbifGJQUtQ
dom/base/nsContentAreaDragDrop.cpp
dom/events/CompositionEvent.h
dom/events/Event.h
dom/events/InputEvent.h
dom/events/ScrollAreaEvent.h
dom/events/UIEvent.cpp
dom/events/UIEvent.h
dom/interfaces/events/moz.build
dom/interfaces/events/nsIDOMUIEvent.idl
editor/libeditor/TextEditorDataTransfer.cpp
layout/xul/nsXULPopupManager.cpp
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
--- a/dom/base/nsContentAreaDragDrop.cpp
+++ b/dom/base/nsContentAreaDragDrop.cpp
@@ -9,17 +9,16 @@
 // Local Includes
 #include "nsContentAreaDragDrop.h"
 
 // Helper Classes
 #include "nsString.h"
 
 // Interfaces needed to be included
 #include "nsCopySupport.h"
-#include "nsIDOMUIEvent.h"
 #include "nsISelection.h"
 #include "nsISelectionController.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMEvent.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMRange.h"
 #include "nsIFormControl.h"
--- a/dom/events/CompositionEvent.h
+++ b/dom/events/CompositionEvent.h
@@ -22,17 +22,16 @@ class CompositionEvent : public UIEvent
 {
 public:
   CompositionEvent(EventTarget* aOwner,
                    nsPresContext* aPresContext,
                    WidgetCompositionEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CompositionEvent, UIEvent)
-  NS_FORWARD_TO_UIEVENT
 
   static already_AddRefed<CompositionEvent> Constructor(const GlobalObject& aGlobal,
                                                         const nsAString& aType,
                                                         const CompositionEventInit& aParam,
                                                         ErrorResult& aRv);
 
   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
--- a/dom/events/Event.h
+++ b/dom/events/Event.h
@@ -34,16 +34,17 @@ class DragEvent;
 class EventTarget;
 class EventMessageAutoOverride;
 // ExtendableEvent is a ServiceWorker event that is not
 // autogenerated since it has some extra methods.
 class ExtendableEvent;
 class KeyboardEvent;
 class MouseEvent;
 class TimeEvent;
+class UIEvent;
 class WantsPopupControlCheck;
 class XULCommandEvent;
 #define GENERATED_EVENT(EventClass_) class EventClass_;
 #include "mozilla/dom/GeneratedEventList.h"
 #undef GENERATED_EVENT
 
 // Dummy class so we can cast through it to get from nsISupports to
 // Event subclasses with only two non-ambiguous static casts.
@@ -142,16 +143,22 @@ public:
 
   // MouseEvent has a non-autogeneratable initMouseEvent and other
   // non-autogeneratable methods.
   virtual MouseEvent* AsMouseEvent()
   {
     return nullptr;
   }
 
+  // UIEvent has a non-autogeneratable initUIEvent.
+  virtual UIEvent* AsUIEvent()
+  {
+    return nullptr;
+  }
+
   // nsIDOMEvent Interface
   NS_DECL_NSIDOMEVENT
 
   void InitPresContextData(nsPresContext* aPresContext);
 
   // Returns true if the event should be trusted.
   bool Init(EventTarget* aGlobal);
 
--- a/dom/events/InputEvent.h
+++ b/dom/events/InputEvent.h
@@ -18,20 +18,16 @@ class InputEvent : public UIEvent
 {
 public:
   InputEvent(EventTarget* aOwner,
              nsPresContext* aPresContext,
              InternalEditorInputEvent* aEvent);
 
   NS_INLINE_DECL_REFCOUNTING_INHERITED(InputEvent, UIEvent)
 
-  // Forward to base class
-  NS_FORWARD_TO_UIEVENT
-
-
   static already_AddRefed<InputEvent> Constructor(const GlobalObject& aGlobal,
                                                   const nsAString& aType,
                                                   const InputEventInit& aParam,
                                                   ErrorResult& aRv);
 
   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return InputEventBinding::Wrap(aCx, this, aGivenProto);
--- a/dom/events/ScrollAreaEvent.h
+++ b/dom/events/ScrollAreaEvent.h
@@ -20,17 +20,16 @@ class ScrollAreaEvent : public UIEvent
 {
 public:
   ScrollAreaEvent(EventTarget* aOwner,
                   nsPresContext* aPresContext,
                   InternalScrollAreaEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ScrollAreaEvent, UIEvent)
-  NS_FORWARD_NSIDOMUIEVENT(UIEvent::)
 
   NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION
   NS_IMETHOD DuplicatePrivateData() override
   {
     return Event::DuplicatePrivateData();
   }
   NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) override;
   NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) override;
--- a/dom/events/UIEvent.cpp
+++ b/dom/events/UIEvent.cpp
@@ -96,17 +96,16 @@ UIEvent::Constructor(const GlobalObject&
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(UIEvent, Event,
                                    mView)
 
 NS_IMPL_ADDREF_INHERITED(UIEvent, Event)
 NS_IMPL_RELEASE_INHERITED(UIEvent, Event)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(UIEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMUIEvent)
 NS_INTERFACE_MAP_END_INHERITING(Event)
 
 static nsIntPoint
 DevPixelsToCSSPixels(const LayoutDeviceIntPoint& aPoint,
                      nsPresContext* aContext)
 {
   return nsIntPoint(aContext->DevPixelsToIntCSSPixels(aPoint.x),
                     aContext->DevPixelsToIntCSSPixels(aPoint.y));
--- a/dom/events/UIEvent.h
+++ b/dom/events/UIEvent.h
@@ -6,42 +6,34 @@
 
 #ifndef mozilla_dom_UIEvent_h_
 #define mozilla_dom_UIEvent_h_
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/UIEventBinding.h"
 #include "nsDeviceContext.h"
-#include "nsIDOMUIEvent.h"
 #include "nsLayoutUtils.h"
 #include "nsPresContext.h"
 
 class nsINode;
 
 namespace mozilla {
 namespace dom {
 
-class UIEvent : public Event,
-                public nsIDOMUIEvent
+class UIEvent : public Event
 {
 public:
   UIEvent(EventTarget* aOwner,
           nsPresContext* aPresContext,
           WidgetGUIEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(UIEvent, Event)
 
-  // nsIDOMUIEvent Interface
-  NS_DECL_NSIDOMUIEVENT
-
-  // Forward to Event
-  NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION
-  using Event::GetCurrentTarget;  // Because the forwarding thing shadows it.
   NS_IMETHOD DuplicatePrivateData() override;
   NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) override;
   NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) override;
 
 
   static already_AddRefed<UIEvent> Constructor(const GlobalObject& aGlobal,
                                                const nsAString& aType,
                                                const UIEventInit& aParam,
@@ -49,16 +41,21 @@ public:
 
   virtual JSObject*
     WrapObjectInternal(JSContext* aCx,
                        JS::Handle<JSObject*> aGivenProto) override
   {
     return UIEventBinding::Wrap(aCx, this, aGivenProto);
   }
 
+  UIEvent* AsUIEvent() override
+  {
+    return this;
+  }
+
   void InitUIEvent(const nsAString& typeArg,
                    bool canBubbleArg,
                    bool cancelableArg,
                    nsGlobalWindowInner* viewArg,
                    int32_t detailArg);
 
   nsPIDOMWindowOuter* GetView() const
   {
@@ -116,36 +113,14 @@ protected:
   static Modifiers ComputeModifierState(const nsAString& aModifiersList);
   bool GetModifierStateInternal(const nsAString& aKey);
   void InitModifiers(const EventModifierInit& aParam);
 };
 
 } // namespace dom
 } // namespace mozilla
 
-#define NS_FORWARD_TO_UIEVENT                               \
-  NS_FORWARD_NSIDOMUIEVENT(UIEvent::)                       \
-  NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION       \
-  using Event::GetCurrentTarget;  /* Forwarding shadows */  \
-  using UIEvent::GetRangeParent;                            \
-  using UIEvent::RangeOffset;                               \
-  NS_IMETHOD DuplicatePrivateData() override                \
-  {                                                         \
-    return UIEvent::DuplicatePrivateData();                 \
-  }                                                         \
-  NS_IMETHOD_(void) Serialize(IPC::Message* aMsg,           \
-                              bool aSerializeInterfaceType) \
-    override                                                \
-  {                                                         \
-    UIEvent::Serialize(aMsg, aSerializeInterfaceType);      \
-  }                                                         \
-  NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg,   \
-                                PickleIterator* aIter) override \
-  {                                                         \
-    return UIEvent::Deserialize(aMsg, aIter);               \
-  }
-
 already_AddRefed<mozilla::dom::UIEvent>
 NS_NewDOMUIEvent(mozilla::dom::EventTarget* aOwner,
                  nsPresContext* aPresContext,
                  mozilla::WidgetGUIEvent* aEvent);
 
 #endif // mozilla_dom_UIEvent_h_
--- a/dom/interfaces/events/moz.build
+++ b/dom/interfaces/events/moz.build
@@ -9,13 +9,12 @@ with Files("**"):
 
 XPIDL_SOURCES += [
     'nsIDOMCustomEvent.idl',
     'nsIDOMEvent.idl',
     'nsIDOMEventListener.idl',
     'nsIDOMEventTarget.idl',
     'nsIDOMNotifyPaintEvent.idl',
     'nsIDOMNSEvent.idl',
-    'nsIDOMUIEvent.idl',
 ]
 
 XPIDL_MODULE = 'dom_events'
 
deleted file mode 100644
--- a/dom/interfaces/events/nsIDOMUIEvent.idl
+++ /dev/null
@@ -1,33 +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 "nsISupports.idl"
-#include "nsIDOMWindow.idl"
-
-interface mozIDOMWindow;
-interface mozIDOMWindowProxy;
-
-/**
- * The nsIDOMUIEvent interface is the datatype for all UI events in the
- * Document Object Model.
- *
- * For more information on this interface please see
- * http://www.w3.org/TR/DOM-Level-2-Events/
- */
-
-%{C++
-namespace mozilla {
-namespace dom {
-class Event;
-}
-}
-%}
-
-[ptr] native EventPtr(mozilla::dom::Event);
-
-[builtinclass, uuid(85ae52eb-37fa-4fd9-a2e6-c7d0f2a521b3)]
-interface nsIDOMUIEvent : nsISupports
-{
-};
--- a/editor/libeditor/TextEditorDataTransfer.cpp
+++ b/editor/libeditor/TextEditorDataTransfer.cpp
@@ -18,17 +18,16 @@
 #include "nsContentUtils.h"
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsIClipboard.h"
 #include "nsIContent.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMNode.h"
-#include "nsIDOMUIEvent.h"
 #include "nsIDocument.h"
 #include "nsIDragService.h"
 #include "nsIDragSession.h"
 #include "nsIEditor.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIPrincipal.h"
 #include "nsIFormControl.h"
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -630,19 +630,18 @@ nsXULPopupManager::InitTriggerEvent(nsID
       nsCOMPtr<nsIContent> target = do_QueryInterface(
         aEvent->InternalDOMEvent()->GetTarget());
       target.forget(aTriggerContent);
     }
   }
 
   mCachedModifiers = 0;
 
-  nsCOMPtr<nsIDOMUIEvent> domUiEvent = do_QueryInterface(aEvent);
-  if (domUiEvent) {
-    auto uiEvent = static_cast<UIEvent*>(domUiEvent.get());
+  UIEvent* uiEvent = aEvent ? aEvent->InternalDOMEvent()->AsUIEvent() : nullptr;
+  if (uiEvent) {
     mRangeParent = uiEvent->GetRangeParent();
     mRangeOffset = uiEvent->RangeOffset();
 
     // get the event coordinates relative to the root frame of the document
     // containing the popup.
     NS_ASSERTION(aPopup, "Expected a popup node");
     WidgetEvent* event = aEvent->WidgetEventPtr();
     if (event) {
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -25,17 +25,16 @@
 #include "nsIDOMNodeList.h"
 #include "nsIDOMNotifyPaintEvent.h"
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMOfflineResourceList.h"
 #include "nsIDOMParser.h"
 #include "nsIDOMRange.h"
 #include "nsIDOMScreen.h"
 #include "nsIDOMSerializer.h"
-#include "nsIDOMUIEvent.h"
 #include "nsIDOMXMLDocument.h"
 #include "nsIDOMXULElement.h"
 #include "nsIListBoxObject.h"
 #include "nsIMessageManager.h"
 #include "nsISelection.h"
 #include "nsITreeBoxObject.h"
 #include "nsIWebBrowserPersistable.h"
 
@@ -78,17 +77,16 @@
 #include "mozilla/dom/ScreenBinding.h"
 #include "mozilla/dom/SelectionBinding.h"
 #include "mozilla/dom/StorageEventBinding.h"
 #include "mozilla/dom/StyleSheetBinding.h"
 #include "mozilla/dom/StyleSheetListBinding.h"
 #include "mozilla/dom/SVGElementBinding.h"
 #include "mozilla/dom/TimeEventBinding.h"
 #include "mozilla/dom/TreeBoxObjectBinding.h"
-#include "mozilla/dom/UIEventBinding.h"
 #include "mozilla/dom/XMLDocumentBinding.h"
 #include "mozilla/dom/XMLSerializerBinding.h"
 #include "mozilla/dom/XULDocumentBinding.h"
 #include "mozilla/dom/XULElementBinding.h"
 
 using namespace mozilla;
 
 struct ComponentsInterfaceShimEntry {
@@ -166,17 +164,16 @@ const ComponentsInterfaceShimEntry kComp
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMParser, DOMParser),
   DEFINE_SHIM(Range),
 #ifdef MOZ_WEBRTC
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMDataChannel, RTCDataChannel),
 #endif
   DEFINE_SHIM(Screen),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMSerializer, XMLSerializer),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsITreeBoxObject, TreeBoxObject),
-  DEFINE_SHIM(UIEvent),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIWebBrowserPersistable, FrameLoader),
   DEFINE_SHIM(XMLDocument),
   DEFINE_SHIM(XULElement),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsISelection, Selection),
 };
 
 #undef DEFINE_SHIM
 #undef DEFINE_SHIM_WITH_CUSTOM_INTERFACE