[webkit-changes] [WebKit/WebKit] cfd833: [UnifiedPDF] [iOS] Add support for Share/Translate...

Wenson Hsieh noreply at github.com
Fri Dec 13 15:06:49 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cfd833226a2c7618fd05b7c961caba16f8b520f7
      https://github.com/WebKit/WebKit/commit/cfd833226a2c7618fd05b7c961caba16f8b520f7
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-12-13 (Fri, 13 Dec 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PluginView.cpp
    M Source/WebKit/WebProcess/Plugins/PluginView.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/UnifiedPDFTests.mm
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.h
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.mm

  Log Message:
  -----------
  [UnifiedPDF] [iOS] Add support for Share/Translate with selected text
https://bugs.webkit.org/show_bug.cgi?id=284646
rdar://141448279

Reviewed by Abrar Rahman Protyasha and Aditya Keerthi.

Add support for extracting text from unified PDF plugins, so that text services on iOS (e.g.
translate, share, look up) work properly.

* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::fullDocumentString const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::fullDocumentString const):
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::fullDocumentString const):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::getSelectionOrContentsAsString):

Defer to the PDF plugin if needed — this returns the `selectionString()` if present, and otherwise
falls back to `fullDocumentString()` if there is no selection.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/UnifiedPDFTests.mm:
(TestWebKitAPI::UNIFIED_PDF_TEST):
* Tools/TestWebKitAPI/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView textForSpeakSelection]):

Add a new API test hook to synchronously request the text content for "Speak Selection".

(-[TestWKWebView _accessibilityDidGetSpeakSelectionContent:]):

Use the above testing helper to verify that "Speak Selection" (which exercises this same codepath)
now works when Unified PDF is enabled.

Canonical link: https://commits.webkit.org/287819@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