haikuwebkit/LayoutTests/pointerevents/ios/pointer-events-for-double-t...

29 lines
907 B
HTML
Raw Permalink Normal View History

REGRESSION (r251320): Can't double tap to select word in Notes on iCloud.com https://bugs.webkit.org/show_bug.cgi?id=207239 <rdar://problem/58686015> Reviewed by Tim Horton. Source/WebKit: Following r251320, all synthetic mouse events on iOS additionally dispatched corresponding pointer events. This led to duplicate "pointerdown"/"pointerup" events dispatched with every tap. r253878 fixed this by avoiding pointer event dispatch for synthetically generated mouse events (and made this determination by consulting `syntheticClickType()`). However, in the case where we're synthesizing a mouse event for a "dblclick" event handler (after a double- tap), we currently pass `NoTap` as the synthetic click event type when creating the mouse event. This causes additional pointer events to be synthesized and dispatched during a double tap, which creates three pairs of "pointerdown"/"pointerup" events upon double-tap. This subsequently confuses iCloud Notes' web app when double tapping to select a word. Fix this by passing in `OneFingerTap` as the synthetic click type instead (since two-finger double taps should already be handled by the two-finger double-tap magnification gesture). Test: pointerevents/ios/pointer-events-for-double-tap.html * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint): LayoutTests: Add a test to verify that performing a double tap on an element with a dblclick handler results in the following sequence of events: `[ "pointerdown", "pointerup", "pointerdown", "pointerup", "dblclick" ]`. * pointerevents/ios/pointer-events-for-double-tap-expected.txt: Added. * pointerevents/ios/pointer-events-for-double-tap.html: Added. * pointerevents/utils.js: (const.ui.new.UIController.prototype.doubleTap): Add a helper method to simulate a double-tap gesture. Canonical link: https://commits.webkit.org/220234@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255786 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-02-05 04:32:18 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../utils.js"></script>
<script>
'use strict';
target_test((target, test) => {
const eventTracker = new EventTracker(target, ["pointerdown", "pointerup", "dblclick"]);
ui.doubleTap({ x: 50, y: 50 }).then(() => {
eventTracker.assertMatchesEvents([
{ type: "pointerdown" },
{ type: "pointerup" },
{ type: "pointerdown" },
{ type: "pointerup" },
{ type: "dblclick" }
]);
test.done();
});
}, "Verifies that two pairs of pointerup and pointerdown events are dispatched in an element with a dblclick event handler.");
</script>
</body>
</html>