[webkit-changes] [WebKit/WebKit] 9e046a: [UnifiedPDF] [iOS] Navigate when tapping on links ...

Wenson Hsieh noreply at github.com
Mon Dec 16 08:38:36 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9e046abb49e52a1190018fc9a6c167e70c73f4eb
      https://github.com/WebKit/WebKit/commit/9e046abb49e52a1190018fc9a6c167e70c73f4eb
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-12-16 (Mon, 16 Dec 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PluginView.cpp
    M Source/WebKit/WebProcess/Plugins/PluginView.h
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [UnifiedPDF] [iOS] Navigate when tapping on links in PDF documents
https://bugs.webkit.org/show_bug.cgi?id=284719
rdar://141519205

Reviewed by Richard Robinson.

Add support for tapping links in PDF documents when unified PDF is enabled (along with some
additional items). See below for more details.

* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::highlightRectForTapAtPoint const):
(WebKit::PDFPluginBase::handleSyntheticClick):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::navigateToURL):

Add an optional `PlatformMouseEvent` parameter, for use when producing the `MouseEvent` used to
trigger the navigation. This allows a new tab to be opened, when holding down ⌘ while tapping a link
in a PDF.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::followLinkAnnotation):
(WebKit::UnifiedPDFPlugin::highlightRectForTapAtPoint const):

Add a new PDF plugin hook to return the highlight rect at the given point in root view coordinates.

(WebKit::UnifiedPDFPlugin::handleSyntheticClick):

Add a method to handle synthetic clicks (taps) on the PDF plugin. This will do one of three things:

- Extend the current selection if the shift key is held
- Follow a link under the given point
- Clear the active selection

(WebKit::UnifiedPDFPlugin::platformPopulateEditorStateIfNeeded const):
(WebKit::UnifiedPDFPlugin::pageToRootView const):
(WebKit::UnifiedPDFPlugin::rootViewToPage const):
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::highlightRectForTapAtPoint const):
(WebKit::PluginView::handleSyntheticClick):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):

Change the call to `clearSelection()` into `handleSyntheticClick()`, and pass in the whole platform
event (see above).

(WebKit::WebPage::sendTapHighlightForNodeIfNecessary):

Defer to the plugin if needed, when retrieving tap highlight geometry.

(WebKit::WebPage::handleTwoFingerTapAtPoint):
(WebKit::WebPage::potentialTapAtPosition):
(WebKit::WebPage::tapHighlightAtPosition):

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