Bug 975688 part.20 Rename nsDOMTouchEvent and nsDOMTouchList to mozilla::dom::TouchEvent and TouchList r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 28 Feb 2014 23:58:42 +0900
changeset 171518 07ed9eef2248236c008b8c232df236b23a3f8312
parent 171517 283b3d83b33585055a9c9e0751ead68afdf2e5e9
child 171519 031dc7e7c0742dca42bbd82d866dffc097b0bbdf
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerssmaug
bugs975688
milestone30.0a1
Bug 975688 part.20 Rename nsDOMTouchEvent and nsDOMTouchList to mozilla::dom::TouchEvent and TouchList r=smaug
accessible/src/base/nsCoreUtils.cpp
content/base/public/nsIDocument.h
content/base/src/nsContentUtils.cpp
content/base/src/nsDocument.cpp
content/html/content/src/nsGenericHTMLElement.cpp
dom/base/nsDOMClassInfo.cpp
dom/bindings/Bindings.conf
dom/events/Touch.cpp
dom/events/Touch.h
dom/events/TouchEvent.cpp
dom/events/TouchEvent.h
dom/events/moz.build
dom/events/nsDOMTouchEvent.cpp
dom/events/nsDOMTouchEvent.h
dom/events/nsEventDispatcher.cpp
dom/webidl/TouchEvent.webidl
dom/webidl/TouchList.webidl
widget/windows/nsLookAndFeel.cpp
--- a/accessible/src/base/nsCoreUtils.cpp
+++ b/accessible/src/base/nsCoreUtils.cpp
@@ -18,21 +18,21 @@
 #include "nsIDocShell.h"
 #include "nsEventListenerManager.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "nsIScrollableFrame.h"
 #include "nsEventStateManager.h"
 #include "nsISelectionPrivate.h"
 #include "nsISelectionController.h"
+#include "mozilla/dom/TouchEvent.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TouchEvents.h"
 #include "nsView.h"
 #include "nsGkAtoms.h"
-#include "nsDOMTouchEvent.h"
 
 #include "nsComponentManagerUtils.h"
 
 #include "nsITreeBoxObject.h"
 #include "nsITreeColumns.h"
 #include "mozilla/dom/Element.h"
 
 using namespace mozilla;
@@ -136,27 +136,26 @@ nsCoreUtils::DispatchMouseEvent(uint32_t
   aPresShell->HandleEventWithTarget(&event, aFrame, aContent, &status);
 }
 
 void
 nsCoreUtils::DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
                                 nsIContent* aContent, nsIFrame* aFrame,
                                 nsIPresShell* aPresShell, nsIWidget* aRootWidget)
 {
-  if (!nsDOMTouchEvent::PrefEnabled())
+  if (!dom::TouchEvent::PrefEnabled())
     return;
 
   WidgetTouchEvent event(true, aEventType, aRootWidget);
 
   event.time = PR_IntervalNow();
 
   // XXX: Touch has an identifier of -1 to hint that it is synthesized.
-  nsRefPtr<mozilla::dom::Touch> t =
-    new mozilla::dom::Touch(-1, nsIntPoint(aX, aY),
-                            nsIntPoint(1, 1), 0.0f, 1.0f);
+  nsRefPtr<dom::Touch> t = new dom::Touch(-1, nsIntPoint(aX, aY),
+                                          nsIntPoint(1, 1), 0.0f, 1.0f);
   t->SetTarget(aContent);
   event.touches.AppendElement(t);
   nsEventStatus status = nsEventStatus_eIgnore;
   aPresShell->HandleEventWithTarget(&event, aFrame, aContent, &status);
 }
 
 uint32_t
 nsCoreUtils::GetAccessKeyFor(nsIContent* aContent)
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -27,17 +27,16 @@
 
 class imgIRequest;
 class nsAString;
 class nsBindingManager;
 class nsCSSStyleSheet;
 class nsIDocShell;
 class nsDocShell;
 class nsDOMNavigationTiming;
-class nsDOMTouchList;
 class nsEventStates;
 class nsFrameLoader;
 class nsHTMLCSSStyleSheet;
 class nsHTMLDocument;
 class nsHTMLStyleSheet;
 class nsIAtom;
 class nsIBFCacheEntry;
 class nsIBoxObject;
@@ -108,16 +107,17 @@ class FrameRequestCallback;
 class HTMLBodyElement;
 struct LifecycleCallbackArgs;
 class Link;
 class GlobalObject;
 class NodeFilter;
 class NodeIterator;
 class ProcessingInstruction;
 class Touch;
+class TouchList;
 class TreeWalker;
 class UndoManager;
 class XPathEvaluator;
 template<typename> class OwningNonNull;
 template<typename> class Sequence;
 
 template<typename, typename> class CallbackObjectHolder;
 typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
@@ -2195,21 +2195,21 @@ public:
              nsISupports* aResult, mozilla::ErrorResult& rv);
   // Touch event handlers already on nsINode
   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<nsDOMTouchList> CreateTouchList();
-  already_AddRefed<nsDOMTouchList>
+  already_AddRefed<mozilla::dom::TouchList> CreateTouchList();
+  already_AddRefed<mozilla::dom::TouchList>
     CreateTouchList(mozilla::dom::Touch& aTouch,
                     const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches);
-  already_AddRefed<nsDOMTouchList>
+  already_AddRefed<mozilla::dom::TouchList>
     CreateTouchList(const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches);
 
   void SetStyleSheetChangeEventsEnabled(bool aValue)
   {
     mStyleSheetChangeEventsEnabled = aValue;
   }
 
   bool StyleSheetChangeEventsEnabled() const
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -34,16 +34,17 @@
 #include "mozilla/Base64.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/dom/DocumentFragment.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLMediaElement.h"
 #include "mozilla/dom/HTMLTemplateElement.h"
 #include "mozilla/dom/HTMLContentElement.h"
 #include "mozilla/dom/TextDecoder.h"
+#include "mozilla/dom/TouchEvent.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "mozilla/InternalMutationEvent.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Selection.h"
 #include "mozilla/TextEvents.h"
 #include "nsAString.h"
@@ -65,17 +66,16 @@
 #include "nsCycleCollector.h"
 #include "nsDataHashtable.h"
 #include "nsDocShellCID.h"
 #include "nsDocument.h"
 #include "nsDOMCID.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "nsDOMJSUtils.h"
 #include "nsDOMMutationObserver.h"
-#include "nsDOMTouchEvent.h"
 #include "nsError.h"
 #include "nsEventDispatcher.h"
 #include "nsEventListenerManager.h"
 #include "nsEventStateManager.h"
 #include "nsFocusManager.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGenericHTMLFrameElement.h"
 #include "nsGkAtoms.h"
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -174,18 +174,18 @@
 #include "mozilla/dom/DOMImplementation.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "mozilla/dom/Comment.h"
 #include "nsTextNode.h"
 #include "mozilla/dom/Link.h"
 #include "mozilla/dom/HTMLElementBinding.h"
 #include "mozilla/dom/SVGElementBinding.h"
 #include "nsXULAppAPI.h"
-#include "nsDOMTouchEvent.h"
 #include "mozilla/dom/Touch.h"
+#include "mozilla/dom/TouchEvent.h"
 #include "DictionaryHelpers.h"
 #include "GeneratedEvents.h"
 
 #include "mozilla/Preferences.h"
 
 #include "imgILoader.h"
 #include "imgRequestProxy.h"
 #include "nsWrapperCacheInlines.h"
@@ -10008,39 +10008,39 @@ nsIDocument::CreateTouch(nsIDOMWindow* a
                                     aScreenX, aScreenY,
                                     aClientX, aClientY,
                                     aRadiusX, aRadiusY,
                                     aRotationAngle,
                                     aForce);
   return touch.forget();
 }
 
-already_AddRefed<nsDOMTouchList>
+already_AddRefed<TouchList>
 nsIDocument::CreateTouchList()
 {
-  nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList(ToSupports(this));
+  nsRefPtr<TouchList> retval = new TouchList(ToSupports(this));
   return retval.forget();
 }
 
-already_AddRefed<nsDOMTouchList>
+already_AddRefed<TouchList>
 nsIDocument::CreateTouchList(Touch& aTouch,
                              const Sequence<OwningNonNull<Touch> >& aTouches)
 {
-  nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList(ToSupports(this));
+  nsRefPtr<TouchList> retval = new TouchList(ToSupports(this));
   retval->Append(&aTouch);
   for (uint32_t i = 0; i < aTouches.Length(); ++i) {
     retval->Append(aTouches[i].get());
   }
   return retval.forget();
 }
 
-already_AddRefed<nsDOMTouchList>
+already_AddRefed<TouchList>
 nsIDocument::CreateTouchList(const Sequence<OwningNonNull<Touch> >& aTouches)
 {
-  nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList(ToSupports(this));
+  nsRefPtr<TouchList> retval = new TouchList(ToSupports(this));
   for (uint32_t i = 0; i < aTouches.Length(); ++i) {
     retval->Append(aTouches[i].get());
   }
   return retval.forget();
 }
 
 already_AddRefed<nsDOMCaretPosition>
 nsIDocument::CaretPositionFromPoint(float aX, float aY)
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -92,19 +92,19 @@
 #include "mozilla/BloomFilter.h"
 
 #include "HTMLPropertiesCollection.h"
 #include "nsVariant.h"
 #include "nsDOMSettableTokenList.h"
 #include "nsThreadUtils.h"
 #include "nsTextFragment.h"
 #include "mozilla/dom/BindingUtils.h"
+#include "mozilla/dom/TouchEvent.h"
 #include "mozilla/ErrorResult.h"
 #include "nsHTMLDocument.h"
-#include "nsDOMTouchEvent.h"
 #include "nsGlobalWindow.h"
 #include "mozilla/dom/HTMLBodyElement.h"
 #include "imgIContainer.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 class nsINodeInfo;
@@ -1950,17 +1950,17 @@ nsGenericHTMLElement::SetUndoScopeIntern
   }
   return NS_OK;
 }
 
 // static
 bool
 nsGenericHTMLElement::TouchEventsEnabled(JSContext* /* unused */, JSObject* /* unused */)
 {
-  return nsDOMTouchEvent::PrefEnabled();
+  return TouchEvent::PrefEnabled();
 }
 
 //----------------------------------------------------------------------
 
 nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo)
   , mForm(nullptr)
   , mFieldSet(nullptr)
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -131,17 +131,17 @@
 
 // Drag and drop
 #include "nsIDOMFile.h"
 #include "nsDOMBlobBuilder.h" // nsDOMMultipartFile
 
 #include "nsIEventListenerService.h"
 #include "nsIMessageManager.h"
 
-#include "nsDOMTouchEvent.h"
+#include "mozilla/dom/TouchEvent.h"
 
 #include "nsWrapperCacheInlines.h"
 #include "mozilla/dom/HTMLCollectionBinding.h"
 
 #include "nsIDOMMobileMessageManager.h"
 #include "nsIDOMMozSmsMessage.h"
 #include "nsIDOMMozMmsMessage.h"
 #include "nsIDOMSmsFilter.h"
@@ -863,27 +863,27 @@ nsDOMClassInfo::RegisterExternalClasses(
   DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)                                        \
   DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowB2G)                                     \
   DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)                                      \
   DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)                                   \
   DOM_CLASSINFO_MAP_ENTRY(nsIInlineEventHandlers)                              \
   DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance)                             \
   DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor)                               \
   DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver,                   \
-                                      nsDOMTouchEvent::PrefEnabled())
+                                      TouchEvent::PrefEnabled())
 #else // !MOZ_B2G
 #define DOM_CLASSINFO_WINDOW_MAP_ENTRIES                                       \
   DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)                                        \
   DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)                                      \
   DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)                                   \
   DOM_CLASSINFO_MAP_ENTRY(nsIInlineEventHandlers)                              \
   DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance)                             \
   DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor)                               \
   DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver,                   \
-                                      nsDOMTouchEvent::PrefEnabled())
+                                      TouchEvent::PrefEnabled())
 #endif // MOZ_B2G
 
 nsresult
 nsDOMClassInfo::Init()
 {
   /* Errors that can trigger early returns are done first,
      otherwise nsDOMClassInfo is left in a half inited state. */
   static_assert(sizeof(uintptr_t) == sizeof(void*),
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1226,23 +1226,18 @@ DOMInterfaces = {
 'TimeEvent': {
     'nativeType': 'nsDOMTimeEvent',
 },
 
 'TimeRanges': {
     'wrapperCache': False
 },
 
-'TouchEvent': {
-    'nativeType': 'nsDOMTouchEvent',
-},
-
 'TouchList': {
-    'nativeType': 'nsDOMTouchList',
-    'headerFile': 'nsDOMTouchEvent.h',
+    'headerFile': 'mozilla/dom/TouchEvent.h',
 },
 
 'TransitionEvent': {
     'nativeType': 'nsDOMTransitionEvent',
 },
 
 'TreeColumns': {
     'nativeType': 'nsTreeColumns',
--- a/dom/events/Touch.cpp
+++ b/dom/events/Touch.cpp
@@ -2,24 +2,24 @@
 /* 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 "mozilla/dom/EventTarget.h"
 #include "mozilla/dom/TouchBinding.h"
+#include "mozilla/dom/TouchEvent.h"
 #include "nsContentUtils.h"
-#include "nsDOMTouchEvent.h"
 #include "nsIContent.h"
 
 namespace mozilla {
 namespace dom {
 
-Touch::Touch(mozilla::dom::EventTarget* aTarget,
+Touch::Touch(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,
@@ -66,20 +66,21 @@ Touch::Touch(int32_t aIdentifier,
   mMessage = 0;
   nsJSContext::LikelyShortLivingObjectCreated();
 }
 
 Touch::~Touch()
 {
 }
 
- /* static */ bool
+// static
+bool
 Touch::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
 {
-  return nsDOMTouchEvent::PrefEnabled(aCx, aGlobal);
+  return TouchEvent::PrefEnabled(aCx, aGlobal);
 }
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(Touch, mTarget)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Touch)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
@@ -112,31 +113,31 @@ Touch::InitializePoints(nsPresContext* a
     aPresContext, aEvent, LayoutDeviceIntPoint::FromUntyped(mRefPoint),
     mClientPoint);
   mScreenPoint = nsDOMEvent::GetScreenCoords(aPresContext, aEvent,
     LayoutDeviceIntPoint::FromUntyped(mRefPoint));
   mPointsInitialized = true;
 }
 
 void
-Touch::SetTarget(mozilla::dom::EventTarget* aTarget)
+Touch::SetTarget(EventTarget* aTarget)
 {
   mTarget = aTarget;
 }
 
 bool
 Touch::Equals(Touch* aTouch)
 {
   return mRefPoint == aTouch->mRefPoint &&
          mForce == aTouch->Force() &&
          mRotationAngle == aTouch->RotationAngle() &&
          mRadius.x == aTouch->RadiusX() &&
          mRadius.y == aTouch->RadiusY();
 }
 
-/* virtual */ JSObject*
+JSObject*
 Touch::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   return TouchBinding::Wrap(aCx, aScope, this);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/events/Touch.h
+++ b/dom/events/Touch.h
@@ -1,15 +1,15 @@
 /* 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/. */
 
-#ifndef mozilla_dom_Touch_h
-#define mozilla_dom_Touch_h
+#ifndef mozilla_dom_Touch_h_
+#define mozilla_dom_Touch_h_
 
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/MouseEvents.h"
 #include "nsWrapperCache.h"
 #include "nsAutoPtr.h"
 #include "Units.h"
 
@@ -22,17 +22,17 @@ class EventTarget;
 
 class Touch MOZ_FINAL : public nsISupports
                       , public nsWrapperCache
                       , public WidgetPointerHelper
 {
 public:
   static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
 
-  Touch(mozilla::dom::EventTarget* aTarget,
+  Touch(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,
@@ -47,17 +47,17 @@ public:
 
   ~Touch();
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch)
 
   void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
 
-  void SetTarget(mozilla::dom::EventTarget* aTarget);
+  void SetTarget(EventTarget* aTarget);
 
   bool Equals(Touch* aTouch);
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
   EventTarget* GetParentObject() { return mTarget; }
 
   // WebIDL
@@ -87,9 +87,9 @@ public:
   float mForce;
 protected:
   bool mPointsInitialized;
 };
 
 } // namespace dom
 } // namespace mozilla
 
-#endif // mozilla_dom_Touch_h
+#endif // mozilla_dom_Touch_h_
rename from dom/events/nsDOMTouchEvent.cpp
rename to dom/events/TouchEvent.cpp
--- a/dom/events/nsDOMTouchEvent.cpp
+++ b/dom/events/TouchEvent.cpp
@@ -1,107 +1,118 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsDOMTouchEvent.h"
-#include "nsContentUtils.h"
-#include "mozilla/Preferences.h"
+#include "mozilla/dom/TouchEvent.h"
 #include "mozilla/dom/Touch.h"
 #include "mozilla/dom/TouchListBinding.h"
+#include "mozilla/Preferences.h"
 #include "mozilla/TouchEvents.h"
+#include "nsContentUtils.h"
+
+namespace mozilla {
 
-using namespace mozilla;
-using namespace mozilla::dom;
+#ifdef XP_WIN
+namespace widget {
+extern int32_t IsTouchDeviceSupportPresent();
+} // namespace widget
+#endif // #ifdef XP_WIN
 
-// TouchList
+namespace dom {
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMTouchList)
+/******************************************************************************
+ * TouchList
+ *****************************************************************************/
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TouchList)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(nsDOMTouchList, mParent, mPoints)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(TouchList, mParent, mPoints)
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTouchList)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMTouchList)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(TouchList)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(TouchList)
 
-/* virtual */ JSObject*
-nsDOMTouchList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
+JSObject*
+TouchList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   return TouchListBinding::Wrap(aCx, aScope, this);
 }
 
-/* static */ bool
-nsDOMTouchList::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
+// static
+bool
+TouchList::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
 {
-  return nsDOMTouchEvent::PrefEnabled(aCx, aGlobal);
+  return TouchEvent::PrefEnabled(aCx, aGlobal);
 }
 
 Touch*
-nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const
+TouchList::IdentifiedTouch(int32_t aIdentifier) const
 {
   for (uint32_t i = 0; i < mPoints.Length(); ++i) {
     Touch* point = mPoints[i];
     if (point && point->Identifier() == aIdentifier) {
       return point;
     }
   }
   return nullptr;
 }
 
-// TouchEvent
+/******************************************************************************
+ * TouchEvent
+ *****************************************************************************/
 
-nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
-                                 nsPresContext* aPresContext,
-                                 WidgetTouchEvent* aEvent)
+TouchEvent::TouchEvent(EventTarget* aOwner,
+                       nsPresContext* aPresContext,
+                       WidgetTouchEvent* aEvent)
   : nsDOMUIEvent(aOwner, aPresContext,
                  aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
 {
   if (aEvent) {
     mEventIsInternal = false;
 
     for (uint32_t i = 0; i < aEvent->touches.Length(); ++i) {
       Touch* touch = aEvent->touches[i];
       touch->InitializePoints(mPresContext, aEvent);
     }
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
 }
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED_3(nsDOMTouchEvent, nsDOMUIEvent,
+NS_IMPL_CYCLE_COLLECTION_INHERITED_3(TouchEvent, nsDOMUIEvent,
                                      mTouches,
                                      mTargetTouches,
                                      mChangedTouches)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMTouchEvent)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TouchEvent)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
 
-NS_IMPL_ADDREF_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
-
+NS_IMPL_ADDREF_INHERITED(TouchEvent, nsDOMUIEvent)
+NS_IMPL_RELEASE_INHERITED(TouchEvent, nsDOMUIEvent)
 
 void
-nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
-                                bool aCanBubble,
-                                bool aCancelable,
-                                nsIDOMWindow* aView,
-                                int32_t aDetail,
-                                bool aCtrlKey,
-                                bool aAltKey,
-                                bool aShiftKey,
-                                bool aMetaKey,
-                                nsDOMTouchList* aTouches,
-                                nsDOMTouchList* aTargetTouches,
-                                nsDOMTouchList* aChangedTouches,
-                                mozilla::ErrorResult& aRv)
+TouchEvent::InitTouchEvent(const nsAString& aType,
+                           bool aCanBubble,
+                           bool aCancelable,
+                           nsIDOMWindow* aView,
+                           int32_t aDetail,
+                           bool aCtrlKey,
+                           bool aAltKey,
+                           bool aShiftKey,
+                           bool aMetaKey,
+                           TouchList* aTouches,
+                           TouchList* aTargetTouches,
+                           TouchList* aChangedTouches,
+                           ErrorResult& aRv)
 {
   aRv = nsDOMUIEvent::InitUIEvent(aType,
                                   aCanBubble,
                                   aCancelable,
                                   aView,
                                   aDetail);
   if (aRv.Failed()) {
     return;
@@ -109,99 +120,93 @@ nsDOMTouchEvent::InitTouchEvent(const ns
 
   mEvent->AsInputEvent()->InitBasicModifiers(aCtrlKey, aAltKey,
                                              aShiftKey, aMetaKey);
   mTouches = aTouches;
   mTargetTouches = aTargetTouches;
   mChangedTouches = aChangedTouches;
 }
 
-nsDOMTouchList*
-nsDOMTouchEvent::Touches()
+TouchList*
+TouchEvent::Touches()
 {
   if (!mTouches) {
     WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
     if (mEvent->message == NS_TOUCH_END || mEvent->message == NS_TOUCH_CANCEL) {
       // for touchend events, remove any changed touches from the touches array
       nsTArray< nsRefPtr<Touch> > unchangedTouches;
       const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
       for (uint32_t i = 0; i < touches.Length(); ++i) {
         if (!touches[i]->mChanged) {
           unchangedTouches.AppendElement(touches[i]);
         }
       }
-      mTouches = new nsDOMTouchList(ToSupports(this), unchangedTouches);
+      mTouches = new TouchList(ToSupports(this), unchangedTouches);
     } else {
-      mTouches = new nsDOMTouchList(ToSupports(this), touchEvent->touches);
+      mTouches = new TouchList(ToSupports(this), touchEvent->touches);
     }
   }
   return mTouches;
 }
 
-nsDOMTouchList*
-nsDOMTouchEvent::TargetTouches()
+TouchList*
+TouchEvent::TargetTouches()
 {
   if (!mTargetTouches) {
     nsTArray< nsRefPtr<Touch> > targetTouches;
     WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
     const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
     for (uint32_t i = 0; i < touches.Length(); ++i) {
       // for touchend/cancel events, don't append to the target list if this is a
       // touch that is ending
       if ((mEvent->message != NS_TOUCH_END &&
            mEvent->message != NS_TOUCH_CANCEL) || !touches[i]->mChanged) {
         if (touches[i]->mTarget == mEvent->originalTarget) {
           targetTouches.AppendElement(touches[i]);
         }
       }
     }
-    mTargetTouches = new nsDOMTouchList(ToSupports(this), targetTouches);
+    mTargetTouches = new TouchList(ToSupports(this), targetTouches);
   }
   return mTargetTouches;
 }
 
-nsDOMTouchList*
-nsDOMTouchEvent::ChangedTouches()
+TouchList*
+TouchEvent::ChangedTouches()
 {
   if (!mChangedTouches) {
     nsTArray< nsRefPtr<Touch> > changedTouches;
     WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
     const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
     for (uint32_t i = 0; i < touches.Length(); ++i) {
       if (touches[i]->mChanged) {
         changedTouches.AppendElement(touches[i]);
       }
     }
-    mChangedTouches = new nsDOMTouchList(ToSupports(this), changedTouches);
+    mChangedTouches = new TouchList(ToSupports(this), changedTouches);
   }
   return mChangedTouches;
 }
 
-#ifdef XP_WIN
-namespace mozilla {
-namespace widget {
-extern int32_t IsTouchDeviceSupportPresent();
-} }
-#endif
-
+// static
 bool
-nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
+TouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
 {
   bool prefValue = false;
   int32_t flag = 0;
   if (NS_SUCCEEDED(Preferences::GetInt("dom.w3c_touch_events.enabled",
                                         &flag))) {
     if (flag == 2) {
 #ifdef XP_WIN
       static bool sDidCheckTouchDeviceSupport = false;
       static bool sIsTouchDeviceSupportPresent = false;
       // On Windows we auto-detect based on device support.
       if (!sDidCheckTouchDeviceSupport) {
         sDidCheckTouchDeviceSupport = true;
-        sIsTouchDeviceSupportPresent = mozilla::widget::IsTouchDeviceSupportPresent();
+        sIsTouchDeviceSupportPresent = widget::IsTouchDeviceSupportPresent();
       }
       prefValue = sIsTouchDeviceSupportPresent;
 #else
       NS_WARNING("dom.w3c_touch_events.enabled=2 not implemented!");
       prefValue = false;
 #endif
     } else {
       prefValue = !!flag;
@@ -209,40 +214,46 @@ nsDOMTouchEvent::PrefEnabled(JSContext* 
   }
   if (prefValue) {
     nsContentUtils::InitializeTouchEventTable();
   }
   return prefValue;
 }
 
 bool
-nsDOMTouchEvent::AltKey()
+TouchEvent::AltKey()
 {
   return mEvent->AsTouchEvent()->IsAlt();
 }
 
 bool
-nsDOMTouchEvent::MetaKey()
+TouchEvent::MetaKey()
 {
   return mEvent->AsTouchEvent()->IsMeta();
 }
 
 bool
-nsDOMTouchEvent::CtrlKey()
+TouchEvent::CtrlKey()
 {
   return mEvent->AsTouchEvent()->IsControl();
 }
 
 bool
-nsDOMTouchEvent::ShiftKey()
+TouchEvent::ShiftKey()
 {
   return mEvent->AsTouchEvent()->IsShift();
 }
 
+} // namespace dom
+} // namespace mozilla
+
+using namespace mozilla;
+using namespace mozilla::dom;
+
 nsresult
 NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
-                    mozilla::dom::EventTarget* aOwner,
+                    EventTarget* aOwner,
                     nsPresContext* aPresContext,
                     WidgetTouchEvent* aEvent)
 {
-  nsDOMTouchEvent* it = new nsDOMTouchEvent(aOwner, aPresContext, aEvent);
+  TouchEvent* it = new TouchEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(it, aInstancePtrResult);
 }
rename from dom/events/nsDOMTouchEvent.h
rename to dom/events/TouchEvent.h
--- a/dom/events/nsDOMTouchEvent.h
+++ b/dom/events/TouchEvent.h
@@ -1,65 +1,66 @@
 /* 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/. */
-#ifndef nsDOMTouchEvent_h_
-#define nsDOMTouchEvent_h_
+#ifndef mozilla_dom_TouchEvent_h_
+#define mozilla_dom_TouchEvent_h_
 
 #include "nsDOMUIEvent.h"
 #include "nsTArray.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "nsJSEnvironment.h"
 #include "mozilla/dom/Touch.h"
 #include "mozilla/dom/TouchEventBinding.h"
 #include "nsWrapperCache.h"
 
-
 class nsAString;
 
-class nsDOMTouchList MOZ_FINAL : public nsISupports
-                               , public nsWrapperCache
+namespace mozilla {
+namespace dom {
+
+class TouchList MOZ_FINAL : public nsISupports
+                          , public nsWrapperCache
 {
-  typedef mozilla::dom::Touch Touch;
-
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMTouchList)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TouchList)
 
-  nsDOMTouchList(nsISupports* aParent)
+  TouchList(nsISupports* aParent)
     : mParent(aParent)
   {
     SetIsDOMBinding();
     nsJSContext::LikelyShortLivingObjectCreated();
   }
-  nsDOMTouchList(nsISupports* aParent,
-                 const nsTArray< nsRefPtr<Touch> >& aTouches)
+  TouchList(nsISupports* aParent,
+            const nsTArray<nsRefPtr<Touch> >& aTouches)
     : mParent(aParent)
     , mPoints(aTouches)
   {
     SetIsDOMBinding();
     nsJSContext::LikelyShortLivingObjectCreated();
   }
 
   void Append(Touch* aPoint)
   {
     mPoints.AppendElement(aPoint);
   }
 
-  virtual JSObject*
-  WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
+  virtual JSObject* WrapObject(JSContext* aCx,
+                               JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
   nsISupports* GetParentObject() const
   {
     return mParent;
   }
 
-  static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
+  static bool PrefEnabled(JSContext* aCx = nullptr,
+                          JSObject* aGlobal = nullptr);
 
   uint32_t Length() const
   {
     return mPoints.Length();
   }
   Touch* Item(uint32_t aIndex) const
   {
     return mPoints.SafeElementAt(aIndex);
@@ -71,58 +72,62 @@ public:
       return nullptr;
     }
     return mPoints[aIndex];
   }
   Touch* IdentifiedTouch(int32_t aIdentifier) const;
 
 protected:
   nsCOMPtr<nsISupports> mParent;
-  nsTArray< nsRefPtr<Touch> > mPoints;
+  nsTArray<nsRefPtr<Touch> > mPoints;
 };
 
-class nsDOMTouchEvent : public nsDOMUIEvent
+class TouchEvent : public nsDOMUIEvent
 {
 public:
-  nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
-                  nsPresContext* aPresContext,
-                  mozilla::WidgetTouchEvent* aEvent);
+  TouchEvent(EventTarget* aOwner,
+             nsPresContext* aPresContext,
+             WidgetTouchEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TouchEvent, nsDOMUIEvent)
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
-    return mozilla::dom::TouchEventBinding::Wrap(aCx, aScope, this);
+    return TouchEventBinding::Wrap(aCx, aScope, this);
   }
 
-  nsDOMTouchList* Touches();
-  nsDOMTouchList* TargetTouches();
-  nsDOMTouchList* ChangedTouches();
+  TouchList* Touches();
+  TouchList* TargetTouches();
+  TouchList* ChangedTouches();
 
   bool AltKey();
   bool MetaKey();
   bool CtrlKey();
   bool ShiftKey();
 
   void InitTouchEvent(const nsAString& aType,
                       bool aCanBubble,
                       bool aCancelable,
                       nsIDOMWindow* aView,
                       int32_t aDetail,
                       bool aCtrlKey,
                       bool aAltKey,
                       bool aShiftKey,
                       bool aMetaKey,
-                      nsDOMTouchList* aTouches,
-                      nsDOMTouchList* aTargetTouches,
-                      nsDOMTouchList* aChangedTouches,
-                      mozilla::ErrorResult& aRv);
+                      TouchList* aTouches,
+                      TouchList* aTargetTouches,
+                      TouchList* aChangedTouches,
+                      ErrorResult& aRv);
 
-  static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
+  static bool PrefEnabled(JSContext* aCx = nullptr,
+                          JSObject* aGlobal = nullptr);
 protected:
-  nsRefPtr<nsDOMTouchList> mTouches;
-  nsRefPtr<nsDOMTouchList> mTargetTouches;
-  nsRefPtr<nsDOMTouchList> mChangedTouches;
+  nsRefPtr<TouchList> mTouches;
+  nsRefPtr<TouchList> mTargetTouches;
+  nsRefPtr<TouchList> mChangedTouches;
 };
 
-#endif /* !defined(nsDOMTouchEvent_h_) */
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_TouchEvent_h_
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -13,17 +13,16 @@ XPIDL_SOURCES += [
 
 XPIDL_MODULE = 'content_events'
 
 EXPORTS += [
     'nsAsyncDOMEvent.h',
     'nsDOMEvent.h',
     'nsDOMEventTargetHelper.h',
     'nsDOMKeyNameList.h',
-    'nsDOMTouchEvent.h',
     'nsDOMUIEvent.h',
     'nsEventDispatcher.h',
     'nsEventListenerManager.h',
     'nsEventNameList.h',
     'nsEventStateManager.h',
     'nsEventStates.h',
     'nsIJSEventListener.h',
     'nsIPrivateTextEvent.h',
@@ -50,16 +49,17 @@ EXPORTS.mozilla.dom += [
     'KeyboardEvent.h',
     'MessageEvent.h',
     'MouseEvent.h',
     'MouseScrollEvent.h',
     'MutationEvent.h',
     'PointerEvent.h',
     'SimpleGestureEvent.h',
     'Touch.h',
+    'TouchEvent.h',
     'WheelEvent.h',
 ]
 
 if CONFIG['MOZ_WEBSPEECH']:
     EXPORTS.mozilla.dom += ['SpeechRecognitionError.h']
 
 UNIFIED_SOURCES += [
     'AnimationEvent.cpp',
@@ -78,29 +78,29 @@ UNIFIED_SOURCES += [
     'MouseEvent.cpp',
     'MouseScrollEvent.cpp',
     'MutationEvent.cpp',
     'nsAsyncDOMEvent.cpp',
     'nsContentEventHandler.cpp',
     'nsDOMEventTargetHelper.cpp',
     'nsDOMNotifyAudioAvailableEvent.cpp',
     'nsDOMTextEvent.cpp',
-    'nsDOMTouchEvent.cpp',
     'nsDOMTransitionEvent.cpp',
     'nsDOMXULCommandEvent.cpp',
     'nsEventDispatcher.cpp',
     'nsEventListenerService.cpp',
     'nsIMEStateManager.cpp',
     'nsJSEventListener.cpp',
     'nsPaintRequest.cpp',
     'nsPrivateTextRange.cpp',
     'PointerEvent.cpp',
     'SimpleGestureEvent.cpp',
     'TextComposition.cpp',
     'Touch.cpp',
+    'TouchEvent.cpp',
     'WheelEvent.cpp',
 ]
 
 SOURCES += [
     # nsDOMEvent.cpp should be built separately because it includes
     # ipc/IPCMessageUtils.h, which on Windows includes windows.h.
     'nsDOMEvent.cpp',
     # nsDOMEvent.cpp should be built separately because it includes
--- a/dom/events/nsEventDispatcher.cpp
+++ b/dom/events/nsEventDispatcher.cpp
@@ -9,21 +9,21 @@
 #include "nsEventListenerManager.h"
 #include "nsContentUtils.h"
 #include "nsError.h"
 #include <new>
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsINode.h"
 #include "nsPIDOMWindow.h"
-#include "nsDOMTouchEvent.h"
 #include "GeckoProfiler.h"
 #include "GeneratedEvents.h"
 #include "mozilla/ContentEvents.h"
 #include "mozilla/dom/EventTarget.h"
+#include "mozilla/dom/TouchEvent.h"
 #include "mozilla/InternalMutationEvent.h"
 #include "mozilla/MiscEvents.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TouchEvents.h"
 #include "mozilla/unused.h"
 
 using namespace mozilla;
@@ -813,17 +813,17 @@ nsEventDispatcher::CreateEvent(mozilla::
     return NS_NewDOMScrollAreaEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("popstateevent"))
     return NS_NewDOMPopStateEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("mozaudioavailableevent"))
     return NS_NewDOMAudioAvailableEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("closeevent"))
     return NS_NewDOMCloseEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("touchevent") &&
-      nsDOMTouchEvent::PrefEnabled())
+      TouchEvent::PrefEnabled())
     return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("hashchangeevent"))
     return NS_NewDOMHashChangeEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("customevent"))
     return NS_NewDOMCustomEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("mozsmsevent"))
     return NS_NewDOMMozSmsEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("mozmmsevent"))
--- a/dom/webidl/TouchEvent.webidl
+++ b/dom/webidl/TouchEvent.webidl
@@ -1,17 +1,17 @@
 /* -*- 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/.
  */
 
 interface WindowProxy;
 
-[Func="nsDOMTouchEvent::PrefEnabled"]
+[Func="mozilla::dom::TouchEvent::PrefEnabled"]
 interface TouchEvent : UIEvent {
   readonly attribute TouchList touches;
   readonly attribute TouchList targetTouches;
   readonly attribute TouchList changedTouches;
 
   readonly attribute boolean altKey;
   readonly attribute boolean metaKey;
   readonly attribute boolean ctrlKey;
--- a/dom/webidl/TouchList.webidl
+++ b/dom/webidl/TouchList.webidl
@@ -5,17 +5,17 @@
  *
  * The origin of this IDL file is
  * https://dvcs.w3.org/hg/webevents/raw-file/v1/touchevents.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[Func="nsDOMTouchList::PrefEnabled"]
+[Func="mozilla::dom::TouchList::PrefEnabled"]
 interface TouchList {
   [Pure]
   readonly attribute unsigned long length;
   getter Touch? item(unsigned long index);
 };
 
 /* Mozilla extension. */
 partial interface TouchList {
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -66,17 +66,17 @@ static nsresult GetColorFromTheme(nsUXTh
 static int32_t GetSystemParam(long flag, int32_t def)
 {
     DWORD value; 
     return ::SystemParametersInfo(flag, 0, &value, 0) ? value : def;
 }
 
 namespace mozilla {
 namespace widget {
-// This is in use here and in nsDOMTouchEvent.cpp
+// This is in use here and in dom/events/TouchEvent.cpp
 int32_t IsTouchDeviceSupportPresent()
 {
   int32_t touchCapabilities;
   touchCapabilities = ::GetSystemMetrics(SM_DIGITIZER);
   return ((touchCapabilities & NID_READY) && 
           (touchCapabilities & (NID_EXTERNAL_TOUCH | NID_INTEGRATED_TOUCH)));
 }
 } }