Changeset 279944 in webkit


Ignore:
Timestamp:
Jul 15, 2021 6:48:27 AM (3 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Alexander Mikhaylenko <Alexander Mikhaylenko> 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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r279941 r279944  
     12021-07-15  Alexander Mikhaylenko  <alexm@gnome.org>
     2
     3        [GTK] Can't click links with touchscreen
     4        https://bugs.webkit.org/show_bug.cgi?id=226679
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Currently, when we emulate mouse events for touch, we send events with touch
     9        pointer type, however the way we do it doesn't really match how touch type
     10        events are supposed to behave: for example, we won't send a press event until
     11        a finger release, and will then send both together. And touch pointer type
     12        events are also supposed to support multitouch (or at least they do in iOS),
     13        while with this scheme they really can't.
     14
     15        Not only all of this produces weird results for pointer events, but the actual
     16        mouse emulation doesn't really work as intended. For example, when tapping
     17        empty space on the page, and then a link, the latter won't do anything.
     18        Meanwhile, it's possible to accidentally open a link while pinch zooming.
     19
     20        Switch back to emulating mouse pointer type events for now, as it was before
     21        the rewrite to avoid this. Touch pointer type events don't work properly
     22        anyway.
     23
     24        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
     25        (webkitWebViewBaseTouchRelease):
     26        (webkitWebViewBaseTouchDragUpdate):
     27        (webkitWebViewBaseTouchDragEnd):
     28
    1292021-07-15  Adrian Perez de Castro  <aperez@igalia.com>
    230
  • trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp

    r279827 r279944  
    19401940
    19411941    unsigned modifiers = gtk_event_controller_get_current_event_state(GTK_EVENT_CONTROLLER(gesture));
    1942     webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, 0, 0, x, y, modifiers, nPress, touchPointerEventType());
    1943     webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Press, button, 0, x, y, modifiers, nPress, touchPointerEventType());
    1944     webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Release, button, buttons, x, y, modifiers, nPress, touchPointerEventType());
     1942    webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, 0, 0, x, y, modifiers, nPress, mousePointerEventType());
     1943    webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Press, button, 0, x, y, modifiers, nPress, mousePointerEventType());
     1944    webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Release, button, buttons, x, y, modifiers, nPress, mousePointerEventType());
    19451945}
    19461946
     
    19781978        if (priv->isLongPressed) {
    19791979            // Drag after long press forwards emulated mouse events (for e.g. text selection)
    1980             webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, 0, 0, x, y, modifiers, 1, touchPointerEventType());
    1981             webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Press, GDK_BUTTON_PRIMARY, 0, x, y, modifiers, 0, touchPointerEventType());
     1980            webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, 0, 0, x, y, modifiers, 1, mousePointerEventType());
     1981            webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Press, GDK_BUTTON_PRIMARY, 0, x, y, modifiers, 0, mousePointerEventType());
    19821982        } else
    19831983            webkitWebViewBaseSynthesizeWheelEvent(webViewBase, event, 0, 0, x, y, WheelEventPhase::Began, WheelEventPhase::NoPhase);
     
    19851985
    19861986    if (priv->isLongPressed)
    1987         webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, GDK_BUTTON_PRIMARY, GDK_BUTTON1_MASK, x + offsetX, y + offsetY, modifiers, 0, touchPointerEventType());
     1987        webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Motion, GDK_BUTTON_PRIMARY, GDK_BUTTON1_MASK, x + offsetX, y + offsetY, modifiers, 0, mousePointerEventType());
    19881988    else {
    19891989        double deltaX = (priv->dragOffset.x() - offsetX) / Scrollbar::pixelsPerLineStep();
     
    20142014        gtk_gesture_drag_get_start_point(GTK_GESTURE_DRAG(gesture), &x, &y);
    20152015        unsigned modifiers = gtk_event_controller_get_current_event_state(GTK_EVENT_CONTROLLER(gesture));
    2016         webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Release, GDK_BUTTON_PRIMARY, GDK_BUTTON1_MASK, x + offsetX, y + offsetY, modifiers, 0, touchPointerEventType());
     2016        webkitWebViewBaseSynthesizeMouseEvent(webViewBase, MouseEventType::Release, GDK_BUTTON_PRIMARY, GDK_BUTTON1_MASK, x + offsetX, y + offsetY, modifiers, 0, mousePointerEventType());
    20172017    }
    20182018}
Note: See TracChangeset for help on using the changeset viewer.