[webkit-changes] [WebKit/WebKit] 27f72f: [UnifiedPDF] [iOS] Add support for copying selecte...

Abrar Rahman Protyasha noreply at github.com
Tue Dec 17 02:10:35 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 27f72f114ea12b0742c376697558c39c0b42d297
      https://github.com/WebKit/WebKit/commit/27f72f114ea12b0742c376697558c39c0b42d297
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-12-17 (Tue, 17 Dec 2024)

  Changed paths:
    M Source/WebCore/page/Page.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] [iOS] Add support for copying selected text
https://bugs.webkit.org/show_bug.cgi?id=284744
rdar://141325178

Reviewed by Wenson Hsieh.

Previously, the codepath to write items to (any) pasteboard was guarded
behind PLATFORM(MAC), and employed some PasteboardStrategy API that was
generally no-op for iOS.

This patch introduces support for copying selected text in the plugin on
iOS by making the aforementioned codepath platform agnostic. We do so by
providing platform agnostic data types for pasteboard items and by
making use of WebCore::Pasteboard[Strategy] API that abstract away
underlying platform differences when copying text.

We also take a chance to refactor some of the copying code to break down
PDFPluginBase::writeItemsToPasteboard() into two different methods, one
to write items for copy-paste, and the other for find. This simplifies
the latter case because we only ever expect to write a single string to
the find pasteboard at a time, and it means that the "writeItems..."
method need not condition its codepath depending on the targeted
pasteboard (this is helpful because there is no NSPasteboardNameFind
analogy in iOS).

* Source/WebCore/page/Page.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:
(-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]):
(WebKit::PDFPlugin::handleEditingCommand):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::pageIdentifier const):
(WebKit::PDFPluginBase::stringPasteboardType):
(WebKit::PDFPluginBase::urlPasteboardType):
(WebKit::PDFPluginBase::htmlPasteboardType):
(WebKit::PDFPluginBase::rtfPasteboardType):
(WebKit::PDFPluginBase::writeItemsToGeneralPasteboard const):
(WebKit::PDFPluginBase::writeStringToFindPasteboard const):
(WebKit::PDFPluginBase::writeItemsToPasteboard const): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::performCopyLinkOperation const):
(WebKit::htmlDataFromSelection):
(WebKit::UnifiedPDFPlugin::performCopyEditingOperation const):
(WebKit::UnifiedPDFPlugin::takeFindStringFromSelection):

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



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


More information about the webkit-changes mailing list