Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 44b6bb811936b2bd9af8c97c6fbe5a5c4ceb68d6
      
https://github.com/WebKit/WebKit/commit/44b6bb811936b2bd9af8c97c6fbe5a5c4ceb68d6
  Author: Wenson Hsieh <[email protected]>
  Date:   2024-11-08 (Fri, 08 Nov 2024)

  Changed paths:
    M Source/WebCore/page/ChromeClient.h
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/EventHandler.h
    M Source/WebCore/page/Quirks.cpp
    M Source/WebCore/page/Quirks.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [iPad] cbssports.com: Media controls on videos do not respond to trackpad 
clicks
https://bugs.webkit.org/show_bug.cgi?id=282794
rdar://84667808

Reviewed by Abrar Rahman Protyasha.

When watching videos on cbssports.com, it's not currently possible to interact 
with the media
player's custom controls using a trackpad on iPad. This is because the website 
itself explicitly
prevents click events from triggering any actions on the media player, in the 
case where touch
capabilities are supported (i.e. `this.isTouch` is set):

```
onClick(e)
{
    this.isTouch || this.disabled ? Dt(e) : this.execAction()
}
onTouchStart(e)
{
    Dt(e),
    this.touchStartStamp = e.timeStamp
}
onTouchEnd(e)
{
    !this.disabled && this.touchStartStamp && e.timeStamp - 
this.touchStartStamp <= this.TAP_THRESHOLD && (this.touchStartStamp = null, 
this.execAction())
}
```

To make this Just Work, this patch add a site-specific hack that triggers only 
when clicking on
specific media controls on cbssports.com (precisely, elements with tag name 
`AVIA-BUTTON`). If the
click is swallowed (i.e. prevented default), we call out into the client layer 
to simulate a pair of
`touchstart` / `touchend` events, which results in the control being "clicked".

* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::didSwallowClickEvent):
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::swallowAnyClickEvent):
* Source/WebCore/page/EventHandler.h:
* Source/WebCore/page/Quirks.cpp:
(WebCore::Quirks::shouldSynthesizeTouchEventsAfterNonSyntheticClick const):
* Source/WebCore/page/Quirks.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didSwallowClickEvent):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::didSwallowClickEvent):
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::didSwallowClickEvent):

Add logic to synthesize touchstart/touchend events over the center of the 
clicked element. See above
for more details.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to