[webkit-changes] [WebKit/WebKit] 9cce2a: [UnifiedPDF] [iOS] Support context menu when long ...
Wenson Hsieh
noreply at github.com
Mon Dec 16 14:33:14 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9cce2afd2b8d404682d457ca8b6eb5b519520101
https://github.com/WebKit/WebKit/commit/9cce2afd2b8d404682d457ca8b6eb5b519520101
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2024-12-16 (Mon, 16 Dec 2024)
Changed paths:
M Source/WebKit/Shared/ios/InteractionInformationAtPosition.h
M Source/WebKit/Shared/ios/InteractionInformationAtPosition.serialization.in
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
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/ios/WebPageIOS.mm
Log Message:
-----------
[UnifiedPDF] [iOS] Support context menu when long pressing on links
https://bugs.webkit.org/show_bug.cgi?id=284760
rdar://141555318
Reviewed by Abrar Rahman Protyasha.
Add support for long-pressing on links in PDFs on iOS, when unified PDF is enabled. See below for
more details.
* Source/WebKit/Shared/ios/InteractionInformationAtPosition.h:
* Source/WebKit/Shared/ios/InteractionInformationAtPosition.serialization.in:
Add an `isInPlugin` flag to position information, so that we can bail early if the user selects
"Copy Link" and handle the interaction without round-tripping back to the web process.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView actionSheetAssistant:performAction:]):
(-[WKContentView _tryToCopyLinkURLFromPlugin]):
Handle the Copy action immediately, in the case where the long-pressed "element" is a link
annotation inside a PDF plugin.
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::linkURLAndBoundsAtPoint const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::linkURLAndBoundsAtPoint const):
Add a new method to retrieve the link URL and bounds at the given point in root view coordinates;
reimplement `highlightRectForTapAtPoint` on top of `linkURLAndBoundsAtPoint`. Note that I opted to
keep this separate method instead of removing it and just using `linkURLAndBoundsAtPoint` when
getting rects for the tap highlight, since we'll probably want to support other kinds of tappable
annotations (for which we want to show the tap highlight) in the future.
(WebKit::UnifiedPDFPlugin::highlightRectForTapAtPoint const):
(WebKit::UnifiedPDFPlugin::handleSyntheticClick):
Drive-by fix: allow shift-tap on links with an active selection to trigger navigation.
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::linkURLAndBoundsAtPoint const):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::positionInformation):
Populate `isLink`, `url`, `bounds`, and `isInPlugin` when long-pressing a link in a PDF.
Canonical link: https://commits.webkit.org/287912@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