[webkit-changes] [WebKit/WebKit] 84e4a4: [WPE] Add support for touch based pointer events

Bastian Krause noreply at github.com
Thu May 11 08:45:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 84e4a4ae1e8936da66c30862be411246417d44fd
      https://github.com/WebKit/WebKit/commit/84e4a4ae1e8936da66c30862be411246417d44fd
  Author: Bastian Krause <bst at pengutronix.de>
  Date:   2023-05-11 (Thu, 11 May 2023)

  Changed paths:
    M Source/WebCore/SourcesWPE.txt
    M Source/WebCore/dom/PointerEvent.h
    A Source/WebCore/dom/wpe/PointerEventWPE.cpp
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/PointerCaptureController.cpp
    M Source/WebCore/page/PointerCaptureController.h
    M Source/WebCore/platform/PlatformTouchEvent.h
    M Source/WebCore/platform/PlatformTouchPoint.h
    M Source/WebKit/Shared/NativeWebMouseEvent.h
    M Source/WebKit/Shared/WebEventConversion.cpp
    M Source/WebKit/Shared/libwpe/NativeWebMouseEventLibWPE.cpp
    M Source/WebKit/Shared/libwpe/WebEventFactory.cpp
    M Source/WebKit/Shared/libwpe/WebEventFactory.h
    M Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp

  Log Message:
  -----------
  [WPE] Add support for touch based pointer events
https://bugs.webkit.org/show_bug.cgi?id=214870

Reviewed by Carlos Alberto Lopez Perez and Michael Catanzaro.

Currently all non-Apple ports support only pointer events of type
"mouse" because they a mapped 1:1 to mouse events. This commit adds
the pointer event support for touch events for the WPE port. With
this patch it should be easy for other ports to add pointer event support
as well.

The WPE port creates artificial motion, button down, button up events
for short touch gestures in PageClientImpl::doneWithTouchEvent() to keep
compatibility, see:

https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-events

These NativeWebMouseEvents are undistinguishable from actual mouse
events and lead to additional pointer events of type mouse being
dispatched.
Fix this by passing the SyntheticClickType down to the WebMouseEvent and
PlatformMouseEvent. With this, WPE can make use of the code path
introduced in https://bugs.webkit.org/show_bug.cgi?id=205551 due to the
same issue.

Initial patch version by Marco Felsch <m.felsch at pengutronix.de>. Tested
and improved by Bastian Krause <bst at pengutronix.de>.

* Source/WebCore/SourcesWPE.txt: Add dom/wpe/PointerEventWPE.cpp, see
below.
* Source/WebCore/dom/PointerEvent.h: Enable various pointer event paths
for WPE, move buttonForType() and buttonsForType() generics from
PointerEventIOS.
* Source/WebCore/dom/wpe/PointerEventWPE.cpp: Adapted for WPE from
Source/WebCore/dom/ios/PointerEventIOS.cpp.
(WebCore::pointerEventType): Add a translation function similar to
PointerEventIOS's pointerEventType().
(WebCore::PointerEvent::create): Add create functions similar to
PointerEventIOS.
(WebCore::PointerEvent::PointerEvent):
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::handleTouchEvent): Change point iteration to
make index value accessible. Add pointer target hit tests for
TouchReleased/TouchCancelled/TouchMoved. Implement WPE-specific
workaround to compensate for non-existent touch stationary events.
Finally dispatch pointer events.
* Source/WebCore/page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::cancelPointer): Enable existing
pointer event code paths for WPE.
* Source/WebCore/page/PointerCaptureController.h:
(WebCore::PointerCaptureController::CapturingData::hasAnyElement const):
* Source/WebCore/platform/PlatformTouchEvent.h:
(WebCore::PlatformTouchEvent::setTouchPoints): Allow setting touchPoints
for WPE to make the above mentioned touch stationary worarkound
possible.
* Source/WebCore/platform/PlatformTouchPoint.h:
(WebCore::PlatformTouchPoint::PlatformTouchPoint): Allow WPE to create
PlatformTouchPoints to make the above mentioned touch stationary
worarkound possible.
* Source/WebKit/Shared/NativeWebMouseEvent.h: Add synthetic click type.
* Source/WebKit/Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent): Pass the
SyntheticClickType to the PlatformMouseEvent, for WPE only because effects
on other ports are unknown at this time.
* Source/WebKit/Shared/libwpe/NativeWebMouseEventLibWPE.cpp:
(WebKit::NativeWebMouseEvent::NativeWebMouseEvent): Add synthetic click
type.
* Source/WebKit/Shared/libwpe/WebEventFactory.cpp: Add synthetic click
type.
(WebKit::WebEventFactory::createWebMouseEvent):
* Source/WebKit/Shared/libwpe/WebEventFactory.h: Pass synthetic click
type to WebMouseEvent.
* Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::doneWithTouchEvent): Set synthetic click type
for synthetic mouse events to NativeWebMouseEvent.

Canonical link: https://commits.webkit.org/263969@main




More information about the webkit-changes mailing list