Bug 1779206 - Part 2: Do not always fire first pointermove event for touch; r=smaug

We don't handle the first touchmove event differently, so I think we should do
the same thing for pointermove event, otherwise, we might fire a pointermove event
without a touchmove event for the first touch action after touchstart if the touch
postition isn't changed.

Depends on D152152

Differential Revision: https://phabricator.services.mozilla.com/D152153
This commit is contained in:
Edgar Chen 2022-07-20 14:55:35 +00:00
Родитель 1350b0d487
Коммит b8f51ed9f1
9 изменённых файлов: 13 добавлений и 17 удалений

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

@ -86,8 +86,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1363508
];
synthesizeTouch(target0, 5, 5, { type: "touchstart" });
synthesizeTouch(target0, 5, 5, { type: "touchmove" });
synthesizeTouch(target0, 5, 5, { type: "touchcancel" });
synthesizeTouch(target0, 6, 6, { type: "touchmove" });
synthesizeTouch(target0, 6, 6, { type: "touchcancel" });
await Promise.all(eventPromises);
}

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

@ -253,7 +253,7 @@ function runTests() {
// This should send pointer event to test1d1, test2d1.
utils.sendTouchEvent('touchmove', [test1PointerId, test2PointerId],
[left1d1, left2d1], [top1d1, top2d1], [rx, rx], [ry, ry],
[left1d1 + 1, left2d1 + 1], [top1d1 + 1, top2d1 + 1], [rx, rx], [ry, ry],
[angle, angle], [force, force], modifiers);
// This should send pointer event to test1d2, test2d2.

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

@ -252,12 +252,12 @@ function runTests() {
// This should send pointer event to test1d1, test2d1.
utils.sendTouchEvent('touchmove', [test1PointerId, test2PointerId],
[left1d1, left2d1], [top1d1, top2d1], [rx, rx], [ry, ry],
[left1d1 + 1, left2d1 + 1], [top1d1, top2d1], [rx, rx], [ry, ry],
[angle, angle], [force, force], modifiers);
// This should send pointer event to test1d2, test2d2.
utils.sendTouchEvent('touchmove', [test1PointerId, test2PointerId],
[left1d1 + 1, left2d1 + 1], [top1d1, top2d1], [rx, rx], [ry, ry],
[left1d1 + 1, left2d1 + 1], [top1d1 + 1, top2d1 + 1], [rx, rx], [ry, ry],
[angle, angle], [force, force], modifiers);
is(test1d1pointermovecount, 3, "1d1 shouldn't have got pointermove");

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

@ -50,7 +50,7 @@ function withoutImplicitlyPointerCaptureForTouch() {
}, {once : true});
synthesizeTouch(target0, 5, 5, { type: "touchstart" });
synthesizeTouch(target0, 5, 5, { type: "touchmove" });
synthesizeTouch(target0, 6, 6, { type: "touchmove" });
synthesizeTouch(target1, 5, 5, { type: "touchmove" });
synthesizeTouch(target1, 5, 5, { type: "touchcancel" });
synthesizeMouseAtCenter(done, { type: "mousedown" });

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

@ -85,10 +85,10 @@ function withoutImplicitlyPointerCaptureForTouch() {
[left1, left2], [top1, top2], [rx, rx], [ry, ry],
[angle, angle], [force, force], modifiers);
utils.sendTouchEvent('touchmove', [test1PointerId, test2PointerId],
[left1, left2], [top1, top2], [rx, rx], [ry, ry],
[left1 + 1, left2 + 1], [top1, top2], [rx, rx], [ry, ry],
[angle, angle], [force, force], modifiers);
utils.sendTouchEvent('touchend', [test1PointerId, test2PointerId],
[left1, left2], [top1, top2], [rx, rx], [ry, ry],
[left1 + 1, left2 + 1], [top1, top2], [rx, rx], [ry, ry],
[angle, angle], [force, force], modifiers);
}

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

@ -164,8 +164,6 @@ add_task(async function ShouldNotSendDuplicatedPointerMove() {
[ // [event target, event type]
[target0, "pointerdown"],
[target1, "pointerdown"],
// The first pointermove should not be suppressed.
[target0, "pointermove"],
[target1, "pointermove"],
// Should receive only one pointer event for target 1.
[target1, "pointermove"],

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

@ -67,7 +67,7 @@ add_task(async function test_remove_iframe_after_pointer_capture() {
waitForEvent(targetInIframe, "pointermove")
]);
synthesizeTouch(targetInIframe, 10, 10, { type: "touchstart", id: 10 }, iframeWin);
synthesizeTouch(targetInIframe, 10, 10, { type: "touchmove", id: 10 }, iframeWin);
synthesizeTouch(targetInIframe, 11, 11, { type: "touchmove", id: 10 }, iframeWin);
await promise;
// Intentionally not synthesize touchend event to not trigger implicit releasing

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

@ -27,9 +27,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1000870
window.addEventListener("message", function(aEvent) {
if (aEvent.data == "Test Touch") {
// Synthesize touch events to run this test.
sendTouchEvent(int_win, "target0", "touchstart");
sendTouchEvent(int_win, "target0", "touchmove");
sendTouchEvent(int_win, "target0", "touchend");
sendTouchEvent(int_win, "target0", "touchstart", {offsetX: 10});
sendTouchEvent(int_win, "target0", "touchmove", {offsetX: 11});
sendTouchEvent(int_win, "target0", "touchend", {offsetX: 11});
window.postMessage("Test Pen", "*");
} else if (aEvent.data == "Test Pen") {
// Synthesize pen events to run this test.

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

@ -461,9 +461,7 @@ bool TouchManager::ShouldConvertTouchToPointer(const Touch* aTouch,
return false;
}
case eTouchMove: {
// Always fire first pointermove event.
return info.mTouch->mMessage != eTouchMove ||
!aTouch->Equals(info.mTouch);
return !aTouch->Equals(info.mTouch);
}
default:
break;