Bug 829377 - tap() in synthetic_gestures should send touch/mouse/click events, r=jgriffin

This commit is contained in:
Malini Das 2013-01-10 17:40:17 -08:00
parent 92484c30cf
commit c27ec87dc3
2 changed files with 12 additions and 6 deletions

View File

@ -298,7 +298,9 @@ var SyntheticGestures = (function() {
var c = coordinates(target, x, y);
touch(target, t || 50, [c.x0, c.x0], [c.y0, c.y0], then);
touch(target, t || 50, [c.x0, c.x0], [c.y0, c.y0], function() {
mousetap(target, then, x, y, t, true);
});
}
// Dispatch a dbltap gesture. The arguments are like those to tap()
@ -431,7 +433,7 @@ var SyntheticGestures = (function() {
// This is a low-level function that the higher-level mouse gesture
// utilities are built on. Most testing code will not need to call it.
//
function drag(doc, duration, xt, yt, then, detail, button) {
function drag(doc, duration, xt, yt, then, detail, button, sendClick) {
var win = doc.defaultView;
detail = detail || 1;
button = button || 0;
@ -506,9 +508,13 @@ var SyntheticGestures = (function() {
// Otherwise, schedule the next move event
if (last) {
mouseEvent('mouseup', lastX, lastY);
if (then)
if (sendClick) {
mouseEvent('click', clientX, clientY);
}
if (then) {
setTimeout(then, 0);
}
}
else {
setTimeout(nextEvent, EVENT_INTERVAL);
}
@ -517,14 +523,14 @@ var SyntheticGestures = (function() {
// Send a mousedown/mouseup pair
// XXX: will the browser automatically follow this with a click event?
function mousetap(target, then, x, y, t) {
function mousetap(target, then, x, y, t, sendClick) {
if (x == null)
x = '50%';
if (y == null)
y = '50%';
var c = coordinates(target, x, y);
drag(target.ownerDocument, t || 50, [c.x0, c.x0], [c.y0, c.y0], then);
drag(target.ownerDocument, t || 50, [c.x0, c.x0], [c.y0, c.y0], then, null, null, sendClick);
}
// Dispatch a dbltap gesture. The arguments are like those to tap()

View File

@ -1,7 +1,7 @@
import os
from setuptools import setup, find_packages
version = '0.5.14'
version = '0.5.15'
# get documentation from the README
try: