Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2a14de2051cd21485f7d7a65f8caf7b9f3d9ffec
      
https://github.com/WebKit/WebKit/commit/2a14de2051cd21485f7d7a65f8caf7b9f3d9ffec
  Author: Abrar Rahman Protyasha <a_protya...@apple.com>
  Date:   2024-02-14 (Wed, 14 Feb 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] "Copy Link" context menu item should copy the link from the 
current selection
https://bugs.webkit.org/show_bug.cgi?id=269423
rdar://122981243

Reviewed by Simon Fraser.

In 274611@main, we added support for a "Copy Link" context menu item.
This patch imbibes the item with its namesake functionality through the
performCopyLinkOperation method. Said method checks if the context menu
was invoked over a link-bearing annotation, and if so, extracts the URL
from that annotation and puts it on the pasteboard.

Note that we introduce a subtle behavior change through this patch. We
no longer unconditionally present the "Copy Link" context menu item for
any link annotations, and only do so for annotations containing external
links (not destinations).

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::convertFromDocumentToPlugin const):
(WebKit::UnifiedPDFPlugin::convertFromPageToDocument const):
(WebKit::annotationIsExternalLink):
(WebKit::annotationIsLinkWithDestination):
(WebKit::UnifiedPDFPlugin::handleContextMenuEvent):
(WebKit::UnifiedPDFPlugin::createContextMenu const):
(WebKit::UnifiedPDFPlugin::selectionContextMenuItems const):
(WebKit::UnifiedPDFPlugin::performContextMenuAction):
(WebKit::UnifiedPDFPlugin::performCopyLinkOperation const):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to