Bug 764355 - Add a new edge swipe simple gesture and add a click count value to existing tap gestures for Win8. r=felipe
authorJim Mathies <jmathies@mozilla.com>
Thu, 14 Jun 2012 12:40:12 -0500
changeset 96729 542d031d6c3ffe3c11c34feca827a8891000f576
parent 96728 5674051c17d7fc5b0d1d188594a762895173f434
child 96730 f99f6a959ed93f9c29da6289ee34a4a891daf525
push id853
push usertim.taubert@gmx.de
push dateSat, 16 Jun 2012 10:37:54 +0000
treeherderfx-team@4a457dd9d433 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs764355
milestone16.0a1
Bug 764355 - Add a new edge swipe simple gesture and add a click count value to existing tap gestures for Win8. r=felipe
browser/base/content/test/browser_gestureSupport.js
content/base/src/nsGkAtomList.h
content/events/public/nsEventNameList.h
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMEvent.h
content/events/src/nsDOMSimpleGestureEvent.cpp
dom/base/nsDOMWindowUtils.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
dom/interfaces/events/nsIDOMSimpleGestureEvent.idl
mobile/xul/chrome/content/browser.js
widget/nsGUIEvent.h
widget/windows/nsWinGesture.cpp
--- a/browser/base/content/test/browser_gestureSupport.js
+++ b/browser/base/content/test/browser_gestureSupport.js
@@ -40,16 +40,17 @@ function test()
   test_thresholdGesture("twist", "right", "left", "MozRotateGesture");
 }
 
 let test_eventCount = 0;
 let test_expectedType;
 let test_expectedDirection;
 let test_expectedDelta;
 let test_expectedModifiers;
+let test_expectedClickCount;
 
 function test_gestureListener(evt)
 {
   is(evt.type, test_expectedType,
      "evt.type (" + evt.type + ") does not match expected value");
   is(evt.target, test_utils.elementFromPoint(20, 20, false, false),
      "evt.target (" + evt.target + ") does not match expected value");
   is(evt.clientX, 20,
@@ -70,16 +71,20 @@ function test_gestureListener(evt)
      "evt.shiftKey did not match expected value");
   is(evt.ctrlKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.CONTROL_MASK) != 0,
      "evt.ctrlKey did not match expected value");
   is(evt.altKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.ALT_MASK) != 0,
      "evt.altKey did not match expected value");
   is(evt.metaKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.META_MASK) != 0,
      "evt.metaKey did not match expected value");
 
+  if (evt.type == "MozTapGesture") {
+    is(evt.clickCount, test_expectedClickCount, "evt.clickCount does not match");
+  }
+
   test_eventCount++;
 }
 
 function test_helper1(type, direction, delta, modifiers)
 {
   // Setup the expected values
   test_expectedType = type;
   test_expectedDirection = direction;
@@ -90,16 +95,34 @@ function test_helper1(type, direction, d
 
   document.addEventListener(type, test_gestureListener, true);
   test_utils.sendSimpleGestureEvent(type, 20, 20, direction, delta, modifiers);
   document.removeEventListener(type, test_gestureListener, true);
 
   is(expectedEventCount, test_eventCount, "Event (" + type + ") was never received by event listener");
 }
 
+function test_clicks(type, clicks)
+{
+  // Setup the expected values
+  test_expectedType = type;
+  test_expectedDirection = 0;
+  test_expectedDelta = 0;
+  test_expectedModifiers = 0;
+  test_expectedClickCount = clicks;
+
+  let expectedEventCount = test_eventCount + 1;
+
+  document.addEventListener(type, test_gestureListener, true);
+  test_utils.sendSimpleGestureEvent(type, 20, 20, 0, 0, 0, clicks);
+  document.removeEventListener(type, test_gestureListener, true);
+
+  is(expectedEventCount, test_eventCount, "Event (" + type + ") was never received by event listener");
+}
+
 function test_TestEventListeners()
 {
   let e = test_helper1;  // easier to type this name
 
   // Swipe gesture event
   e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_LEFT, 0.0, 0);
   e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0.0, 0);
   e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_UP, 0.0, 0);
@@ -121,18 +144,23 @@ function test_TestEventListeners()
 
   // rotate gesture events
   e("MozRotateGestureStart", SimpleGestureEvent.ROTATION_CLOCKWISE, 33.0, 0);
   e("MozRotateGestureUpdate", SimpleGestureEvent.ROTATION_COUNTERCLOCKWISE, -13.0, 0);
   e("MozRotateGestureUpdate", SimpleGestureEvent.ROTATION_CLOCKWISE, 13.0, 0);
   e("MozRotateGesture", SimpleGestureEvent.ROTATION_CLOCKWISE, 33.0, 0);
   
   // Tap and presstap gesture events
-  e("MozTapGesture", 0, 0.0, 0);
-  e("MozPressTapGesture", 0, 0.0, 0);
+  test_clicks("MozTapGesture", 1);
+  test_clicks("MozTapGesture", 2);
+  test_clicks("MozTapGesture", 3);
+  test_clicks("MozPressTapGesture", 1);
+
+  // simple delivery test for edgeui gesture
+  e("MozEdgeUIGesture", 0, 0, 0);
 
   // event.shiftKey
   let modifier = Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
   e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
 
   // event.metaKey
   modifier = Components.interfaces.nsIDOMNSEvent.META_MASK;
   e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
@@ -166,17 +194,17 @@ function test_helper2(type, direction, d
   }
   ok(successful, "Unable to create SimpleGestureEvent");
 
   try {
     event.initSimpleGestureEvent(type, true, true, window, 1,
                                  10, 10, 10, 10,
                                  ctrlKey, altKey, shiftKey, metaKey,
                                  1, window,
-                                 direction, delta);
+                                 direction, delta, 0);
     successful = true;
   }
   catch (ex) {
     successful = false;
   }
   ok(successful, "event.initSimpleGestureEvent should not fail");
 
   // Make sure the event fields match the expected values
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -1638,16 +1638,17 @@ GK_ATOM(onMozSwipeGesture, "onMozSwipeGe
 GK_ATOM(onMozMagnifyGestureStart, "onMozMagnifyGestureStart")
 GK_ATOM(onMozMagnifyGestureUpdate, "onMozMagnifyGestureUpdate")
 GK_ATOM(onMozMagnifyGesture, "onMozMagnifyGesture")
 GK_ATOM(onMozRotateGestureStart, "onMozRotateGestureStart")
 GK_ATOM(onMozRotateGestureUpdate, "onMozRotateGestureUpdate")
 GK_ATOM(onMozRotateGesture, "onMozRotateGesture")
 GK_ATOM(onMozTapGesture, "onMozTapGesture")
 GK_ATOM(onMozPressTapGesture, "onMozPressTapGesture")
+GK_ATOM(onMozEdgeUIGesture, "onMozEdgeUIGesture")
 
 // Touch events
 GK_ATOM(onMozTouchDown, "onMozTouchDown")
 GK_ATOM(onMozTouchMove, "onMozTouchMove")
 GK_ATOM(onMozTouchUp, "onMozTouchUp")
 
 // orientation support
 GK_ATOM(ondevicemotion, "ondevicemotion")
--- a/content/events/public/nsEventNameList.h
+++ b/content/events/public/nsEventNameList.h
@@ -707,16 +707,20 @@ NON_IDL_EVENT(MozRotateGesture,
 NON_IDL_EVENT(MozTapGesture,
               NS_SIMPLE_GESTURE_TAP,
               EventNameType_None,
               NS_SIMPLE_GESTURE_EVENT)
 NON_IDL_EVENT(MozPressTapGesture,
               NS_SIMPLE_GESTURE_PRESSTAP,
               EventNameType_None,
               NS_SIMPLE_GESTURE_EVENT)
+NON_IDL_EVENT(MozEdgeUIGesture,
+              NS_SIMPLE_GESTURE_EDGEUI,
+              EventNameType_None,
+              NS_SIMPLE_GESTURE_EVENT)
 
 NON_IDL_EVENT(MozTouchDown,
               NS_MOZTOUCH_DOWN,
               EventNameType_None,
               NS_MOZTOUCH_EVENT)
 NON_IDL_EVENT(MozTouchMove,
               NS_MOZTOUCH_MOVE,
               EventNameType_None,
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -72,16 +72,17 @@ static const char* const sEventNames[] =
   "MozMagnifyGestureStart",
   "MozMagnifyGestureUpdate",
   "MozMagnifyGesture",
   "MozRotateGestureStart",
   "MozRotateGestureUpdate",
   "MozRotateGesture",
   "MozTapGesture",
   "MozPressTapGesture",
+  "MozEdgeUIGesture",
   "MozTouchDown",
   "MozTouchMove",
   "MozTouchUp",
   "touchstart",
   "touchend",
   "touchmove",
   "touchcancel",
   "touchenter",
@@ -834,16 +835,17 @@ nsDOMEvent::DuplicatePrivateData()
     {
       nsSimpleGestureEvent* oldSimpleGestureEvent = static_cast<nsSimpleGestureEvent*>(mEvent);
       nsSimpleGestureEvent* simpleGestureEvent = 
         new nsSimpleGestureEvent(false, msg, nsnull, 0, 0.0);
       NS_ENSURE_TRUE(simpleGestureEvent, NS_ERROR_OUT_OF_MEMORY);
       isInputEvent = true;
       simpleGestureEvent->direction = oldSimpleGestureEvent->direction;
       simpleGestureEvent->delta = oldSimpleGestureEvent->delta;
+      simpleGestureEvent->clickCount = oldSimpleGestureEvent->clickCount;
       newEvent = simpleGestureEvent;
       break;
     }
     case NS_TRANSITION_EVENT:
     {
       nsTransitionEvent* oldTransitionEvent =
         static_cast<nsTransitionEvent*>(mEvent);
       newEvent = new nsTransitionEvent(false, msg,
@@ -1498,16 +1500,18 @@ const char* nsDOMEvent::GetEventName(PRU
   case NS_SIMPLE_GESTURE_ROTATE_UPDATE:
     return sEventNames[eDOMEvents_MozRotateGestureUpdate];
   case NS_SIMPLE_GESTURE_ROTATE:
     return sEventNames[eDOMEvents_MozRotateGesture];
   case NS_SIMPLE_GESTURE_TAP:
     return sEventNames[eDOMEvents_MozTapGesture];
   case NS_SIMPLE_GESTURE_PRESSTAP:
     return sEventNames[eDOMEvents_MozPressTapGesture];
+  case NS_SIMPLE_GESTURE_EDGEUI:
+    return sEventNames[eDOMEvents_MozEdgeUIGesture];
   case NS_MOZTOUCH_DOWN:
     return sEventNames[eDOMEvents_MozTouchDown];
   case NS_MOZTOUCH_MOVE:
     return sEventNames[eDOMEvents_MozTouchMove];
   case NS_MOZTOUCH_UP:
     return sEventNames[eDOMEvents_MozTouchUp];
   case NS_SCROLLEDAREACHANGED:
     return sEventNames[eDOMEvents_MozScrolledAreaChanged];
--- a/content/events/src/nsDOMEvent.h
+++ b/content/events/src/nsDOMEvent.h
@@ -155,16 +155,17 @@ public:
     eDOMEvents_MozMagnifyGestureStart,
     eDOMEvents_MozMagnifyGestureUpdate,
     eDOMEvents_MozMagnifyGesture,
     eDOMEvents_MozRotateGestureStart,
     eDOMEvents_MozRotateGestureUpdate,
     eDOMEvents_MozRotateGesture,
     eDOMEvents_MozTapGesture,
     eDOMEvents_MozPressTapGesture,
+    eDOMEvents_MozEdgeUIGesture,
     eDOMEvents_MozTouchDown,
     eDOMEvents_MozTouchMove,
     eDOMEvents_MozTouchUp,
     eDOMEvents_touchstart,
     eDOMEvents_touchend,
     eDOMEvents_touchmove,
     eDOMEvents_touchcancel,
     eDOMEvents_touchenter,
--- a/content/events/src/nsDOMSimpleGestureEvent.cpp
+++ b/content/events/src/nsDOMSimpleGestureEvent.cpp
@@ -54,16 +54,25 @@ nsDOMSimpleGestureEvent::GetDirection(PR
 NS_IMETHODIMP
 nsDOMSimpleGestureEvent::GetDelta(PRFloat64 *aDelta)
 {
   NS_ENSURE_ARG_POINTER(aDelta);
   *aDelta = static_cast<nsSimpleGestureEvent*>(mEvent)->delta;
   return NS_OK;
 }
 
+/* readonly attribute unsigned long clickCount; */
+NS_IMETHODIMP
+nsDOMSimpleGestureEvent::GetClickCount(PRUint32 *aClickCount)
+{
+  NS_ENSURE_ARG_POINTER(aClickCount);
+  *aClickCount = static_cast<nsSimpleGestureEvent*>(mEvent)->clickCount;
+  return NS_OK;
+}
+
 NS_IMETHODIMP
 nsDOMSimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg,
                                                 bool aCanBubbleArg,
                                                 bool aCancelableArg,
                                                 nsIDOMWindow* aViewArg,
                                                 PRInt32 aDetailArg,
                                                 PRInt32 aScreenX, 
                                                 PRInt32 aScreenY,
@@ -71,17 +80,18 @@ nsDOMSimpleGestureEvent::InitSimpleGestu
                                                 PRInt32 aClientY,
                                                 bool aCtrlKeyArg,
                                                 bool aAltKeyArg,
                                                 bool aShiftKeyArg,
                                                 bool aMetaKeyArg,
                                                 PRUint16 aButton,
                                                 nsIDOMEventTarget* aRelatedTarget,
                                                 PRUint32 aDirectionArg,
-                                                PRFloat64 aDeltaArg)
+                                                PRFloat64 aDeltaArg,
+                                                PRUint32 aClickCountArg)
 {
   nsresult rv = nsDOMMouseEvent::InitMouseEvent(aTypeArg,
                                                 aCanBubbleArg,
                                                 aCancelableArg,
                                                 aViewArg,
                                                 aDetailArg,
                                                 aScreenX, 
                                                 aScreenY,
@@ -93,16 +103,17 @@ nsDOMSimpleGestureEvent::InitSimpleGestu
                                                 aMetaKeyArg,
                                                 aButton,
                                                 aRelatedTarget);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsSimpleGestureEvent* simpleGestureEvent = static_cast<nsSimpleGestureEvent*>(mEvent);
   simpleGestureEvent->direction = aDirectionArg;
   simpleGestureEvent->delta = aDeltaArg;
+  simpleGestureEvent->clickCount = aClickCountArg;
 
   return NS_OK;
 }
 
 nsresult NS_NewDOMSimpleGestureEvent(nsIDOMEvent** aInstancePtrResult,
                                      nsPresContext* aPresContext,
                                      nsSimpleGestureEvent *aEvent)
 {
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1000,17 +1000,18 @@ nsDOMWindowUtils::CycleCollect(nsICycleC
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
                                          float aX,
                                          float aY,
                                          PRUint32 aDirection,
                                          PRFloat64 aDelta,
-                                         PRInt32 aModifiers)
+                                         PRInt32 aModifiers,
+                                         PRUint32 aClickCount)
 {
   if (!IsUniversalXPConnectCapable()) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   // get the widget to send the event to
   nsPoint offset;
   nsCOMPtr<nsIWidget> widget = GetWidget(&offset);
@@ -1031,21 +1032,24 @@ nsDOMWindowUtils::SendSimpleGestureEvent
   else if (aType.EqualsLiteral("MozRotateGestureUpdate"))
     msg = NS_SIMPLE_GESTURE_ROTATE_UPDATE;
   else if (aType.EqualsLiteral("MozRotateGesture"))
     msg = NS_SIMPLE_GESTURE_ROTATE;
   else if (aType.EqualsLiteral("MozTapGesture"))
     msg = NS_SIMPLE_GESTURE_TAP;
   else if (aType.EqualsLiteral("MozPressTapGesture"))
     msg = NS_SIMPLE_GESTURE_PRESSTAP;
+  else if (aType.EqualsLiteral("MozEdgeUIGesture"))
+    msg = NS_SIMPLE_GESTURE_EDGEUI;
   else
     return NS_ERROR_FAILURE;
  
   nsSimpleGestureEvent event(true, msg, widget, aDirection, aDelta);
   event.modifiers = GetWidgetModifiers(aModifiers);
+  event.clickCount = aClickCount;
   event.time = PR_IntervalNow();
 
   nsPresContext* presContext = GetPresContext();
   if (!presContext)
     return NS_ERROR_FAILURE;
 
   event.refPoint = ToWidgetPoint(aX, aY, offset, presContext);
 
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -485,36 +485,38 @@ interface nsIDOMWindowUtils : nsISupport
    *                                   which happens after garbage collection.
    */
   void cycleCollect([optional] in nsICycleCollectorListener aListener,
                     [optional] in long aExtraForgetSkippableCalls);
 
   /** Synthesize a simple gesture event for a window. The event types
    *  supported are: MozSwipeGesture, MozMagnifyGestureStart,
    *  MozMagnifyGestureUpdate, MozMagnifyGesture, MozRotateGestureStart,
-   *  MozRotateGestureUpdate, MozRotateGesture, MozPressTapGesture, and
-   *  MozTapGesture.
+   *  MozRotateGestureUpdate, MozRotateGesture, MozPressTapGesture,
+   *  MozTapGesture, and MozEdgeUIGesture.
    *
    * Cannot be accessed from unprivileged context (not
    * content-accessible) Will throw a DOM security error if called
    * without UniversalXPConnect privileges.
    *
    * @param aType event type
    * @param aX x offset in CSS pixels
    * @param aY y offset in CSS pixels
    * @param aDirection direction, using constants defined in nsIDOMSimpleGestureEvent
    * @param aDelta  amount of magnification or rotation for magnify and rotation events
    * @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
+   * @param aClickCount For tap gestures, the number of taps.
    */
   void sendSimpleGestureEvent(in AString aType,
                               in float aX,
                               in float aY,
                               in unsigned long aDirection,
                               in double aDelta,
-                              in long aModifiers);
+                              in long aModifiers,
+                              [optional] in unsigned long aClickCount);
 
   /**
    * Retrieve the element at point aX, aY in the window's document.
    *
    * @param aIgnoreRootScrollFrame whether or not to ignore the root scroll
    *        frame when retrieving the element. If false, this method returns
    *        null for coordinates outside of the viewport.
    * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
--- a/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl
+++ b/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl
@@ -52,25 +52,29 @@
  * (XXX Not implemented on Mac)
  *
  * MozPressTapGesture - Generated when the user executes a press
  * and tap two finger gesture (first finger down, second finger down,
  * second finger up, first finger up) on the input device.
  * Client coordinates contain the center pivot point of the action.
  * (XXX Not implemented on Mac)
  *
+ * MozEdgeUIGesture - Generated when the user swipes the display to
+ * invoke edge ui.
+ * (XXX Win8 only)
+ *
  * Default behavior:
  *
  * Some operating systems support default behaviors for gesture events
  * when they are not handled by the application. Consumers should
  * use event.preventDefault() to prevent default behavior when
  * consuming events.
  */
 
-[scriptable, builtinclass, uuid(2827efac-40c1-44af-82b9-3ad92f04d7ac)]
+[scriptable, builtinclass, uuid(5e2a88ce-5032-4758-8578-37c6d7f87d7b)]
 interface nsIDOMSimpleGestureEvent : nsIDOMMouseEvent
 {
   /* Swipe direction constants */
   const unsigned long DIRECTION_UP = 1;
   const unsigned long DIRECTION_DOWN = 2;
   const unsigned long DIRECTION_LEFT = 4;
   const unsigned long DIRECTION_RIGHT = 8;
   
@@ -108,26 +112,30 @@ interface nsIDOMSimpleGestureEvent : nsI
    * positive or negative.
    *
    * Units on Windows represent the difference between the initial
    * and current/final width between the two touch points on the input
    * device and are measured in pixels.
    */
   readonly attribute double delta;
 
+  /* Click count value for taps. */
+  readonly attribute unsigned long clickCount;
+
   void initSimpleGestureEvent(in DOMString typeArg,
                               in boolean canBubbleArg,
                               in boolean cancelableArg,
                               in nsIDOMWindow viewArg,
                               in long detailArg,
                               in long screenXArg,
                               in long screenYArg,
                               in long clientXArg,
                               in long clientYArg,
                               in boolean ctrlKeyArg,
                               in boolean altKeyArg,
                               in boolean shiftKeyArg,
                               in boolean metaKeyArg,
                               in unsigned short buttonArg,
                               in nsIDOMEventTarget relatedTargetArg,
                               in unsigned long directionArg,
-                              in double deltaArg);
+                              in double deltaArg,
+                              in unsigned long clickCount);
 };
--- a/mobile/xul/chrome/content/browser.js
+++ b/mobile/xul/chrome/content/browser.js
@@ -50,17 +50,17 @@ function onDebugKeyPress(aEvent) {
   // prevent the keypress from being triggered twice when page is local - bug 655501
   if (aEvent.originalTarget.nodeName == "html")
     return;
 
   function doSwipe(aDirection) {
     let evt = document.createEvent("SimpleGestureEvent");
     evt.initSimpleGestureEvent("MozSwipeGesture", true, true, window, null,
                                0, 0, 0, 0, false, false, false, false, 0, null,
-                               aDirection, 0);
+                               aDirection, 0, 0);
     Browser.selectedTab.inputHandler.dispatchEvent(evt);
   }
 
   let nsIDOMKeyEvent  = Ci.nsIDOMKeyEvent;
   switch (aEvent.charCode) {
     case nsIDOMKeyEvent.DOM_VK_A: // Swipe Left
       doSwipe(Ci.nsIDOMSimpleGestureEvent.DIRECTION_LEFT);
       break;
@@ -74,17 +74,17 @@ function onDebugKeyPress(aEvent) {
     case nsIDOMKeyEvent.DOM_VK_M: // Android Menu
       CommandUpdater.doCommand("cmd_menu");
       break;
 #ifndef MOZ_PLATFORM_MAEMO
     case nsIDOMKeyEvent.DOM_VK_P: // Fake pinch zoom
       function dispatchMagnifyEvent(aName, aDelta) {
         let evt = document.createEvent("SimpleGestureEvent");
         evt.initSimpleGestureEvent("MozMagnifyGesture" + aName, true, true, window, null,
-                                   0, 0, 0, 0, false, false, false, false, 0, null, 0, aDelta);
+                                   0, 0, 0, 0, false, false, false, false, 0, null, 0, aDelta, 0);
         Browser.selectedTab.inputHandler.dispatchEvent(evt);
       }
       dispatchMagnifyEvent("Start", 0);
 
       let frame = 0;
       let timer = new Util.Timeout();
       timer.interval(100, function() {
         dispatchMagnifyEvent("Update", 20);
--- a/widget/nsGUIEvent.h
+++ b/widget/nsGUIEvent.h
@@ -426,16 +426,17 @@ class nsHashKey;
 #define NS_SIMPLE_GESTURE_MAGNIFY_START  (NS_SIMPLE_GESTURE_EVENT_START+1)
 #define NS_SIMPLE_GESTURE_MAGNIFY_UPDATE (NS_SIMPLE_GESTURE_EVENT_START+2)
 #define NS_SIMPLE_GESTURE_MAGNIFY        (NS_SIMPLE_GESTURE_EVENT_START+3)
 #define NS_SIMPLE_GESTURE_ROTATE_START   (NS_SIMPLE_GESTURE_EVENT_START+4)
 #define NS_SIMPLE_GESTURE_ROTATE_UPDATE  (NS_SIMPLE_GESTURE_EVENT_START+5)
 #define NS_SIMPLE_GESTURE_ROTATE         (NS_SIMPLE_GESTURE_EVENT_START+6)
 #define NS_SIMPLE_GESTURE_TAP            (NS_SIMPLE_GESTURE_EVENT_START+7)
 #define NS_SIMPLE_GESTURE_PRESSTAP       (NS_SIMPLE_GESTURE_EVENT_START+8)
+#define NS_SIMPLE_GESTURE_EDGEUI         (NS_SIMPLE_GESTURE_EVENT_START+9)
 
 // These are used to send native events to plugins.
 #define NS_PLUGIN_EVENT_START            3600
 #define NS_PLUGIN_INPUT_EVENT            (NS_PLUGIN_EVENT_START)
 #define NS_PLUGIN_FOCUS_EVENT            (NS_PLUGIN_EVENT_START+1)
 
 // Events to manipulate selection (nsSelectionEvent)
 #define NS_SELECTION_EVENT_START        3700
@@ -1692,29 +1693,30 @@ public:
  * Simple gesture event
  */
 class nsSimpleGestureEvent : public nsMouseEvent_base
 {
 public:
   nsSimpleGestureEvent(bool isTrusted, PRUint32 msg, nsIWidget* w,
                          PRUint32 directionArg, PRFloat64 deltaArg)
     : nsMouseEvent_base(isTrusted, msg, w, NS_SIMPLE_GESTURE_EVENT),
-      direction(directionArg), delta(deltaArg)
+      direction(directionArg), delta(deltaArg), clickCount(0)
   {
   }
 
   nsSimpleGestureEvent(const nsSimpleGestureEvent& other)
     : nsMouseEvent_base((other.flags & NS_EVENT_FLAG_TRUSTED) != 0,
                         other.message, other.widget, NS_SIMPLE_GESTURE_EVENT),
-      direction(other.direction), delta(other.delta)
+      direction(other.direction), delta(other.delta), clickCount(0)
   {
   }
 
   PRUint32 direction;   // See nsIDOMSimpleGestureEvent for values
   PRFloat64 delta;      // Delta for magnify and rotate events
+  PRUint32 clickCount;  // The number of taps for tap events
 };
 
 class nsTransitionEvent : public nsEvent
 {
 public:
   nsTransitionEvent(bool isTrusted, PRUint32 msg,
                     const nsString &propertyNameArg, float elapsedTimeArg)
     : nsEvent(isTrusted, msg, NS_TRANSITION_EVENT),
--- a/widget/windows/nsWinGesture.cpp
+++ b/widget/windows/nsWinGesture.cpp
@@ -385,23 +385,25 @@ nsWinGesture::ProcessGestureMessage(HWND
     }
     break;
 
     case GID_TWOFINGERTAP:
     {
       // Normally maps to "restore" from whatever you may have recently changed. A simple
       // double click.
       evt.message = NS_SIMPLE_GESTURE_TAP;
+      evt.clickCount = 1;
     }
     break;
 
     case GID_PRESSANDTAP:
     {
       // Two finger right click. Defaults to right click if it falls through.
       evt.message = NS_SIMPLE_GESTURE_PRESSTAP;
+      evt.clickCount = 1;
     }
     break;
   }
 
   return true;
 }
 
 bool