[webkit-changes] [WebKit/WebKit] d1f55d: iOS Safari "click" events have the "mouse" pointer...

Abrar Rahman Protyasha noreply at github.com
Tue Jan 14 11:32:05 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d1f55d9bf83bf3a7c7d5df42efdbd9b3c6ec37d0
      https://github.com/WebKit/WebKit/commit/d1f55d9bf83bf3a7c7d5df42efdbd9b3c6ec37d0
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2025-01-14 (Tue, 14 Jan 2025)

  Changed paths:
    A LayoutTests/pointerevents/ios/pointer-type-attribute-on-stylus-tap-expected.txt
    A LayoutTests/pointerevents/ios/pointer-type-attribute-on-stylus-tap.html
    A LayoutTests/pointerevents/ios/pointer-type-attribute-on-touch-tap-expected.txt
    A LayoutTests/pointerevents/ios/pointer-type-attribute-on-touch-tap.html
    M LayoutTests/resources/ui-helper.js
    M Source/WebCore/dom/PointerEventTypeNames.h
    M Source/WebCore/platform/PlatformMouseEvent.h
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/WKSyntheticTapGestureRecognizer.h
    M Source/WebKit/UIProcess/ios/WKSyntheticTapGestureRecognizer.mm
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  iOS Safari "click" events have the "mouse" pointerType when triggered from touch
https://bugs.webkit.org/show_bug.cgi?id=282988
rdar://139828481

Reviewed by Tim Horton.

282524 at main made `click` a PointerEvent, but also introduced a small
PointerEvent spec incompliance, since the spec mandates that "If the
events are generated by a pointing device, their pointerId and
pointerType MUST be the same as the PointerEvents that caused these
events."

As it pertains to touch interactions, we dispatch resulting `click`
events when the single tap gesture recognizer makes the web page commit
a potential tap (and handling the associated synthetic click). Before
this commit, we blindly assumed that the `click` events being dispatched
had the "mouse" pointer type. This resulted in the titled bug.

However, the synthetic tap GR, which tracks the last active touch, also
knows what the last active touch type (i.e. UITouchType) was. This type
maps reasonably well to the pointer types in question (direct --> touch,
stylus --> pen, others --> mouse). These types are then plumbed through
the GR's action to the rest of WebKit's tap/synthetic click handling
code.

* LayoutTests/pointerevents/ios/pointer-type-attribute-on-stylus-tap-expected.txt: Added.
* LayoutTests/pointerevents/ios/pointer-type-attribute-on-stylus-tap.html: Added.
* LayoutTests/pointerevents/ios/pointer-type-attribute-on-touch-tap-expected.txt: Added.
* LayoutTests/pointerevents/ios/pointer-type-attribute-on-touch-tap.html: Added.
  Tests to check whether touch tap / stylus tap on an element generates
  the correct set of events (and PointerType attributes).
* LayoutTests/resources/ui-helper.js:
(window.UIHelper.stylusTapOnElement):
* Source/WebCore/dom/PointerEventTypeNames.h:
* Source/WebCore/platform/PlatformMouseEvent.h:
(WebCore::PlatformMouseEvent::PlatformMouseEvent):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _singleTapRecognized:]):
* Source/WebKit/UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
* Source/WebKit/UIProcess/ios/WKSyntheticTapGestureRecognizer.mm:
(-[WKSyntheticTapGestureRecognizer reset]):
(-[WKSyntheticTapGestureRecognizer touchesEnded:withEvent:]):
(-[WKSyntheticTapGestureRecognizer lastActiveTouchType]):
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::commitPotentialTap):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::dispatchSyntheticMouseMove):
(WebKit::WebPage::handleSyntheticClick):
(WebKit::WebPage::didFinishContentChangeObserving):
(WebKit::WebPage::completeSyntheticClick):
(WebKit::WebPage::potentialTapAtPosition):
(WebKit::WebPage::commitPotentialTap):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list