[webkit-changes] [WebKit/WebKit] b5438c: [UnifiedPDF] [iPadOS] Previewing link by clicking-...

Wenson Hsieh noreply at github.com
Thu Feb 20 16:12:17 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b5438c176a46e82983f6b6f0b806351d759b9d95
      https://github.com/WebKit/WebKit/commit/b5438c176a46e82983f6b6f0b806351d759b9d95
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2025-02-20 (Thu, 20 Feb 2025)

  Changed paths:
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.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:
  -----------
  [UnifiedPDF] [iPadOS] Previewing link by clicking-and-holding with trackpad incorrectly navigates
https://bugs.webkit.org/show_bug.cgi?id=288145
rdar://142476781

Reviewed by Abrar Rahman Protyasha and Tim Horton.

Currently, clicking and holding on a link in a PDF (with unified PDF enabled) using a trackpad
incorrectly navigates to the link, shortly after presenting a context menu. On macOS, we consult the
immediate action state to avoid following the link upon handling a click, but this mechanism doesn't
exist on iOS.

To address this, we add some plumbing to update `WebPage` when the UI-side context menu interaction
is presented and dismissed, and consult this state in the same place where we currently bail when
handling an immediate action on macOS.

* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView contextMenuInteraction:willDisplayMenuForConfiguration:animator:]):
(-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):

Add IPC calls to the web process, so that `WebPage` can track context menu interaction lifecycle.

* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::willBeginContextMenuInteraction):
(WebKit::WebPageProxy::didEndContextMenuInteraction):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::handleMouseEvent):

If the context menu is presented, avoid following the link annotation under the mouse.

* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):

Reset the new flag (`m_hasActiveContextMenuInteraction`).

* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::willBeginContextMenuInteraction):
(WebKit::WebPage::didEndContextMenuInteraction):

Canonical link: https://commits.webkit.org/290754@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