Bug 1429903 part 1. Remove various target getters on nsIDOMEvent. r=mccr8
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 20 Apr 2018 00:49:30 -0400
changeset 785496 8b18a3c2beafed5be581528fb3d8a04713d6ced3
parent 785495 966c8536f1bda8ea929e552ee3a3e79331a33bdf
child 785497 706b6ff8ea85d0c8e6f51a46c96eb4897a21523c
push id107236
push userbmo:emilio@crisal.io
push dateFri, 20 Apr 2018 08:31:50 +0000
reviewersmccr8
bugs1429903
milestone61.0a1
Bug 1429903 part 1. Remove various target getters on nsIDOMEvent. r=mccr8 MozReview-Commit-ID: Ak0xdxxnSbI
dom/events/Event.cpp
dom/interfaces/events/nsIDOMEvent.idl
dom/webidl/Event.webidl
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -235,23 +235,16 @@ Event::GetType(nsAString& aType)
 }
 
 EventTarget*
 Event::GetTarget() const
 {
   return mEvent->GetDOMEventTarget();
 }
 
-NS_IMETHODIMP
-Event::GetTarget(nsIDOMEventTarget** aTarget)
-{
-  NS_IF_ADDREF(*aTarget = GetTarget());
-  return NS_OK;
-}
-
 bool
 Event::IsSrcElementEnabled(JSContext* /* unused */, JSObject* /* unused */)
 {
   // Not a pref, because that's a pain on workers.
 #ifdef NIGHTLY_BUILD
   return true;
 #else
   return false;
@@ -265,23 +258,16 @@ Event::GetCurrentTarget() const
 }
 
 void
 Event::ComposedPath(nsTArray<RefPtr<EventTarget>>& aPath)
 {
   EventDispatcher::GetComposedPathFor(mEvent, aPath);
 }
 
-NS_IMETHODIMP
-Event::GetCurrentTarget(nsIDOMEventTarget** aCurrentTarget)
-{
-  NS_IF_ADDREF(*aCurrentTarget = GetCurrentTarget());
-  return NS_OK;
-}
-
 //
 // Get the actual event target node (may have been retargeted for mouse events)
 //
 already_AddRefed<nsIContent>
 Event::GetTargetFromFrame()
 {
   if (!mPresContext) { return nullptr; }
 
@@ -299,36 +285,22 @@ EventTarget*
 Event::GetExplicitOriginalTarget() const
 {
   if (mExplicitOriginalTarget) {
     return mExplicitOriginalTarget;
   }
   return GetTarget();
 }
 
-NS_IMETHODIMP
-Event::GetExplicitOriginalTarget(nsIDOMEventTarget** aRealEventTarget)
-{
-  NS_IF_ADDREF(*aRealEventTarget = GetExplicitOriginalTarget());
-  return NS_OK;
-}
-
 EventTarget*
 Event::GetOriginalTarget() const
 {
   return mEvent->GetOriginalDOMEventTarget();
 }
 
-NS_IMETHODIMP
-Event::GetOriginalTarget(nsIDOMEventTarget** aOriginalTarget)
-{
-  NS_IF_ADDREF(*aOriginalTarget = GetOriginalTarget());
-  return NS_OK;
-}
-
 EventTarget*
 Event::GetComposedTarget() const
 {
   EventTarget* et = GetOriginalTarget();
   nsCOMPtr<nsIContent> content = do_QueryInterface(et);
   if (!content) {
     return et;
   }
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -67,29 +67,16 @@ interface nsIDOMEvent : nsISupports
 
   /**
    * The name of the event (case-insensitive). The name must be an XML 
    * name.
    */
   readonly attribute DOMString          type;
 
   /**
-   * Used to indicate the EventTarget to which the event was originally 
-   * dispatched.
-   */
-  readonly attribute nsIDOMEventTarget  target;
-
-  /**
-   * Used to indicate the EventTarget whose EventListeners are currently 
-   * being processed. This is particularly useful during capturing and 
-   * bubbling.
-   */
-  readonly attribute nsIDOMEventTarget  currentTarget;
-
-  /**
    * Used to indicate which phase of event flow is currently being 
    * evaluated.
    */
   readonly attribute unsigned short     eventPhase;
 
   /**
    * Used to indicate whether or not an event is a bubbling event. If the 
    * event can bubble the value is true, else the value is false.
@@ -179,30 +166,16 @@ interface nsIDOMEvent : nsISupports
    */
   void                       stopImmediatePropagation();
 
   const long ALT_MASK     = 0x00000001;
   const long CONTROL_MASK = 0x00000002;
   const long SHIFT_MASK   = 0x00000004;
   const long META_MASK    = 0x00000008;
 
-  /** The original target of the event, before any retargetings. */
-  readonly attribute nsIDOMEventTarget  originalTarget;
-  /**
-   * The explicit original target of the event.  If the event was retargeted
-   * for some reason other than an anonymous boundary crossing, this will be set
-   * to the target before the retargeting occurs.  For example, mouse events
-   * are retargeted to their parent node when they happen over text nodes (bug
-   * 185889), and in that case .target will show the parent and
-   * .explicitOriginalTarget will show the text node.
-   * .explicitOriginalTarget differs from .originalTarget in that it will never
-   * contain anonymous content.
-   */
-  readonly attribute nsIDOMEventTarget  explicitOriginalTarget;
-
   readonly attribute boolean isTrusted;
   attribute boolean cancelBubble;
 
   [noscript] void duplicatePrivateData();
   [noscript] void setTarget(in nsIDOMEventTarget aTarget);
   [notxpcom] boolean IsDispatchStopped();
   [notxpcom] WidgetEvent WidgetEventPtr();
   [noscript,notxpcom] void SetTrusted(in boolean aTrusted);
--- a/dom/webidl/Event.webidl
+++ b/dom/webidl/Event.webidl
@@ -62,17 +62,28 @@ interface Event {
 
 // Mozilla specific legacy stuff.
 partial interface Event {
   const long ALT_MASK     = 0x00000001;
   const long CONTROL_MASK = 0x00000002;
   const long SHIFT_MASK   = 0x00000004;
   const long META_MASK    = 0x00000008;
 
+  /** The original target of the event, before any retargetings. */
   readonly attribute EventTarget? originalTarget;
+  /**
+   * The explicit original target of the event.  If the event was retargeted
+   * for some reason other than an anonymous boundary crossing, this will be set
+   * to the target before the retargeting occurs.  For example, mouse events
+   * are retargeted to their parent node when they happen over text nodes (bug
+   * 185889), and in that case .target will show the parent and
+   * .explicitOriginalTarget will show the text node.
+   * .explicitOriginalTarget differs from .originalTarget in that it will never
+   * contain anonymous content.
+   */
   readonly attribute EventTarget? explicitOriginalTarget;
   [ChromeOnly] readonly attribute EventTarget? composedTarget;
   [ChromeOnly] readonly attribute boolean multipleActionsPrevented;
   [ChromeOnly] readonly attribute boolean isSynthesized;
 };
 
 dictionary EventInit {
   boolean bubbles = false;