Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 054171fd6f8625e6cabc883518caa42c025a6d2e
      
https://github.com/WebKit/WebKit/commit/054171fd6f8625e6cabc883518caa42c025a6d2e
  Author: Abrar Rahman Protyasha <[email protected]>
  Date:   2026-09-04 (Fri, 04 Sep 2026)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewEditActions.mm

  Log Message:
  -----------
  [macOS] "Copy" option is enabled in edit menu after selecting text in PDF 
with copying disallowed
https://bugs.webkit.org/show_bug.cgi?id=323418
rdar://186648332

Reviewed by Aditya Keerthi.

AppKit consults -validateUserInterfaceItem: when constructing its edit
menu. When inquired about @selector(copy:), isEditingCommandEnabled()
says yes if there is an active selection in the PDF. However, this is
only necessary and not sufficient for a copy operation, since the
underlying document itself must allow copying. In this patch, we teach
our editing command validity check in the plugin to respect that
attribute of the PDF document.

For test coverage, we retrofit the existing edit action validity check
performed by CopyMenuItemDisabledWithNoSelection.

Test: WKWebViewEditActions.CopyMenuItemDisabledInCopyDisallowedPDF

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::isEditingCommandEnabled):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewEditActions.mm:
(TestWebKitAPI::validateCopyMenuItem):
(TestWebKitAPI::TEST(WKWebViewEditActions, 
CopyMenuItemDisabledWithNoSelection)):
(TestWebKitAPI::TEST(WKWebViewEditActions, 
CopyMenuItemDisabledInCopyDisallowedPDF)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to