Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 94bd82109606062bcfca470f8c792c28dc449b4d
https://github.com/WebKit/WebKit/commit/94bd82109606062bcfca470f8c792c28dc449b4d
Author: Abrar Rahman Protyasha <[email protected]>
Date: 2026-09-09 (Wed, 09 Sep 2026)
Changed paths:
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
A Tools/TestWebKitAPI/Resources/cocoa/copying-disabled.pdf
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm
Log Message:
-----------
[iOS] Edit menu over text selection shows “Copy” option for PDF document that
disallows copying
https://bugs.webkit.org/show_bug.cgi?id=323541
rdar://186619177
Reviewed by Aditya Keerthi.
Menu items show up in the callout bar depending on the result produced
by -[WKWebView canPerformAction:withSender:], which delegates decisions
to WKContentViewInteraction. For the "copy" edit action, we only ever
say NO when a selection is in an autofilled and viewable field.
As the commit title reads, this meant that we did not say NO for PDF
documents where content copying is disallowed. To fix this, we do the
following:
1. Update EditorState::PostLayoutData::canCopy to respect
-[PDFDocument allowsCopying].
2. Teach WKContentViewInteraction to also say NO for the copy edit
action when the selection is in a plugin and !canCopy.
3. (Drive-by) Fix a use-after-move in our editor state population path
in UnifiedPDFPlugin, without which canCopy was not reliably set.
Test: UnifiedPDF.CopyEditActionOn[Regular|Disallowed]Content
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformActionForWebView:withSender:]):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::platformPopulateEditorStateIfNeeded const):
* Tools/TestWebKitAPI/Resources/cocoa/copying-disabled.pdf: Added.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm:
(TestWebKitAPI::doCopyEditActionTest):
(TestWebKitAPI::UNIFIED_PDF_TEST):
Canonical link: https://commits.webkit.org/320764@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications