mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1182311 - Make 3 finger triple tap more reliable. r=yzen
This commit is contained in:
parent
0b60d0d24b
commit
cbe09dbbe3
@ -213,8 +213,7 @@ this.GestureTracker = { // jshint ignore:line
|
|||||||
*/
|
*/
|
||||||
handle: function GestureTracker_handle(aDetail, aTimeStamp) {
|
handle: function GestureTracker_handle(aDetail, aTimeStamp) {
|
||||||
Logger.gesture(() => {
|
Logger.gesture(() => {
|
||||||
return ['Pointer event', aDetail.type, 'at:', aTimeStamp,
|
return ['Pointer event', Utils.dpi, 'at:', aTimeStamp, JSON.stringify(aDetail)];
|
||||||
JSON.stringify(aDetail.points)];
|
|
||||||
});
|
});
|
||||||
this[this.current ? '_update' : '_init'](aDetail, aTimeStamp);
|
this[this.current ? '_update' : '_init'](aDetail, aTimeStamp);
|
||||||
},
|
},
|
||||||
@ -403,7 +402,12 @@ Gesture.prototype = {
|
|||||||
let identifier = point.identifier;
|
let identifier = point.identifier;
|
||||||
let gesturePoint = this.points[identifier];
|
let gesturePoint = this.points[identifier];
|
||||||
if (gesturePoint) {
|
if (gesturePoint) {
|
||||||
gesturePoint.update(point);
|
if (aType === 'pointerdown' && aCanCreate) {
|
||||||
|
// scratch the previous pointer with that id.
|
||||||
|
this.points[identifier] = new Point(point);
|
||||||
|
} else {
|
||||||
|
gesturePoint.update(point);
|
||||||
|
}
|
||||||
if (aNeedComplete) {
|
if (aNeedComplete) {
|
||||||
// Since the gesture is completing and at least one of the gesture
|
// Since the gesture is completing and at least one of the gesture
|
||||||
// points is updated, set the return value to true.
|
// points is updated, set the return value to true.
|
||||||
|
@ -109,9 +109,10 @@ var originalConsecutiveGestureDelay =
|
|||||||
* Attach a listener for the mozAccessFuGesture event that tests its
|
* Attach a listener for the mozAccessFuGesture event that tests its
|
||||||
* type.
|
* type.
|
||||||
* @param {Array} aExpectedGestures A stack of expected event types.
|
* @param {Array} aExpectedGestures A stack of expected event types.
|
||||||
|
* @param {String} aTitle Title of this sequence, if any.
|
||||||
* Note: the listener is removed once the stack reaches 0.
|
* Note: the listener is removed once the stack reaches 0.
|
||||||
*/
|
*/
|
||||||
function testMozAccessFuGesture(aExpectedGestures) {
|
function testMozAccessFuGesture(aExpectedGestures, aTitle) {
|
||||||
var types = aExpectedGestures;
|
var types = aExpectedGestures;
|
||||||
function handleGesture(aEvent) {
|
function handleGesture(aEvent) {
|
||||||
if (aEvent.detail.type !== types[0].type) {
|
if (aEvent.detail.type !== types[0].type) {
|
||||||
@ -120,8 +121,10 @@ function testMozAccessFuGesture(aExpectedGestures) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
is(!!aEvent.detail.edge, !!types[0].edge);
|
is(!!aEvent.detail.edge, !!types[0].edge);
|
||||||
|
is(aEvent.detail.touches.length, types[0].fingers || 1,
|
||||||
|
'failed to count fingers: ' + types[0].type);
|
||||||
ok(true, 'Received correct mozAccessFuGesture: ' +
|
ok(true, 'Received correct mozAccessFuGesture: ' +
|
||||||
JSON.stringify(types.shift()) + '.');
|
JSON.stringify(types.shift()) + '. (' + aTitle + ')');
|
||||||
if (types.length === 0) {
|
if (types.length === 0) {
|
||||||
win.removeEventListener('mozAccessFuGesture', handleGesture);
|
win.removeEventListener('mozAccessFuGesture', handleGesture);
|
||||||
if (AccessFuTest.sequenceCleanup) {
|
if (AccessFuTest.sequenceCleanup) {
|
||||||
@ -168,7 +171,7 @@ function resetTimers() {
|
|||||||
*/
|
*/
|
||||||
AccessFuTest.addSequence = function AccessFuTest_addSequence(aSequence) {
|
AccessFuTest.addSequence = function AccessFuTest_addSequence(aSequence) {
|
||||||
AccessFuTest.addFunc(function testSequence() {
|
AccessFuTest.addFunc(function testSequence() {
|
||||||
testMozAccessFuGesture(aSequence.expectedGestures);
|
testMozAccessFuGesture(aSequence.expectedGestures, aSequence.title);
|
||||||
var events = aSequence.events;
|
var events = aSequence.events;
|
||||||
function fireEvent(aEvent) {
|
function fireEvent(aEvent) {
|
||||||
var event = {
|
var event = {
|
||||||
|
@ -162,7 +162,7 @@
|
|||||||
{"type": "pointerup", "points": [{"x": 1.5, "y": 1, "identifier": 1},
|
{"type": "pointerup", "points": [{"x": 1.5, "y": 1, "identifier": 1},
|
||||||
{"x": 1.5, "y": 1.5, "identifier": 2}]}
|
{"x": 1.5, "y": 1.5, "identifier": 2}]}
|
||||||
],
|
],
|
||||||
"expectedGestures": [{ "type": "swiperight" }]
|
"expectedGestures": [{ "type": "swiperight", "fingers": 2 }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"events": [
|
"events": [
|
||||||
@ -173,7 +173,7 @@
|
|||||||
{"type": "pointerup", "points": [{"x": 1.5, "y": 1, "identifier": 1}]},
|
{"type": "pointerup", "points": [{"x": 1.5, "y": 1, "identifier": 1}]},
|
||||||
{"type": "pointerup", "points": [{"x": 1.5, "y": 1.5, "identifier": 2}]}
|
{"type": "pointerup", "points": [{"x": 1.5, "y": 1.5, "identifier": 2}]}
|
||||||
],
|
],
|
||||||
"expectedGestures": [{ "type": "swiperight" }]
|
"expectedGestures": [{ "type": "swiperight", "fingers": 2 }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"events": [
|
"events": [
|
||||||
@ -187,7 +187,7 @@
|
|||||||
{"x": 1.5, "y": 1.5, "identifier": 2},
|
{"x": 1.5, "y": 1.5, "identifier": 2},
|
||||||
{"x": 1.5, "y": 2, "identifier": 3}]}
|
{"x": 1.5, "y": 2, "identifier": 3}]}
|
||||||
],
|
],
|
||||||
"expectedGestures": [{ "type": "swiperight" }]
|
"expectedGestures": [{ "type": "swiperight", "fingers": 3 }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"events": [
|
"events": [
|
||||||
@ -263,6 +263,96 @@
|
|||||||
{"type": "pointerup", "points": [{"x": 1.5, "y": 1, "identifier": 1},
|
{"type": "pointerup", "points": [{"x": 1.5, "y": 1, "identifier": 1},
|
||||||
{"x": 1.5, "y": 1.5, "identifier": 2}]}
|
{"x": 1.5, "y": 1.5, "identifier": 2}]}
|
||||||
],
|
],
|
||||||
"expectedGestures": [{ "type": "swiperight", "edge": true }]
|
"expectedGestures": [{ "type": "swiperight", "edge": true, "fingers": 2 }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Bug 1182311 - 3 finger triple tap is not reliable 1/2",
|
||||||
|
"events": [
|
||||||
|
{"points": [
|
||||||
|
{"y": 1.88467, "x": 0.89311, "identifier": 0},
|
||||||
|
{"y": 2.78481, "x": 0.56259, "identifier": 1},
|
||||||
|
{"y": 1.35021, "x": 1.37834, "identifier": 2}], "type": "pointerdown"},
|
||||||
|
{"points": [
|
||||||
|
{"y": 1.88467, "x": 0.89311, "identifier": 0},
|
||||||
|
{"y": 2.78481, "x": 0.56259, "identifier": 1},
|
||||||
|
{"y": 1.35021, "x": 1.37834, "identifier": 2}], "type": "pointerup"},
|
||||||
|
{"points": [
|
||||||
|
{"y": 1.76512, "x": 0.98453, "identifier": 0},
|
||||||
|
{"y": 1.1744, "x": 1.4346, "identifier": 1},
|
||||||
|
{"y": 2.5879, "x": 0.61181, "identifier": 2}], "type": "pointerdown"},
|
||||||
|
{"points": [
|
||||||
|
{"y": 1.76512, "x": 0.98453, "identifier": 0},
|
||||||
|
{"y": 1.1744, "x": 1.4346, "identifier": 1},
|
||||||
|
{"y": 2.5879, "x": 0.61181, "identifier": 2}], "type": "pointerup"},
|
||||||
|
{"points": [
|
||||||
|
{"y": 1.30098, "x": 1.52602, "identifier": 0},
|
||||||
|
{"y": 1.94093, "x": 1.02672, "identifier": 1},
|
||||||
|
{"y": 2.67229, "x": 0.75246, "identifier": 2}], "type": "pointerdown"},
|
||||||
|
{"points": [
|
||||||
|
{"y": 1.30098, "x": 1.52602, "identifier": 0},
|
||||||
|
{"y": 1.94093, "x": 1.02672, "identifier": 1},
|
||||||
|
{"y": 2.67229, "x": 0.75246, "identifier": 2}], "type": "pointerup",
|
||||||
|
"removeConsecutiveGestureDelay": false}],
|
||||||
|
"expectedGestures": [{ "type": "tripletap", "fingers": 3 }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Bug 1182311 - 3 finger triple tap is not reliable 2/2",
|
||||||
|
"events": [
|
||||||
|
{"type": "pointerdown",
|
||||||
|
"points": [{"identifier": 0, "x": 2.21875, "y": 1.510417}]},
|
||||||
|
{"type": "pointerdown",
|
||||||
|
"points": [{"identifier": 1, "x": 1.479167, "y": 2.53125}]},
|
||||||
|
{"type": "pointerdown",
|
||||||
|
"points": [{"identifier": 2, "x": 1.072917, "y": 3.739583}]},
|
||||||
|
{"type": "pointermove",
|
||||||
|
"points": [{"identifier": 1, "x": 1.46875, "y": 2.53125}]},
|
||||||
|
{"type": "pointermove",
|
||||||
|
"points": [{"identifier": 1, "x": 1.447917, "y": 2.46875}]},
|
||||||
|
{"type": "pointerup",
|
||||||
|
"points": [{"identifier": 0, "x": 2.21875, "y": 1.510417}]},
|
||||||
|
{"type": "pointerup",
|
||||||
|
"points": [{"identifier": 1, "x": 1.447917, "y": 2.489583}]},
|
||||||
|
{"type": "pointerup",
|
||||||
|
"points": [{"identifier": 2, "x": 1.072917, "y": 3.739583}]},
|
||||||
|
{"type": "pointerdown",
|
||||||
|
"points": [{"identifier": 0, "x": 2.114583, "y": 1.572917}]},
|
||||||
|
{"type": "pointerdown",
|
||||||
|
"points": [{"identifier": 1, "x": 1.364583, "y": 2.614583}]},
|
||||||
|
{"type": "pointerdown",
|
||||||
|
"points": [{"identifier": 2, "x": 0.927083, "y": 3.864583}]},
|
||||||
|
{"type": "pointermove",
|
||||||
|
"points": [{"identifier": 1, "x": 1.364583, "y": 2.614583}]},
|
||||||
|
{"type": "pointermove",
|
||||||
|
"points": [{"identifier": 0, "x": 2.114583, "y": 1.572917}]},
|
||||||
|
{"type": "pointerup",
|
||||||
|
"points": [{"identifier": 1, "x": 1.364583, "y": 2.614583}]},
|
||||||
|
{"type": "pointerup",
|
||||||
|
"points": [{"identifier": 2, "x": 0.927083, "y": 3.864583}]},
|
||||||
|
{"type": "pointerup",
|
||||||
|
"points": [{"identifier": 0, "x": 2.114583, "y": 1.572917}]},
|
||||||
|
{"type": "pointerdown",
|
||||||
|
"points": [{"identifier": 0, "x": 1.4375, "y": 2.59375}]},
|
||||||
|
{"type": "pointerdown",
|
||||||
|
"points": [{"identifier": 1, "x": 1.083333, "y": 3.71875}]},
|
||||||
|
{"type": "pointerdown",
|
||||||
|
"points": [{"identifier": 2, "x": 2.15625, "y": 1.489583}]},
|
||||||
|
{"type": "pointermove",
|
||||||
|
"points": [{"identifier": 0, "x": 1.4375, "y": 2.59375},
|
||||||
|
{"identifier": 2, "x": 2.15625, "y": 1.489583}]},
|
||||||
|
{"type": "pointermove",
|
||||||
|
"points": [{"identifier": 0, "x": 1.4375, "y": 2.59375},
|
||||||
|
{"identifier": 2, "x": 2.15625, "y": 1.489583}]},
|
||||||
|
{"type": "pointerup",
|
||||||
|
"points": [{"identifier": 1, "x": 1.083333, "y": 3.71875}]},
|
||||||
|
{"type": "pointermove",
|
||||||
|
"points": [{"identifier": 0, "x": 1.427083, "y": 2.59375}]},
|
||||||
|
{"type": "pointerup",
|
||||||
|
"points": [{"identifier": 0, "x": 1.427083, "y": 2.59375}]},
|
||||||
|
{"type": "pointerup",
|
||||||
|
"points": [{"identifier": 2, "x": 2.15625, "y": 1.489583}],
|
||||||
|
"removeConsecutiveGestureDelay": false}
|
||||||
|
],
|
||||||
|
"expectedGestures": [{ "type": "tripletap", "fingers": 3 }]
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user