Bug 856962 - Move Touch to WebIDL bindings; r=mounir
authorDavid Zbarsky <dzbarsky@gmail.com>
Sun, 21 Apr 2013 08:42:19 +0200
changeset 140310 047132a1517fb17d0c8e6dce3649a31e4e74ed51
parent 140309 0d2e8dcbec44ddb883c613c5b331b174fafd0600
child 140311 0d50cb959c46f21d0e0e7d884f97127794a78c5d
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmounir
bugs856962
milestone23.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 856962 - Move Touch to WebIDL bindings; r=mounir
content/base/public/nsIDocument.h
content/base/src/nsDocument.cpp
content/events/src/Touch.cpp
content/events/src/Touch.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/bindings/Bindings.conf
dom/webidl/Document.webidl
dom/webidl/Touch.webidl
dom/webidl/TouchList.webidl
dom/webidl/WebIDL.mk
js/xpconnect/src/dom_quickstubs.qsconf
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -44,17 +44,16 @@ class nsIContent;
 class nsIContentSink;
 class nsIDocShell;
 class nsIDocumentObserver;
 class nsIDOMDocument;
 class nsIDOMDocumentFragment;
 class nsIDOMDocumentType;
 class nsIDOMElement;
 class nsIDOMNodeList;
-class nsIDOMTouch;
 class nsIDOMTouchList;
 class nsIDOMXPathExpression;
 class nsIDOMXPathNSResolver;
 class nsILayoutHistoryState;
 class nsIObjectLoadingContent;
 class nsIObserver;
 class nsIPresShell;
 class nsIPrincipal;
@@ -97,18 +96,20 @@ class Element;
 struct ElementRegistrationOptions;
 class EventTarget;
 class GlobalObject;
 class HTMLBodyElement;
 class Link;
 class NodeFilter;
 class NodeIterator;
 class ProcessingInstruction;
+class Touch;
 class TreeWalker;
 class UndoManager;
+template<typename> class OwningNonNull;
 template<typename> class Sequence;
 
 template<typename, typename> class CallbackObjectHolder;
 typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
 } // namespace dom
 } // namespace mozilla
 
 #define NS_IDOCUMENT_IID \
@@ -2085,28 +2086,28 @@ public:
                      mozilla::ErrorResult& rv);
   already_AddRefed<nsIDOMXPathNSResolver>
     CreateNSResolver(nsINode* aNodeResolver, mozilla::ErrorResult& rv);
   already_AddRefed<nsISupports>
     Evaluate(const nsAString& aExpression, nsINode* aContextNode,
              nsIDOMXPathNSResolver* aResolver, uint16_t aType,
              nsISupports* aResult, mozilla::ErrorResult& rv);
   // Touch event handlers already on nsINode
-  already_AddRefed<nsIDOMTouch>
+  already_AddRefed<mozilla::dom::Touch>
     CreateTouch(nsIDOMWindow* aView, mozilla::dom::EventTarget* aTarget,
                 int32_t aIdentifier, int32_t aPageX, int32_t aPageY,
                 int32_t aScreenX, int32_t aScreenY, int32_t aClientX,
                 int32_t aClientY, int32_t aRadiusX, int32_t aRadiusY,
                 float aRotationAngle, float aForce);
   already_AddRefed<nsIDOMTouchList> CreateTouchList();
   already_AddRefed<nsIDOMTouchList>
-    CreateTouchList(nsIDOMTouch* aTouch,
-                    const mozilla::dom::Sequence<nsRefPtr<nsIDOMTouch> >& aTouches);
+    CreateTouchList(mozilla::dom::Touch& aTouch,
+                    const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches);
   already_AddRefed<nsIDOMTouchList>
-    CreateTouchList(const mozilla::dom::Sequence<nsRefPtr<nsIDOMTouch> >& aTouches);
+    CreateTouchList(const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches);
 
   virtual nsHTMLDocument* AsHTMLDocument() { return nullptr; }
 
 private:
   uint64_t mWarnedAbout;
 
 protected:
   ~nsIDocument();
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -9166,35 +9166,35 @@ nsDocument::CreateTouch(nsIDOMWindow* aV
   nsCOMPtr<EventTarget> target = do_QueryInterface(aTarget);
   *aRetVal = nsIDocument::CreateTouch(aView, target, aIdentifier, aPageX,
                                       aPageY, aScreenX, aScreenY, aClientX,
                                       aClientY, aRadiusX, aRadiusY,
                                       aRotationAngle, aForce).get();
   return NS_OK;
 }
 
-already_AddRefed<nsIDOMTouch>
+already_AddRefed<Touch>
 nsIDocument::CreateTouch(nsIDOMWindow* aView,
                          EventTarget* aTarget,
                          int32_t aIdentifier,
                          int32_t aPageX, int32_t aPageY,
                          int32_t aScreenX, int32_t aScreenY,
                          int32_t aClientX, int32_t aClientY,
                          int32_t aRadiusX, int32_t aRadiusY,
                          float aRotationAngle,
                          float aForce)
 {
-  nsCOMPtr<nsIDOMTouch> touch = new Touch(aTarget,
-                                          aIdentifier,
-                                          aPageX, aPageY,
-                                          aScreenX, aScreenY,
-                                          aClientX, aClientY,
-                                          aRadiusX, aRadiusY,
-                                          aRotationAngle,
-                                          aForce);
+  nsRefPtr<Touch> touch = new Touch(aTarget,
+                                    aIdentifier,
+                                    aPageX, aPageY,
+                                    aScreenX, aScreenY,
+                                    aClientX, aClientY,
+                                    aRadiusX, aRadiusY,
+                                    aRotationAngle,
+                                    aForce);
   return touch.forget();
 }
 
 NS_IMETHODIMP
 nsDocument::CreateTouchList(nsIVariant* aPoints,
                             nsIDOMTouchList** aRetVal)
 {
   nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList();
@@ -9237,33 +9237,33 @@ nsDocument::CreateTouchList(nsIVariant* 
 already_AddRefed<nsIDOMTouchList>
 nsIDocument::CreateTouchList()
 {
   nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList();
   return retval.forget();
 }
 
 already_AddRefed<nsIDOMTouchList>
-nsIDocument::CreateTouchList(nsIDOMTouch* aTouch,
-                             const Sequence<nsRefPtr<nsIDOMTouch> >& aTouches)
+nsIDocument::CreateTouchList(Touch& aTouch,
+                             const Sequence<OwningNonNull<Touch> >& aTouches)
 {
   nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList();
-  retval->Append(aTouch);
+  retval->Append(&aTouch);
   for (uint32_t i = 0; i < aTouches.Length(); ++i) {
-    retval->Append(aTouches[i]);
+    retval->Append(aTouches[i].get());
   }
   return retval.forget();
 }
 
 already_AddRefed<nsIDOMTouchList>
-nsIDocument::CreateTouchList(const Sequence<nsRefPtr<nsIDOMTouch> >& aTouches)
+nsIDocument::CreateTouchList(const Sequence<OwningNonNull<Touch> >& aTouches)
 {
   nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList();
   for (uint32_t i = 0; i < aTouches.Length(); ++i) {
-    retval->Append(aTouches[i]);
+    retval->Append(aTouches[i].get());
   }
   return retval.forget();
 }
 
 already_AddRefed<nsDOMCaretPosition>
 nsIDocument::CaretPositionFromPoint(float aX, float aY)
 {
   nscoord x = nsPresContext::CSSPixelsToAppUnits(aX);
--- a/content/events/src/Touch.cpp
+++ b/content/events/src/Touch.cpp
@@ -1,126 +1,135 @@
 /* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
 /* 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 "mozilla/dom/Touch.h"
-#include "nsGUIEvent.h"
-#include "nsDOMClassInfoID.h"
-#include "nsIClassInfo.h"
-#include "nsIXPCScriptable.h"
+
+#include "mozilla/dom/TouchBinding.h"
+#include "mozilla/Preferences.h"
 #include "nsContentUtils.h"
-#include "mozilla/Preferences.h"
+#include "nsDOMTouchEvent.h"
+#include "nsGUIEvent.h"
 #include "nsPresContext.h"
 
-DOMCI_DATA(Touch, mozilla::dom::Touch)
-
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_CYCLE_COLLECTION_1(Touch, mTarget)
+/* static */ bool
+Touch::PrefEnabled()
+{
+  return nsDOMTouchEvent::PrefEnabled();
+}
+
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(Touch, mTarget)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Touch)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMTouch)
+  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsIDOMTouch)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Touch)
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(Touch)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(Touch)
 
 NS_IMETHODIMP
 Touch::GetIdentifier(int32_t* aIdentifier)
 {
-  *aIdentifier = mIdentifier;
+  *aIdentifier = Identifier();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Touch::GetTarget(nsIDOMEventTarget** aTarget)
 {
+  NS_ADDREF(*aTarget = Target());
+  return NS_OK;
+}
+
+EventTarget*
+Touch::Target() const
+{
   nsCOMPtr<nsIContent> content = do_QueryInterface(mTarget);
   if (content && content->ChromeOnlyAccess() &&
       !nsContentUtils::CanAccessNativeAnon()) {
-    content = content->FindFirstNonChromeOnlyAccessContent();
-    *aTarget = content.forget().get();
-    return NS_OK;
+    return content->FindFirstNonChromeOnlyAccessContent();
   }
-  NS_IF_ADDREF(*aTarget = mTarget);
-  return NS_OK;
+
+  return mTarget;
 }
 
 NS_IMETHODIMP
 Touch::GetScreenX(int32_t* aScreenX)
 {
-  *aScreenX = mScreenPoint.x;
+  *aScreenX = ScreenX();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Touch::GetScreenY(int32_t* aScreenY)
 {
-  *aScreenY = mScreenPoint.y;
+  *aScreenY = ScreenY();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Touch::GetClientX(int32_t* aClientX)
 {
-  *aClientX = mClientPoint.x;
+  *aClientX = ClientX();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Touch::GetClientY(int32_t* aClientY)
 {
-  *aClientY = mClientPoint.y;
+  *aClientY = ClientY();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Touch::GetPageX(int32_t* aPageX)
 {
-  *aPageX = mPagePoint.x;
+  *aPageX = PageX();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Touch::GetPageY(int32_t* aPageY)
 {
-  *aPageY = mPagePoint.y;
+  *aPageY = PageY();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Touch::GetRadiusX(int32_t* aRadiusX)
 {
-  *aRadiusX = mRadius.x;
+  *aRadiusX = RadiusX();
   return NS_OK;
 }
                                              
 NS_IMETHODIMP
 Touch::GetRadiusY(int32_t* aRadiusY)
 {
-  *aRadiusY = mRadius.y;
+  *aRadiusY = RadiusY();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Touch::GetRotationAngle(float* aRotationAngle)
 {
-  *aRotationAngle = mRotationAngle;
+  *aRotationAngle = RotationAngle();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Touch::GetForce(float* aForce)
 {
-  *aForce = mForce;
+  *aForce = Force();
   return NS_OK;
 }
 
 bool
 Touch::Equals(nsIDOMTouch* aTouch)
 {
   float force;
   float orientation;
@@ -130,10 +139,16 @@ Touch::Equals(nsIDOMTouch* aTouch)
   aTouch->GetRadiusX(&radiusX);
   aTouch->GetRadiusY(&radiusY);
   return mRefPoint != aTouch->mRefPoint ||
          (mForce != force) ||
          (mRotationAngle != orientation) ||
          (mRadius.x != radiusX) || (mRadius.y != radiusY);
 }
 
+/* virtual */ JSObject*
+Touch::WrapObject(JSContext* aCx, JSObject* aScope)
+{
+  return TouchBinding::Wrap(aCx, aScope, this);
+}
+
 } // namespace dom
 } // namespace mozilla
--- a/content/events/src/Touch.h
+++ b/content/events/src/Touch.h
@@ -12,31 +12,35 @@
 #include "nsTArray.h"
 #include "mozilla/Attributes.h"
 #include "nsJSEnvironment.h"
 
 namespace mozilla {
 namespace dom {
 
 class Touch MOZ_FINAL : public nsIDOMTouch
+                      , public nsWrapperCache
 {
 public:
+  static bool PrefEnabled();
+
   Touch(mozilla::dom::EventTarget* aTarget,
         int32_t aIdentifier,
         int32_t aPageX,
         int32_t aPageY,
         int32_t aScreenX,
         int32_t aScreenY,
         int32_t aClientX,
         int32_t aClientY,
         int32_t aRadiusX,
         int32_t aRadiusY,
         float aRotationAngle,
         float aForce)
     {
+      SetIsDOMBinding();
       mTarget = aTarget;
       mIdentifier = aIdentifier;
       mPagePoint = nsIntPoint(aPageX, aPageY);
       mScreenPoint = nsIntPoint(aScreenX, aScreenY);
       mClientPoint = nsIntPoint(aClientX, aClientY);
       mRefPoint = nsIntPoint(0, 0);
       mPointsInitialized = true;
       mRadius.x = aRadiusX;
@@ -49,32 +53,33 @@ public:
       nsJSContext::LikelyShortLivingObjectCreated();
     }
   Touch(int32_t aIdentifier,
         nsIntPoint aPoint,
         nsIntPoint aRadius,
         float aRotationAngle,
         float aForce)
     {
+      SetIsDOMBinding();
       mIdentifier = aIdentifier;
       mPagePoint = nsIntPoint(0, 0);
       mScreenPoint = nsIntPoint(0, 0);
       mClientPoint = nsIntPoint(0, 0);
       mRefPoint = aPoint;
       mPointsInitialized = false;
       mRadius = aRadius;
       mRotationAngle = aRotationAngle;
       mForce = aForce;
 
       mChanged = false;
       mMessage = 0;
       nsJSContext::LikelyShortLivingObjectCreated();
     }
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS(Touch)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch)
   NS_DECL_NSIDOMTOUCH
   void InitializePoints(nsPresContext* aPresContext, nsEvent* aEvent)
   {
     if (mPointsInitialized) {
       return;
     }
     mClientPoint = nsDOMEvent::GetClientCoords(aPresContext,
                                                aEvent,
@@ -88,16 +93,33 @@ public:
     mPointsInitialized = true;
   }
   void SetTarget(mozilla::dom::EventTarget *aTarget)
   {
     mTarget = aTarget;
   }
   bool Equals(nsIDOMTouch* aTouch);
 
+  JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
+  EventTarget* GetParentObject() { return mTarget; }
+
+  // WebIDL
+  int32_t Identifier() const { return mIdentifier; }
+  EventTarget* Target() const;
+  int32_t ScreenX() const { return mScreenPoint.x; }
+  int32_t ScreenY() const { return mScreenPoint.y; }
+  int32_t ClientX() const { return mClientPoint.x; }
+  int32_t ClientY() const { return mClientPoint.y; }
+  int32_t PageX() const { return mPagePoint.x; }
+  int32_t PageY() const { return mPagePoint.y; }
+  int32_t RadiusX() const { return mRadius.x; }
+  int32_t RadiusY() const { return mRadius.y; }
+  float RotationAngle() const { return mRotationAngle; }
+  float Force() const { return mForce; }
+
   int32_t mIdentifier;
   nsIntPoint mPagePoint;
   nsIntPoint mClientPoint;
   nsIntPoint mScreenPoint;
   nsIntPoint mRadius;
   float mRotationAngle;
   float mForce;
 protected:
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -884,18 +884,16 @@ static nsDOMClassInfoData sClassInfoData
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(IDBIndex, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(IDBVersionChangeEvent, nsEventSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(IDBOpenDBRequest, IDBEventTargetSH,
                            IDBEVENTTARGET_SCRIPTABLE_FLAGS)
 
-  NS_DEFINE_CLASSINFO_DATA(Touch, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(TouchList, nsDOMTouchListSH,
                            ARRAY_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(TouchEvent, nsEventSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(MozCSSKeyframeRule, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MozCSSKeyframesRule, nsDOMGenericSH,
@@ -2274,21 +2272,16 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(IDBOpenDBRequest, nsIIDBOpenDBRequest)
     DOM_CLASSINFO_MAP_ENTRY(nsIIDBOpenDBRequest)
     DOM_CLASSINFO_MAP_ENTRY(nsIIDBRequest)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(Touch, nsIDOMTouch,
-                                        !nsDOMTouchEvent::PrefEnabled())
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMTouch)
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(TouchList, nsIDOMTouchList,
                                         !nsDOMTouchEvent::PrefEnabled())
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMTouchList)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(TouchEvent, nsIDOMTouchEvent,
                                         !nsDOMTouchEvent::PrefEnabled())
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMTouchEvent)
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -206,17 +206,16 @@ DOMCI_CLASS(IDBObjectStore)
 DOMCI_CLASS(IDBTransaction)
 DOMCI_CLASS(IDBCursor)
 DOMCI_CLASS(IDBCursorWithValue)
 DOMCI_CLASS(IDBKeyRange)
 DOMCI_CLASS(IDBIndex)
 DOMCI_CLASS(IDBVersionChangeEvent)
 DOMCI_CLASS(IDBOpenDBRequest)
 
-DOMCI_CLASS(Touch)
 DOMCI_CLASS(TouchList)
 DOMCI_CLASS(TouchEvent)
 
 DOMCI_CLASS(MozCSSKeyframeRule)
 DOMCI_CLASS(MozCSSKeyframesRule)
 
 DOMCI_CLASS(CSSPageRule)
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1529,17 +1529,16 @@ addExternalIface('PrintCallback', native
                  headerFile='nsIDOMHTMLCanvasElement.h')
 addExternalIface('Selection', nativeType='nsISelection')
 addExternalIface('StyleSheetList')
 addExternalIface('SVGAnimatedEnumeration', headerFile='nsIDOMSVGAnimatedEnum.h')
 addExternalIface('SVGAnimatedNumber')
 addExternalIface('SVGAnimatedString')
 addExternalIface('SVGLength')
 addExternalIface('SVGNumber')
-addExternalIface('Touch', headerFile='nsIDOMTouchEvent.h')
 addExternalIface('TouchList', headerFile='nsIDOMTouchEvent.h')
 addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',
                  notflattened=True)
 addExternalIface('UserDataHandler')
 addExternalIface('Window')
 addExternalIface('WindowProxy', nativeType='nsIDOMWindow')
 addExternalIface('XPathResult', nativeType='nsISupports')
 addExternalIface('XPathExpression')
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -12,17 +12,16 @@
  * http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface
  * http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface
  *
  * http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/core/nsIDOMDocument.idl
  */
 
 interface Comment;
 interface StyleSheetList;
-interface Touch;
 interface TouchList;
 interface WindowProxy;
 interface nsISupports;
 
 enum VisibilityState { "hidden", "visible" };
 
 /* http://dom.spec.whatwg.org/#interface-document */
 [Constructor]
new file mode 100644
--- /dev/null
+++ b/dom/webidl/Touch.webidl
@@ -0,0 +1,27 @@
+/* -*- 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/.
+ *
+ * The origin of this IDL file is
+ * http://dvcs.w3.org/hg/webevents/raw-file/default/touchevents.html
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+[PrefControlled]
+interface Touch {
+  readonly    attribute long        identifier;
+  readonly    attribute EventTarget target;
+  readonly    attribute long        screenX;
+  readonly    attribute long        screenY;
+  readonly    attribute long        clientX;
+  readonly    attribute long        clientY;
+  readonly    attribute long        pageX;
+  readonly    attribute long        pageY;
+  readonly    attribute long        radiusX;
+  readonly    attribute long        radiusY;
+  readonly    attribute float       rotationAngle;
+  readonly    attribute float       force;
+};
--- a/dom/webidl/TouchList.webidl
+++ b/dom/webidl/TouchList.webidl
@@ -5,15 +5,13 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/webevents/raw-file/default/touchevents.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-interface Touch;
-
 interface TouchList {
   readonly attribute unsigned long length;
   getter Touch? item(unsigned long index);
   Touch identifiedTouch(long identifier);
 };
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -283,16 +283,17 @@ webidl_files = \
   SVGUseElement.webidl \
   SVGURIReference.webidl \
   SVGViewElement.webidl \
   SVGZoomAndPan.webidl \
   Text.webidl \
   TextDecoder.webidl \
   TextEncoder.webidl \
   TimeRanges.webidl \
+  Touch.webidl \
   TouchEvent.webidl \
   TransitionEvent.webidl \
   TreeWalker.webidl \
   UIEvent.webidl \
   URL.webidl \
   ValidityState.webidl \
   WebComponents.webidl \
   WebSocket.webidl \
--- a/js/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/xpconnect/src/dom_quickstubs.qsconf
@@ -62,17 +62,16 @@ members = [
 
     'nsIDOMKeyEvent.*',
     'nsIDOMDragEvent.*',
     'nsIDOMProgressEvent.lengthComputable',
     'nsIDOMProgressEvent.loaded',
     'nsIDOMProgressEvent.total',
     #XXX Can't quickstub initProgressEvent because it has long long parameters.
 
-    'nsIDOMTouch.*',
     'nsIDOMTouchList.*',
 
     # dom/interfaces/html
     'nsIDOMHTMLFormElement.elements',
     'nsIDOMHTMLFormElement.name',
     'nsIDOMHTMLFormElement.submit',
     'nsIDOMHTMLFormElement.length',
     'nsIDOMHTMLFormElement.target',