Diff
Modified: branches/safari-608-branch/LayoutTests/ChangeLog (250009 => 250010)
--- branches/safari-608-branch/LayoutTests/ChangeLog 2019-09-18 01:06:46 UTC (rev 250009)
+++ branches/safari-608-branch/LayoutTests/ChangeLog 2019-09-18 01:15:06 UTC (rev 250010)
@@ -1,3 +1,49 @@
+2019-09-17 Alan Coon <[email protected]>
+
+ Cherry-pick r247573. rdar://problem/55461395
+
+ [Pointer Events] The button and buttons properties are incorrect on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=199910
+ <rdar://problem/52778374>
+
+ Reviewed by Dean Jackson.
+
+ Source/WebCore:
+
+ The button and buttons properties were always set to 0 on iOS. We now use the correct values such that
+ button is always 0 except for "pointermove" where it's -1, and "buttons" is 1 as long as the pointer is
+ in contact with the touch surface.
+
+ Tests: pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel.html
+ pointerevents/ios/pointer-event-button-and-buttons.html
+
+ * dom/ios/PointerEventIOS.cpp:
+ (WebCore::buttonForType):
+ (WebCore::buttonsForType):
+ (WebCore::PointerEvent::PointerEvent):
+
+ LayoutTests:
+
+ * pointerevents/ios/pointer-event-button-and-buttons-expected.txt: Added.
+ * pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel-expected.txt: Added.
+ * pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel.html: Added.
+ * pointerevents/ios/pointer-event-button-and-buttons.html: Added.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-07-18 Antoine Quint <[email protected]>
+
+ [Pointer Events] The button and buttons properties are incorrect on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=199910
+ <rdar://problem/52778374>
+
+ Reviewed by Dean Jackson.
+
+ * pointerevents/ios/pointer-event-button-and-buttons-expected.txt: Added.
+ * pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel-expected.txt: Added.
+ * pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel.html: Added.
+ * pointerevents/ios/pointer-event-button-and-buttons.html: Added.
+
2019-09-17 Kocsen Chung <[email protected]>
Cherry-pick r249813. rdar://problem/55427490
Added: branches/safari-608-branch/LayoutTests/pointerevents/ios/pointer-event-button-and-buttons-expected.txt (0 => 250010)
--- 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-18 01:15:06 UTC (rev 250010)
@@ -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 => 250010)
--- 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-18 01:15:06 UTC (rev 250010)
@@ -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 => 250010)
--- 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-18 01:15:06 UTC (rev 250010)
@@ -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 => 250010)
--- 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-18 01:15:06 UTC (rev 250010)
@@ -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 (250009 => 250010)
--- branches/safari-608-branch/Source/WebCore/ChangeLog 2019-09-18 01:06:46 UTC (rev 250009)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog 2019-09-18 01:15:06 UTC (rev 250010)
@@ -1,5 +1,58 @@
2019-09-17 Alan Coon <[email protected]>
+ Cherry-pick r247573. rdar://problem/55461395
+
+ [Pointer Events] The button and buttons properties are incorrect on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=199910
+ <rdar://problem/52778374>
+
+ Reviewed by Dean Jackson.
+
+ Source/WebCore:
+
+ The button and buttons properties were always set to 0 on iOS. We now use the correct values such that
+ button is always 0 except for "pointermove" where it's -1, and "buttons" is 1 as long as the pointer is
+ in contact with the touch surface.
+
+ Tests: pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel.html
+ pointerevents/ios/pointer-event-button-and-buttons.html
+
+ * dom/ios/PointerEventIOS.cpp:
+ (WebCore::buttonForType):
+ (WebCore::buttonsForType):
+ (WebCore::PointerEvent::PointerEvent):
+
+ LayoutTests:
+
+ * pointerevents/ios/pointer-event-button-and-buttons-expected.txt: Added.
+ * pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel-expected.txt: Added.
+ * pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel.html: Added.
+ * pointerevents/ios/pointer-event-button-and-buttons.html: Added.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-07-18 Antoine Quint <[email protected]>
+
+ [Pointer Events] The button and buttons properties are incorrect on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=199910
+ <rdar://problem/52778374>
+
+ Reviewed by Dean Jackson.
+
+ The button and buttons properties were always set to 0 on iOS. We now use the correct values such that
+ button is always 0 except for "pointermove" where it's -1, and "buttons" is 1 as long as the pointer is
+ in contact with the touch surface.
+
+ Tests: pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel.html
+ pointerevents/ios/pointer-event-button-and-buttons.html
+
+ * dom/ios/PointerEventIOS.cpp:
+ (WebCore::buttonForType):
+ (WebCore::buttonsForType):
+ (WebCore::PointerEvent::PointerEvent):
+
+2019-09-17 Alan Coon <[email protected]>
+
Apply patch. rdar://problem/55240888
2019-09-17 Chris Dumez <[email protected]>
Modified: branches/safari-608-branch/Source/WebCore/dom/ios/PointerEventIOS.cpp (250009 => 250010)
--- branches/safari-608-branch/Source/WebCore/dom/ios/PointerEventIOS.cpp 2019-09-18 01:06:46 UTC (rev 250009)
+++ branches/safari-608-branch/Source/WebCore/dom/ios/PointerEventIOS.cpp 2019-09-18 01:15:06 UTC (rev 250010)
@@ -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))