Title: [265088] trunk
- Revision
- 265088
- Author
- grao...@webkit.org
- Date
- 2020-07-30 10:12:33 -0700 (Thu, 30 Jul 2020)
Log Message
[iOS] Unable to swipe on IMDB.com after long press on image
https://bugs.webkit.org/show_bug.cgi?id=214968
<rdar://problem/66234421>
Reviewed by Wenson Hsieh.
Source/WebCore:
When a long press occurs on an <img>, a system drag interaction is initiated on iOS. In WebCore,
EventHandler::tryToBeginDragAtPoint() is called and a synthetic mouse event is produced, causing
handleMousePressEvent() to be called. Further down the call chain, dispatchPointerEventIfNeeded()
is called and a valid PointerEvent is generated in PointerCaptureController::pointerEventForMouseEvent()
with "pointerType" set to "mouse", even though there is already a touch interaction initiated.
We now check whether there are known touches before generating a PointerEvent for a MouseEvent.
In the case of IMDb, the page would keep track of "pointerdown" events to track whether a multi-touch
user gesture is in progress so that their slide shows can support two-finger zooming as well as
single-finger swiping. In the case of a long press, the second "pointerdown" event would trick
the code in thinking a zoom gesture was initiated and it never recovered.
Test: pointerevents/ios/long-press-yields-single-pointerdown-event.html
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::pointerEventForMouseEvent):
LayoutTests:
Add a test that triggers a long press gesture on an <img> and checks a single "pointerdown" event
was dispatched. Prior to the WebCore change in this patch, two events would be dispatched.
* pointerevents/ios/long-press-yields-single-pointerdown-event-expected.txt: Added.
* pointerevents/ios/long-press-yields-single-pointerdown-event.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (265087 => 265088)
--- trunk/LayoutTests/ChangeLog 2020-07-30 16:36:29 UTC (rev 265087)
+++ trunk/LayoutTests/ChangeLog 2020-07-30 17:12:33 UTC (rev 265088)
@@ -1,3 +1,17 @@
+2020-07-30 Antoine Quint <grao...@webkit.org>
+
+ [iOS] Unable to swipe on IMDB.com after long press on image
+ https://bugs.webkit.org/show_bug.cgi?id=214968
+ <rdar://problem/66234421>
+
+ Reviewed by Wenson Hsieh.
+
+ Add a test that triggers a long press gesture on an <img> and checks a single "pointerdown" event
+ was dispatched. Prior to the WebCore change in this patch, two events would be dispatched.
+
+ * pointerevents/ios/long-press-yields-single-pointerdown-event-expected.txt: Added.
+ * pointerevents/ios/long-press-yields-single-pointerdown-event.html: Added.
+
2020-07-30 Hector Lopez <hector_i_lo...@apple.com>
[ macOS wk1 ] imported/w3c/web-platform-tests/pointerevents/pointerevent_attributes_hoverable_pointers.html is a flaky failure
Added: trunk/LayoutTests/pointerevents/ios/long-press-yields-single-pointerdown-event-expected.txt (0 => 265088)
--- trunk/LayoutTests/pointerevents/ios/long-press-yields-single-pointerdown-event-expected.txt (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/long-press-yields-single-pointerdown-event-expected.txt 2020-07-30 17:12:33 UTC (rev 265088)
@@ -0,0 +1,3 @@
+
+PASS Testing that a long press yields a single pointerdown event.
+
Added: trunk/LayoutTests/pointerevents/ios/long-press-yields-single-pointerdown-event.html (0 => 265088)
--- trunk/LayoutTests/pointerevents/ios/long-press-yields-single-pointerdown-event.html (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/long-press-yields-single-pointerdown-event.html 2020-07-30 17:12:33 UTC (rev 265088)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test({ name: "img", width: "200px", height: "200px" }, async (target, test) => {
+ const eventTracker = new EventTracker(target, ["pointerdown"]);
+ await UIHelper.longPressAtPoint(100, 100);
+ eventTracker.assertMatchesEvents([ { type: "pointerdown" } ]);
+ test.done();
+}, `Testing that a long press yields a single pointerdown event.`);
+
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (265087 => 265088)
--- trunk/Source/WebCore/ChangeLog 2020-07-30 16:36:29 UTC (rev 265087)
+++ trunk/Source/WebCore/ChangeLog 2020-07-30 17:12:33 UTC (rev 265088)
@@ -1,3 +1,29 @@
+2020-07-30 Antoine Quint <grao...@webkit.org>
+
+ [iOS] Unable to swipe on IMDB.com after long press on image
+ https://bugs.webkit.org/show_bug.cgi?id=214968
+ <rdar://problem/66234421>
+
+ Reviewed by Wenson Hsieh.
+
+ When a long press occurs on an <img>, a system drag interaction is initiated on iOS. In WebCore,
+ EventHandler::tryToBeginDragAtPoint() is called and a synthetic mouse event is produced, causing
+ handleMousePressEvent() to be called. Further down the call chain, dispatchPointerEventIfNeeded()
+ is called and a valid PointerEvent is generated in PointerCaptureController::pointerEventForMouseEvent()
+ with "pointerType" set to "mouse", even though there is already a touch interaction initiated.
+
+ We now check whether there are known touches before generating a PointerEvent for a MouseEvent.
+
+ In the case of IMDb, the page would keep track of "pointerdown" events to track whether a multi-touch
+ user gesture is in progress so that their slide shows can support two-finger zooming as well as
+ single-finger swiping. In the case of a long press, the second "pointerdown" event would trick
+ the code in thinking a zoom gesture was initiated and it never recovered.
+
+ Test: pointerevents/ios/long-press-yields-single-pointerdown-event.html
+
+ * page/PointerCaptureController.cpp:
+ (WebCore::PointerCaptureController::pointerEventForMouseEvent):
+
2020-07-30 Chris Dumez <cdu...@apple.com>
OfflineAudioContext.startRendering() should return a Promise
Modified: trunk/Source/WebCore/page/PointerCaptureController.cpp (265087 => 265088)
--- trunk/Source/WebCore/page/PointerCaptureController.cpp 2020-07-30 16:36:29 UTC (rev 265087)
+++ trunk/Source/WebCore/page/PointerCaptureController.cpp 2020-07-30 17:12:33 UTC (rev 265088)
@@ -301,6 +301,13 @@
RefPtr<PointerEvent> PointerCaptureController::pointerEventForMouseEvent(const MouseEvent& mouseEvent)
{
+ // If we already have known touches then we cannot dispatch a mouse event,
+ // for instance in the case of a long press to initiate a system drag.
+ for (auto& capturingData : m_activePointerIdsToCapturingData.values()) {
+ if (capturingData.pointerType != PointerEvent::mousePointerType())
+ return nullptr;
+ }
+
const auto& type = mouseEvent.type();
const auto& names = eventNames();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes