[Pointer Events] The pointerup, pointerout and pointerleave events may be fired twice
https://bugs.webkit.org/show_bug.cgi?id=198028
<rdar://problem/50769425>
Reviewed by Dean Jackson.
Add a new test that checks that we're firing a "pointermove" event when the touch pressure
changes, even when the touch is stationary, and that a single "pointerup" event is fired
as the touch ends and the pressure changes. The relevant code change is done in WebKitAdditions.
* pointerevents/ios/pressure-change-expected.txt: Added.
* pointerevents/ios/pressure-change.html: Added.
* pointerevents/utils.js:
(prototype._handlePointerEvent):
(prototype.stationary):
(prototype._action):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245506 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9b9d60a..602b281 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,24 @@
2019-05-19 Antoine Quint <graouts@apple.com>
+ [Pointer Events] The pointerup, pointerout and pointerleave events may be fired twice
+ https://bugs.webkit.org/show_bug.cgi?id=198028
+ <rdar://problem/50769425>
+
+ Reviewed by Dean Jackson.
+
+ Add a new test that checks that we're firing a "pointermove" event when the touch pressure
+ changes, even when the touch is stationary, and that a single "pointerup" event is fired
+ as the touch ends and the pressure changes. The relevant code change is done in WebKitAdditions.
+
+ * pointerevents/ios/pressure-change-expected.txt: Added.
+ * pointerevents/ios/pressure-change.html: Added.
+ * pointerevents/utils.js:
+ (prototype._handlePointerEvent):
+ (prototype.stationary):
+ (prototype._action):
+
+2019-05-19 Antoine Quint <graouts@apple.com>
+
[Pointer Events] A pointer should be marked as primary for all of its events
https://bugs.webkit.org/show_bug.cgi?id=197909
<rdar://problem/50801608>
diff --git a/LayoutTests/pointerevents/ios/pressure-change-expected.txt b/LayoutTests/pointerevents/ios/pressure-change-expected.txt
new file mode 100644
index 0000000..c0c3c98
--- /dev/null
+++ b/LayoutTests/pointerevents/ios/pressure-change-expected.txt
@@ -0,0 +1,3 @@
+
+PASS Pointer events are fired as pressure changes.
+
diff --git a/LayoutTests/pointerevents/ios/pressure-change.html b/LayoutTests/pointerevents/ios/pressure-change.html
new file mode 100644
index 0000000..c36ce14
--- /dev/null
+++ b/LayoutTests/pointerevents/ios/pressure-change.html
@@ -0,0 +1,36 @@
+<!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) => {
+ target.style.touchAction = "none";
+ const eventTracker = new EventTracker(target, ["pointerdown", "pointermove", "pointerup"]);
+
+ const one = ui.finger();
+ ui.sequence([
+ one.begin({ x: 10, y: 10 }),
+ one.stationary({ pressure: 500 }),
+ one.end(),
+ ]).then(() => {
+ eventTracker.assertMatchesEvents([
+ { id: 1, type: "pointerdown", x: 10, y: 10, pressure: 0 },
+ { id: 1, type: "pointermove", x: 10, y: 10, pressure: 1 },
+ { id: 1, type: "pointerup", x: 10, y: 10, pressure: 0 }
+ ]);
+ test.done();
+ });
+}, "Pointer events are fired as pressure changes.");
+
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/pointerevents/utils.js b/LayoutTests/pointerevents/utils.js
index b144edc..31c271e 100644
--- a/LayoutTests/pointerevents/utils.js
+++ b/LayoutTests/pointerevents/utils.js
@@ -67,6 +67,7 @@
type: event.type,
x: event.clientX,
y: event.clientY,
+ pressure: event.pressure,
isPrimary: event.isPrimary,
isTrusted: event.isTrusted
});
@@ -237,14 +238,14 @@
stationary(options)
{
- return this._action("stationary", options.x || 0, options.y || 0);
+ return this._action("stationary", options.x || this._lastX, options.y || this._lastY, options.pressure || 0);
}
- _action(phase, x, y)
+ _action(phase, x, y, pressure = 0)
{
this._lastX = x;
this._lastY = y;
- return { inputType: "finger", id: this.id, phase, x, y };
+ return { inputType: "finger", id: this.id, phase, x, y, pressure };
}
}