Bug 898930 - Remove nsIDOMTouchEvent r=smaug
☠☠ backed out by ed763ce970e9 ☠ ☠
authorDavid Zbarsky <dzbarsky@gmail.com>
Mon, 29 Jul 2013 16:04:08 -0700
changeset 140472 b43b3d14ea161a22d8885ca6f21aaa1854ec502f
parent 140471 a0bc16b5a4289ac84df94328078d6531b786ee1c
child 140473 f10e28d8278658c8d3fa14caa87427376dbb1403
push id1970
push userryanvm@gmail.com
push dateTue, 30 Jul 2013 17:12:32 +0000
treeherderfx-team@72240998c094 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs898930
milestone25.0a1
Bug 898930 - Remove nsIDOMTouchEvent r=smaug
content/events/src/nsDOMTouchEvent.cpp
content/events/src/nsDOMTouchEvent.h
dom/base/nsDOMWindowUtils.cpp
dom/base/nsGlobalWindow.h
dom/interfaces/events/nsIDOMTouchEvent.idl
widget/nsGUIEvent.h
--- a/content/events/src/nsDOMTouchEvent.cpp
+++ b/content/events/src/nsDOMTouchEvent.cpp
@@ -103,59 +103,45 @@ nsDOMTouchEvent::~nsDOMTouchEvent()
   }
 }
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED_3(nsDOMTouchEvent, nsDOMUIEvent,
                                      mTouches,
                                      mTargetTouches,
                                      mChangedTouches)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMTouchEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMTouchEvent)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
-
-NS_IMPL_ADDREF_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
-
-
-NS_IMETHODIMP
+void
 nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
                                 bool aCanBubble,
                                 bool aCancelable,
                                 nsIDOMWindow* aView,
                                 int32_t aDetail,
                                 bool aCtrlKey,
                                 bool aAltKey,
                                 bool aShiftKey,
                                 bool aMetaKey,
-                                nsIDOMTouchList* aTouches,
-                                nsIDOMTouchList* aTargetTouches,
-                                nsIDOMTouchList* aChangedTouches)
+                                nsDOMTouchList* aTouches,
+                                nsDOMTouchList* aTargetTouches,
+                                nsDOMTouchList* aChangedTouches,
+                                mozilla::ErrorResult& aRv)
 {
-  nsresult rv = nsDOMUIEvent::InitUIEvent(aType,
-                                          aCanBubble,
-                                          aCancelable,
-                                          aView,
-                                          aDetail);
-  NS_ENSURE_SUCCESS(rv, rv);
+  aRv = nsDOMUIEvent::InitUIEvent(aType,
+                                  aCanBubble,
+                                  aCancelable,
+                                  aView,
+                                  aDetail);
+  if (aRv.Failed()) {
+    return;
+  }
 
   static_cast<nsInputEvent*>(mEvent)->InitBasicModifiers(aCtrlKey, aAltKey,
                                                          aShiftKey, aMetaKey);
-  mTouches = static_cast<nsDOMTouchList*>(aTouches);
-  mTargetTouches = static_cast<nsDOMTouchList*>(aTargetTouches);
-  mChangedTouches = static_cast<nsDOMTouchList*>(aChangedTouches);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMTouchEvent::GetTouches(nsIDOMTouchList** aTouches)
-{
-  NS_ENSURE_ARG_POINTER(aTouches);
-  NS_ADDREF(*aTouches = Touches());
-  return NS_OK;
+  mTouches = aTouches;
+  mTargetTouches = aTargetTouches;
+  mChangedTouches = aChangedTouches;
 }
 
 nsDOMTouchList*
 nsDOMTouchEvent::Touches()
 {
   if (!mTouches) {
     nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
     if (mEvent->message == NS_TOUCH_END || mEvent->message == NS_TOUCH_CANCEL) {
@@ -170,24 +156,16 @@ nsDOMTouchEvent::Touches()
       mTouches = new nsDOMTouchList(ToSupports(this), unchangedTouches);
     } else {
       mTouches = new nsDOMTouchList(ToSupports(this), touchEvent->touches);
     }
   }
   return mTouches;
 }
 
-NS_IMETHODIMP
-nsDOMTouchEvent::GetTargetTouches(nsIDOMTouchList** aTargetTouches)
-{
-  NS_ENSURE_ARG_POINTER(aTargetTouches);
-  NS_ADDREF(*aTargetTouches = TargetTouches());
-  return NS_OK;
-}
-
 nsDOMTouchList*
 nsDOMTouchEvent::TargetTouches()
 {
   if (!mTargetTouches) {
     nsTArray< nsRefPtr<Touch> > targetTouches;
     nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
     const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
     for (uint32_t i = 0; i < touches.Length(); ++i) {
@@ -200,24 +178,16 @@ nsDOMTouchEvent::TargetTouches()
         }
       }
     }
     mTargetTouches = new nsDOMTouchList(ToSupports(this), targetTouches);
   }
   return mTargetTouches;
 }
 
-NS_IMETHODIMP
-nsDOMTouchEvent::GetChangedTouches(nsIDOMTouchList** aChangedTouches)
-{
-  NS_ENSURE_ARG_POINTER(aChangedTouches);
-  NS_ADDREF(*aChangedTouches = ChangedTouches());
-  return NS_OK;
-}
-
 nsDOMTouchList*
 nsDOMTouchEvent::ChangedTouches()
 {
   if (!mChangedTouches) {
     nsTArray< nsRefPtr<Touch> > changedTouches;
     nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
     const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
     for (uint32_t i = 0; i < touches.Length(); ++i) {
@@ -225,44 +195,16 @@ nsDOMTouchEvent::ChangedTouches()
         changedTouches.AppendElement(touches[i]);
       }
     }
     mChangedTouches = new nsDOMTouchList(ToSupports(this), changedTouches);
   }
   return mChangedTouches;
 }
 
-NS_IMETHODIMP
-nsDOMTouchEvent::GetAltKey(bool* aAltKey)
-{
-  *aAltKey = AltKey();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMTouchEvent::GetMetaKey(bool* aMetaKey)
-{
-  *aMetaKey = MetaKey();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMTouchEvent::GetCtrlKey(bool* aCtrlKey)
-{
-  *aCtrlKey = CtrlKey();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMTouchEvent::GetShiftKey(bool* aShiftKey)
-{
-  *aShiftKey = ShiftKey();
-  return NS_OK;
-}
-
 #ifdef XP_WIN
 namespace mozilla {
 namespace widget {
 extern int32_t IsTouchDeviceSupportPresent();
 } }
 #endif
 
 bool
--- a/content/events/src/nsDOMTouchEvent.h
+++ b/content/events/src/nsDOMTouchEvent.h
@@ -72,32 +72,27 @@ public:
   }
   Touch* IdentifiedTouch(int32_t aIdentifier) const;
 
 protected:
   nsCOMPtr<nsISupports> mParent;
   nsTArray< nsRefPtr<Touch> > mPoints;
 };
 
-class nsDOMTouchEvent : public nsDOMUIEvent,
-                        public nsIDOMTouchEvent
+class nsDOMTouchEvent : public nsDOMUIEvent
 {
 public:
   nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
                   nsPresContext* aPresContext, nsTouchEvent* aEvent);
   virtual ~nsDOMTouchEvent();
 
-  NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
-  NS_DECL_NSIDOMTOUCHEVENT
-
-  NS_FORWARD_TO_NSDOMUIEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
-			       JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
+                               JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
     return mozilla::dom::TouchEventBinding::Wrap(aCx, aScope, this);
   }
 
   nsDOMTouchList* Touches();
   nsDOMTouchList* TargetTouches();
   nsDOMTouchList* ChangedTouches();
 
@@ -125,25 +120,20 @@ public:
                       bool aCanBubble,
                       bool aCancelable,
                       nsIDOMWindow* aView,
                       int32_t aDetail,
                       bool aCtrlKey,
                       bool aAltKey,
                       bool aShiftKey,
                       bool aMetaKey,
-                      nsIDOMTouchList* aTouches,
-                      nsIDOMTouchList* aTargetTouches,
-                      nsIDOMTouchList* aChangedTouches,
-                      mozilla::ErrorResult& aRv)
-  {
-    aRv = InitTouchEvent(aType, aCanBubble, aCancelable, aView, aDetail,
-                         aCtrlKey, aAltKey, aShiftKey, aMetaKey,
-                         aTouches, aTargetTouches, aChangedTouches);
-  }
+                      nsDOMTouchList* aTouches,
+                      nsDOMTouchList* aTargetTouches,
+                      nsDOMTouchList* aChangedTouches,
+                      mozilla::ErrorResult& aRv);
 
   static bool PrefEnabled();
 protected:
   nsRefPtr<nsDOMTouchList> mTouches;
   nsRefPtr<nsDOMTouchList> mTargetTouches;
   nsRefPtr<nsDOMTouchList> mChangedTouches;
 };
 
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -15,17 +15,16 @@
 #include "nsGlobalWindow.h"
 #include "nsIDocument.h"
 #include "nsFocusManager.h"
 #include "nsEventStateManager.h"
 #include "nsFrameManager.h"
 #include "nsRefreshDriver.h"
 #include "nsDOMTouchEvent.h"
 #include "mozilla/dom/Touch.h"
-#include "nsIDOMTouchEvent.h"
 #include "nsObjectLoadingContent.h"
 #include "nsFrame.h"
 
 #include "nsIScrollableFrame.h"
 
 #include "nsContentUtils.h"
 #include "nsLayoutUtils.h"
 
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -49,17 +49,16 @@
 #include "prclist.h"
 #include "nsIDOMStorageEvent.h"
 #include "nsIDOMStorageIndexedDB.h"
 #include "nsIDOMOfflineResourceList.h"
 #include "nsIArray.h"
 #include "nsFrameMessageManager.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/TimeStamp.h"
-#include "nsIDOMTouchEvent.h"
 #include "nsIInlineEventHandlers.h"
 #include "nsWrapperCacheInlines.h"
 #include "nsIIdleObserver.h"
 #include "nsIDOMWakeLock.h"
 #ifdef MOZ_GAMEPAD
 #include "mozilla/dom/Gamepad.h"
 #endif
 #include "nsIDocument.h"
--- a/dom/interfaces/events/nsIDOMTouchEvent.idl
+++ b/dom/interfaces/events/nsIDOMTouchEvent.idl
@@ -40,39 +40,16 @@ interface nsIDOMTouch : nsISupports {
 
 [scriptable, builtinclass, uuid(60706eb7-d50d-4379-b01c-e78e6af84213)]
 interface nsIDOMTouchList : nsISupports {
   readonly attribute unsigned long length;
   nsIDOMTouch item(in unsigned long index);
   nsIDOMTouch identifiedTouch(in long identifier);
 };
 
-[scriptable, builtinclass, uuid(9a043d55-f59e-4790-8fc7-1fab1c727732)]
-interface nsIDOMTouchEvent : nsIDOMUIEvent {
-  readonly attribute nsIDOMTouchList touches;
-  readonly attribute nsIDOMTouchList targetTouches;
-  readonly attribute nsIDOMTouchList changedTouches;
-  readonly attribute boolean         altKey;
-  readonly attribute boolean         metaKey;
-  readonly attribute boolean         ctrlKey;
-  readonly attribute boolean         shiftKey;
-  void initTouchEvent(in DOMString type,
-                      in boolean canBubble,
-                      in boolean cancelable,
-                      in nsIDOMWindow view,
-                      in long detail,
-                      in boolean ctrlKey,
-                      in boolean altKey,
-                      in boolean shiftKey,
-                      in boolean metaKey,
-                      in nsIDOMTouchList touches,
-                      in nsIDOMTouchList targetTouches,
-                      in nsIDOMTouchList changedTouches);
-};
-
 [scriptable, uuid(6d5484f7-92ac-45f8-9388-39b5bad055ce)]
 interface nsITouchEventReceiver : nsISupports {
   [implicit_jscontext] attribute jsval           ontouchstart;
   [implicit_jscontext] attribute jsval           ontouchend;
   [implicit_jscontext] attribute jsval           ontouchmove;
   [implicit_jscontext] attribute jsval           ontouchenter;
   [implicit_jscontext] attribute jsval           ontouchleave;
   [implicit_jscontext] attribute jsval           ontouchcancel;
--- a/widget/nsGUIEvent.h
+++ b/widget/nsGUIEvent.h
@@ -15,17 +15,16 @@
 #include "nsEvent.h"
 #include "nsStringGlue.h"
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMWheelEvent.h"
 #include "nsIDOMDataTransfer.h"
-#include "nsIDOMTouchEvent.h"
 #include "nsWeakPtr.h"
 #include "nsIWidget.h"
 #include "nsTArray.h"
 #include "nsTraceRefcnt.h"
 #include "nsITransferable.h"
 #include "nsIVariant.h"
 #include "nsStyleConsts.h"
 #include "nsAutoPtr.h"