[webkit-changes] [WebKit/WebKit] f8d35c: [UnifiedPDF] "Look Up ..." context menu item shoul...

Abrar Rahman Protyasha noreply at github.com
Thu Feb 15 14:57:00 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f8d35c16351cd214169214955c2507ba338a9a5e
      https://github.com/WebKit/WebKit/commit/f8d35c16351cd214169214955c2507ba338a9a5e
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-02-15 (Thu, 15 Feb 2024)

  Changed paths:
    M Source/WebCore/editing/cocoa/DictionaryLookup.mm
    M Source/WebKit/Platform/spi/Cocoa/PDFKitSPI.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] "Look Up ..." context menu item should perform a dictionary lookup of the current selection
https://bugs.webkit.org/show_bug.cgi?id=269434
rdar://122991260

Reviewed by Tim Horton.

We introduced the "Look Up ..." context menu item in 274611 at main, but
had deferred actually performing selection look up for a later commit.

This patch implements said functionality in
UnifiedPDFPlugin::searchInDictionary and adds the plumbing for the
relevant context menu item to call into it.

Moreover, this commit implements the performDictionaryLookupAtLocation
interface, which allows other lookup paths to work too, namely for the
lookup gesture recognizers in WKContentView and for -[WKWebView
quickLookWithEvent].

* Source/WebCore/editing/cocoa/DictionaryLookup.mm:
(WebCore::DictionaryLookup::stringForPDFSelection):
* Source/WebKit/Platform/spi/Cocoa/PDFKitSPI.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::performContextMenuAction):
(WebKit::UnifiedPDFPlugin::performDictionaryLookupAtLocation):
(WebKit::UnifiedPDFPlugin::searchInDictionary):
(WebKit::UnifiedPDFPlugin::selectionBoundsForFirstPageInDocumentSpace const):
(WebKit::UnifiedPDFPlugin::showDefinitionForAttributedString):

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




More information about the webkit-changes mailing list