Skip to content

Commit

Permalink
Bug 1543337 - Implement support for touch input in marionette, r=webd…
Browse files Browse the repository at this point in the history
…river-reviewers,whimboo,jdescottes

Touch is a bit different to mouse inputs because there are often
multiple pointers (i.e. fingers) acting at the same time. It turns out
that Gecko wants a single call containing all the positions etc. of
the touch pointers for each event, rather than having a single call
per pointer. So we have to group the pointer actions from one tick
together.

Differential Revision: https://phabricator.services.mozilla.com/D139120
  • Loading branch information
jgraham committed Jul 12, 2022
1 parent c97011a commit 71bd61b
Show file tree
Hide file tree
Showing 76 changed files with 1,025 additions and 152 deletions.
431 changes: 408 additions & 23 deletions remote/marionette/action.js

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions remote/marionette/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,51 @@ event.parseModifiers_ = function(modifiers, win) {
* "type".
* @param {Window} win
* Window object.
*
* @return {boolean} defaultPrevented
*/
event.synthesizeMouseAtPoint = function(left, top, opts, win) {
return _getEventUtils(win).synthesizeMouseAtPoint(left, top, opts, win);
};

/**
* Synthesise a touch event at a point.
*
* If the type is specified in opts, a touch event of that type is
* fired. Otherwise, a touchstart followed by a touchend is performed.
*
* @param {number} left
* Offset from viewport left, in CSS pixels
* @param {number} top
* Offset from viewport top, in CSS pixels
* @param {Object} opts
* Object which may contain the properties "id", "rx", "ry", "angle",
* "force", "shiftKey", "ctrlKey", "altKey", "metaKey", "accessKey",
* "type".
* @param {Window} win
* Window object.
*
* @return {boolean} defaultPrevented
*/
event.synthesizeTouchAtPoint = function(left, top, opts, win) {
return _getEventUtils(win).synthesizeTouchAtPoint(left, top, opts, win);
};

event.synthesizeMultiTouch = function(opts, win) {
const modifiers = _getEventUtils(win)._parseModifiers(opts);
win.windowUtils.sendTouchEvent(
opts.type,
opts.id,
opts.x,
opts.y,
opts.rx,
opts.ry,
opts.angle,
opts.force,
modifiers
);
};

/**
* Synthesize a keydown event for a single key.
*
Expand Down
4 changes: 2 additions & 2 deletions remote/marionette/test/xpcshell/test_action.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ add_test(function test_computePointerDestinationPointer() {
});

add_test(function test_processPointerAction() {
for (let pointerType of ["mouse" /*"touch"*/]) {
for (let pointerType of ["mouse", "touch"]) {
const actionItems = [
{
duration: 2000,
Expand Down Expand Up @@ -626,7 +626,7 @@ add_test(function test_extractActionChain_twoAndThreeTicks() {
id: "7",
actions: mouseActionItems,
parameters: {
pointerType: "mouse", // TODO "touch"
pointerType: "mouse",
},
};
const keyActionItems = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[document-level-touchmove-event-listener-passive-by-default.tentative.html]
expected: ERROR
[Touchmove events are non-cancelable since the event listener is treated as passive.]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
[overscroll-deltas.html]
expected: ERROR
expected:
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
if not debug and (os == "win"): TIMEOUT
[Tests that the document gets overscroll event with right deltaX/Y attributes.]
expected:
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
if not debug and (os == "win"): TIMEOUT
FAIL
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
[overscroll-event-fired-to-document.html]
expected: ERROR
expected:
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
if not debug and (os == "win"): TIMEOUT
[Tests that the document gets overscroll event when no element scrolls after touch scrolling.]
expected:
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
if not debug and (os == "win"): TIMEOUT
FAIL
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
[overscroll-event-fired-to-element-with-overscroll-behavior.html]
expected: ERROR
expected:
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
if not debug and (os == "win"): TIMEOUT
[Tests that the last element in the cut scroll chain gets overscroll event when no element scrolls by touch.]
expected:
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "win"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
FAIL
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
[overscroll-event-fired-to-window.html]
expected: ERROR
expected:
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
if not debug and (os == "win"): TIMEOUT
[Tests that the window gets overscroll event when no element scrollsafter touch scrolling.]
expected:
if not debug and (os == "win"): TIMEOUT
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
FAIL
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
[scrollend-event-fired-after-snap.html]
expected: ERROR
expected:
if (os == "linux") and not debug: TIMEOUT
if (os == "mac") and not debug: TIMEOUT
if os == "win": TIMEOUT
[Tests that scrollend is fired after scroll snap animation completion.]
expected:
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
if not debug and (os == "win"): TIMEOUT
FAIL

[Tests that scrollend is fired after fling snap animation completion.]
expected:
if (os == "mac") and not debug: NOTRUN
if (os == "linux") and not debug: NOTRUN
if (os == "win") and not debug: NOTRUN
if (os == "win") and debug: TIMEOUT
FAIL
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
[scrollend-event-fired-to-document.html]
expected: ERROR
expected:
if not debug and (os == "win"): TIMEOUT
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
[Tests that the document gets scrollend event when no element scrolls by touch.]
expected:
if not debug and (os == "linux"): TIMEOUT
if not debug and (os == "win"): TIMEOUT
if not debug and (os == "mac"): TIMEOUT
FAIL
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
[scrollend-event-fired-to-element-with-overscroll-behavior.html]
expected: ERROR
expected:
if not debug and (os == "win"): TIMEOUT
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
[Tests that the last element in the cut scroll chain gets scrollend event when no element scrolls by touch.]
expected:
if not debug and (os == "win"): TIMEOUT
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
FAIL
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
[scrollend-event-fired-to-window.html]
expected: ERROR
expected:
if not debug and (os == "linux"): TIMEOUT
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "win"): TIMEOUT
[Tests that the window gets scrollend event when no element scrolls after touch scrolling.]
expected:
if not debug and (os == "win"): TIMEOUT
if not debug and (os == "mac"): TIMEOUT
if not debug and (os == "linux"): TIMEOUT
FAIL
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
[first-input-interactionid-tap.html]
expected: ERROR
expected:
if (os == "win") and not debug and (processor == "x86_64"): OK
if os == "android": OK
TIMEOUT
[Event Timing: The interactionId of first input should match the event timing pointerdown entry when tap.]
expected:
if (os == "win") and not debug and (processor == "x86_64"): FAIL
if os == "android": FAIL
TIMEOUT
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
[interactionid-tap.html]
expected: ERROR
expected:
if (os == "linux") and not fission and debug and not swgl: OK
if os == "android": OK
TIMEOUT
[Event Timing: compare event timing interactionId for tap.]
expected:
if (os == "linux") and not fission and debug and not swgl: FAIL
if os == "android": FAIL
TIMEOUT

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
[pointerevent_touch-action_two-finger_interaction.html]
expected: ERROR
expected: TIMEOUT
[touch two-finger pan on 'touch-action: pan-x pan-y']
expected: NOTRUN

[touch two-finger pan on 'touch-action: pinch-zoom']
expected: NOTRUN
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,21 @@
[ mouse pointerleave's type should be pointerleave]
expected:
if (os == "win") and debug and (processor == "x86_64") and not swgl: [PASS, FAIL]
[Inner frame mouse pointerover's button is -1 when mouse buttons are in released state.]
expected: FAIL

[Inner frame mouse pointerover's buttons is 0 when mouse buttons are in released state.]
expected: FAIL
[Inner frame mouse pointerenter's button is -1 when mouse buttons are in released state.]
expected: FAIL

[Inner frame mouse pointerenter's buttons is 0 when mouse buttons are in released state.]
expected: FAIL
[Inner frame mouse pointermove's type should be pointermove]
expected: FAIL

[Inner frame mouse pointerdown's type should be pointerdown]
expected: FAIL
Loading

0 comments on commit 71bd61b

Please sign in to comment.