Diff
Modified: branches/safari-608-branch/LayoutTests/ChangeLog (250136 => 250137)
--- branches/safari-608-branch/LayoutTests/ChangeLog 2019-09-20 18:18:14 UTC (rev 250136)
+++ branches/safari-608-branch/LayoutTests/ChangeLog 2019-09-20 18:42:48 UTC (rev 250137)
@@ -1,7 +1,3 @@
-2019-09-20 Alan Coon <[email protected]>
-
- Revert r247573. rdar://problem/55461395
-
2019-09-17 Alan Coon <[email protected]>
Cherry-pick r249954. rdar://problem/55461404
Added: branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons-expected.txt (0 => 250137)
--- branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons-expected.txt (rev 0)
+++ branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons-expected.txt 2019-09-20 18:42:48 UTC (rev 250137)
@@ -0,0 +1,3 @@
+
+PASS Testing the values of the button and buttons properties.
+
Added: branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel-expected.txt (0 => 250137)
--- branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel-expected.txt (rev 0)
+++ branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel-expected.txt 2019-09-20 18:42:48 UTC (rev 250137)
@@ -0,0 +1,3 @@
+
+PASS Testing the values of the button and buttons properties with cancelation.
+
Added: branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel.html (0 => 250137)
--- branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel.html (rev 0)
+++ branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel.html 2019-09-20 18:42:48 UTC (rev 250137)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test({ width: "200px", height: "200px" }, (target, test) => {
+ const eventTracker = new EventTracker(target, ["pointerdown", "pointerenter", "pointerleave", "pointercancel", "pointerout", "pointerover", "pointerup"]);
+
+ const _one_ = ui.finger();
+ ui.sequence([
+ one.begin({ x: 10, y: 10 }),
+ one.move({ x: 100, y: 100 }),
+ one.end()
+ ]).then(() => {
+ eventTracker.assertMatchesEvents([
+ { type: "pointerover", button: 0, buttons: 1 },
+ { type: "pointerenter", button: 0, buttons: 1 },
+ { type: "pointerdown", button: 0, buttons: 1 },
+ { type: "pointercancel", button: 0, buttons: 0 },
+ { type: "pointerout", button: 0, buttons: 0 },
+ { type: "pointerleave", button: 0, buttons: 0 },
+ ]);
+ test.done();
+ });
+}, `Testing the values of the button and buttons properties with cancelation.`);
+
+</script>
+</body>
+</html>
\ No newline at end of file
Added: branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons.html (0 => 250137)
--- branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons.html (rev 0)
+++ branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons.html 2019-09-20 18:42:48 UTC (rev 250137)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test({ width: "200px", height: "200px" }, (target, test) => {
+ const eventTracker = new EventTracker(target, ["pointerdown", "pointerenter", "pointerleave", "pointermove", "pointerout", "pointerover", "pointerup"]);
+ target.style.touchAction = "none";
+
+ const _one_ = ui.finger();
+ ui.sequence([
+ one.begin({ x: 10, y: 10 }),
+ one.move({ x: 100, y: 100 }),
+ one.end()
+ ]).then(() => {
+ eventTracker.assertMatchesEvents([
+ { type: "pointerover", button: 0, buttons: 1 },
+ { type: "pointerenter", button: 0, buttons: 1 },
+ { type: "pointerdown", button: 0, buttons: 1 },
+ { type: "pointermove", button: -1, buttons: 1 },
+ { type: "pointerup", button: 0, buttons: 0 },
+ { type: "pointerout", button: 0, buttons: 0 },
+ { type: "pointerleave", button: 0, buttons: 0 },
+ ]);
+ test.done();
+ });
+}, `Testing the values of the button and buttons properties.`);
+
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (250136 => 250137)
--- branches/safari-608-branch/Source/WebCore/ChangeLog 2019-09-20 18:18:14 UTC (rev 250136)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog 2019-09-20 18:42:48 UTC (rev 250137)
@@ -1,7 +1,3 @@
-2019-09-20 Alan Coon <[email protected]>
-
- Revert r247573. rdar://problem/55461395
-
2019-09-17 Alan Coon <[email protected]>
Cherry-pick r249954. rdar://problem/55461404
Modified: branches/safari-608-branch/Source/WebCore/dom/ios/PointerEventIOS.cpp (250136 => 250137)
--- branches/safari-608-branch/Source/WebCore/dom/ios/PointerEventIOS.cpp 2019-09-20 18:18:14 UTC (rev 250136)
+++ branches/safari-608-branch/Source/WebCore/dom/ios/PointerEventIOS.cpp 2019-09-20 18:42:48 UTC (rev 250137)
@@ -50,6 +50,17 @@
return nullAtom();
}
+static short buttonForType(const AtomString& type)
+{
+ return type == eventNames().pointermoveEvent ? -1 : 0;
+}
+
+static unsigned short buttonsForType(const AtomString& type)
+{
+ // We have contact with the touch surface for most events except when we've released the touch or canceled it.
+ return (type == eventNames().pointerupEvent || type == eventNames().pointeroutEvent || type == eventNames().pointerleaveEvent || type == eventNames().pointercancelEvent) ? 0 : 1;
+}
+
Ref<PointerEvent> PointerEvent::create(const PlatformTouchEvent& event, unsigned index, bool isPrimary, Ref<WindowProxy>&& view)
{
const auto& type = pointerEventType(event.touchPhaseAtIndex(index));
@@ -62,7 +73,7 @@
}
PointerEvent::PointerEvent(const AtomString& type, const PlatformTouchEvent& event, IsCancelable isCancelable, unsigned index, bool isPrimary, Ref<WindowProxy>&& view)
- : MouseEvent(type, typeCanBubble(type), isCancelable, typeIsComposed(type), event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.touchLocationAtIndex(index), event.touchLocationAtIndex(index), { }, event.modifiers(), 0, 0, nullptr, 0, 0, nullptr, IsSimulated::No, IsTrusted::Yes)
+ : MouseEvent(type, typeCanBubble(type), isCancelable, typeIsComposed(type), event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.touchLocationAtIndex(index), event.touchLocationAtIndex(index), { }, event.modifiers(), buttonForType(type), buttonsForType(type), nullptr, 0, 0, nullptr, IsSimulated::No, IsTrusted::Yes)
, m_pointerId(event.touchIdentifierAtIndex(index))
, m_width(2 * event.radiusXAtIndex(index))
, m_height(2 * event.radiusYAtIndex(index))