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
Родитель c8b531511d
Коммит ea850c1150
2 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -298,7 +298,9 @@ var SyntheticGestures = (function() {
var c = coordinates(target, x, y); 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() // 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 // 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. // 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; var win = doc.defaultView;
detail = detail || 1; detail = detail || 1;
button = button || 0; button = button || 0;
@ -506,9 +508,13 @@ var SyntheticGestures = (function() {
// Otherwise, schedule the next move event // Otherwise, schedule the next move event
if (last) { if (last) {
mouseEvent('mouseup', lastX, lastY); mouseEvent('mouseup', lastX, lastY);
if (then) if (sendClick) {
mouseEvent('click', clientX, clientY);
}
if (then) {
setTimeout(then, 0); setTimeout(then, 0);
} }
}
else { else {
setTimeout(nextEvent, EVENT_INTERVAL); setTimeout(nextEvent, EVENT_INTERVAL);
} }
@ -517,14 +523,14 @@ var SyntheticGestures = (function() {
// Send a mousedown/mouseup pair // Send a mousedown/mouseup pair
// XXX: will the browser automatically follow this with a click event? // 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) if (x == null)
x = '50%'; x = '50%';
if (y == null) if (y == null)
y = '50%'; y = '50%';
var c = coordinates(target, x, y); 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() // Dispatch a dbltap gesture. The arguments are like those to tap()

Просмотреть файл

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