Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 547b742836e50083101077f7002d57a24f0e92ea
      
https://github.com/WebKit/WebKit/commit/547b742836e50083101077f7002d57a24f0e92ea
  Author: Abrar Rahman Protyasha <[email protected]>
  Date:   2024-02-14 (Wed, 14 Feb 2024)

  Changed paths:
    M Source/WebCore/platform/LocalizedStrings.cpp
    M Source/WebCore/platform/LocalizedStrings.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] Context menu should have selection-activated items (copy link, 
lookup, search-the-web)
https://bugs.webkit.org/show_bug.cgi?id=269330
rdar://122918090

Reviewed by Tim Horton.

We track text selections as of 274032@main, making it possible to perform
actions on said selections. This patch introduces the context menu items
that are modulated by the current selection context. Namely, we add
"Copy Link", "Dictionary Lookup", and "Search the Web". The last of
these items has a concrete action courtesy of 274583@main, and the other
two will be implemented in upcoming commits.

In doing so, we slightly refactor how we construct the context menu by
breaking it up into sections corresponding to selections, scale
adjustment, and display mode.

* Source/WebCore/platform/LocalizedStrings.cpp:
(WebCore::contextMenuItemPDFOpenWithPreview):
(WebCore::contextMenuItemPDFCopy): Deleted.
Remove the redundant definition since contextMenuItemTagCopy() returns
the same data.

* Source/WebCore/platform/LocalizedStrings.h:
WEBCORE_EXPORT some more methods since they're being called from WebKit.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::handleContextMenuEvent):
(WebKit::UnifiedPDFPlugin::toContextMenuItemTag const):
(WebKit::UnifiedPDFPlugin::createContextMenu const):
(WebKit::UnifiedPDFPlugin::isDisplayModeContextMenuItemTag const):
(WebKit::UnifiedPDFPlugin::titleForContextMenuItemTag const):
(WebKit::UnifiedPDFPlugin::contextMenuItem const):
(WebKit::UnifiedPDFPlugin::separatorContextMenuItem const):
(WebKit::UnifiedPDFPlugin::selectionContextMenuItems const):
(WebKit::UnifiedPDFPlugin::displayModeContextMenuItems const):
(WebKit::UnifiedPDFPlugin::scaleContextMenuItems const):
(WebKit::UnifiedPDFPlugin::performContextMenuAction):

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to