Title: [279944] trunk/Source/WebKit
Revision
279944
Author
[email protected]
Date
2021-07-15 06:48:27 -0700 (Thu, 15 Jul 2021)

Log Message

[GTK] Can't click links with touchscreen
https://bugs.webkit.org/show_bug.cgi?id=226679

Patch by Alexander Mikhaylenko <[email protected]> on 2021-07-15
Reviewed by Michael Catanzaro.

Currently, when we emulate mouse events for touch, we send events with touch
pointer type, however the way we do it doesn't really match how touch type
events are supposed to behave: for example, we won't send a press event until
a finger release, and will then send both together. And touch pointer type
events are also supposed to support multitouch (or at least they do in iOS),
while with this scheme they really can't.

Not only all of this produces weird results for pointer events, but the actual
mouse emulation doesn't really work as intended. For example, when tapping
empty space on the page, and then a link, the latter won't do anything.
Meanwhile, it's possible to accidentally open a link while pinch zooming.

Switch back to emulating mouse pointer type events for now, as it was before
the rewrite to avoid this. Touch pointer type events don't work properly
anyway.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseTouchRelease):
(webkitWebViewBaseTouchDragUpdate):
(webkitWebViewBaseTouchDragEnd):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (279943 => 279944)


--- trunk/Source/WebKit/ChangeLog	2021-07-15 13:09:55 UTC (rev 279943)
+++ trunk/Source/WebKit/ChangeLog	2021-07-15 13:48:27 UTC (rev 279944)
@@ -1,3 +1,31 @@
+2021-07-15  Alexander Mikhaylenko  <[email protected]>
+
+        [GTK] Can't click links with touchscreen
+        https://bugs.webkit.org/show_bug.cgi?id=226679
+
+        Reviewed by Michael Catanzaro.
+
+        Currently, when we emulate mouse events for touch, we send events with touch
+        pointer type, however the way we do it doesn't really match how touch type
+        events are supposed to behave: for example, we won't send a press event until
+        a finger release, and will then send both together. And touch pointer type
+        events are also supposed to support multitouch (or at least they do in iOS),
+        while with this scheme they really can't.
+
+        Not only all of this produces weird results for pointer events, but the actual
+        mouse emulation doesn't really work as intended. For example, when tapping
+        empty space on the page, and then a link, the latter won't do anything.
+        Meanwhile, it's possible to accidentally open a link while pinch zooming.
+
+        Switch back to emulating mouse pointer type events for now, as it was before
+        the rewrite to avoid this. Touch pointer type events don't work properly
+        anyway.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseTouchRelease):
+        (webkitWebViewBaseTouchDragUpdate):
+        (webkitWebViewBaseTouchDragEnd):
+
 2021-07-15  Adrian Perez de Castro  <[email protected]>
 
         Non-unified build fixes, mid-July 2021 edition

Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (279943 => 279944)


--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp	2021-07-15 13:09:55 UTC (rev 279943)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp	2021-07-15 13:48:27 UTC (rev 279944)
@@ -1939,9 +1939,9 @@
     }
 
     unsigned modifiers = gtk_event_controller_get_current_event_state(GTK_EVENT_CONTROLLER(gesture));
-    webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, 0, 0, x, y, modifiers, nPress, touchPointerEventType());
-    webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Press, button, 0, x, y, modifiers, nPress, touchPointerEventType());
-    webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Release, button, buttons, x, y, modifiers, nPress, touchPointerEventType());
+    webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, 0, 0, x, y, modifiers, nPress, mousePointerEventType());
+    webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Press, button, 0, x, y, modifiers, nPress, mousePointerEventType());
+    webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Release, button, buttons, x, y, modifiers, nPress, mousePointerEventType());
 }
 
 static void webkitWebViewBaseTouchDragBegin(WebKitWebViewBase* webViewBase, gdouble startX, gdouble startY, GtkGesture* gesture)
@@ -1977,14 +1977,14 @@
 
         if (priv->isLongPressed) {
             // Drag after long press forwards emulated mouse events (for e.g. text selection)
-            webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, 0, 0, x, y, modifiers, 1, touchPointerEventType());
-            webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Press, GDK_BUTTON_PRIMARY, 0, x, y, modifiers, 0, touchPointerEventType());
+            webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, 0, 0, x, y, modifiers, 1, mousePointerEventType());
+            webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Press, GDK_BUTTON_PRIMARY, 0, x, y, modifiers, 0, mousePointerEventType());
         } else
             webkitWebViewBaseSynthesizeWheelEvent(webViewBase, event, 0, 0, x, y, WheelEventPhase::Began, WheelEventPhase::NoPhase);
     }
 
     if (priv->isLongPressed)
-        webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, GDK_BUTTON_PRIMARY, GDK_BUTTON1_MASK, x + offsetX, y + offsetY, modifiers, 0, touchPointerEventType());
+        webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, GDK_BUTTON_PRIMARY, GDK_BUTTON1_MASK, x + offsetX, y + offsetY, modifiers, 0, mousePointerEventType());
     else {
         double deltaX = (priv->dragOffset.x() - offsetX) / Scrollbar::pixelsPerLineStep();
         double deltaY = (priv->dragOffset.y() - offsetY) / Scrollbar::pixelsPerLineStep();
@@ -2013,7 +2013,7 @@
         double x, y;
         gtk_gesture_drag_get_start_point(GTK_GESTURE_DRAG(gesture), &x, &y);
         unsigned modifiers = gtk_event_controller_get_current_event_state(GTK_EVENT_CONTROLLER(gesture));
-        webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Release, GDK_BUTTON_PRIMARY, GDK_BUTTON1_MASK, x + offsetX, y + offsetY, modifiers, 0, touchPointerEventType());
+        webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Release, GDK_BUTTON_PRIMARY, GDK_BUTTON1_MASK, x + offsetX, y + offsetY, modifiers, 0, mousePointerEventType());
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to