Bug 852456 - fix double_tap and long_press for desktop B2G, r=mdas
authorDave Hunt <dhunt@mozilla.com>
Tue, 19 Mar 2013 14:03:11 -0400
changeset 131900 015f4e8a16a8e1886fe2773697aa8b28d07a2fc9
parent 131899 18ccc35f888040ea1fc26b12e9b4448d7508a92a
child 131901 37474b43d0640e596b68fffb23e438353e07b745
push idunknown
push userunknown
push dateunknown
reviewersmdas
bugs852456
milestone22.0a1
Bug 852456 - fix double_tap and long_press for desktop B2G, r=mdas
testing/marionette/client/marionette/touch/synthetic_gestures.js
--- a/testing/marionette/client/marionette/touch/synthetic_gestures.js
+++ b/testing/marionette/client/marionette/touch/synthetic_gestures.js
@@ -307,17 +307,17 @@ var SyntheticGestures = (function() {
       touch(target, t || 50, [c.x0, c.x0], [c.y0, c.y0], then);
     }
   }
 
   // Dispatch a dbltap gesture. The arguments are like those to tap()
   // except that interval is the time between taps rather than the time between
   // touchstart and touchend
   function dbltap(target, then, x, y, interval) {
-    if (!SyntheticGestures.touchSupported) {
+    if (!SyntheticGestures.touchSupported || !target.ownerDocument.createTouch) {
       console.warn('dbltap: touch events not supported; using mouse instead');
       return mousedbltap(target, then, x, y, interval);
     }
 
     if (x == null)
       x = '50%';
     if (y == null)
       y = '50%';
@@ -342,17 +342,17 @@ var SyntheticGestures = (function() {
 
     var c = coordinates(target, x1, y1, x2, y2);
     touch(target, duration || 200, [c.x0, c.x1], [c.y0, c.y1], then);
   }
 
   // Begin a touch at x1,y1 and hold it for holdtime ms,
   // then move smoothly to x2,y2 over movetime ms, and then invoke then().
   function hold(target, holdtime, x1, y1, x2, y2, movetime, then) {
-    if (!SyntheticGestures.touchSupported) {
+    if (!SyntheticGestures.touchSupported || !target.ownerDocument.createTouch) {
       console.warn('hold: touch events not supported; using mouse instead');
       return mousehold(target, holdtime, x1, y1, x2, y2, movetime, then);
     }
 
     if (!movetime)
       movetime = 200;
 
     var c = coordinates(target, x1, y1, x2, y2);