Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 34437eecfc86da42a5bc7de40f1090e30c988fdd
https://github.com/WebKit/WebKit/commit/34437eecfc86da42a5bc7de40f1090e30c988fdd
Author: Wenson Hsieh <[email protected]>
Date: 2026-08-02 (Sun, 02 Aug 2026)
Changed paths:
M Source/WebCore/page/text-extraction/TextExtraction.cpp
M Source/WebCore/page/text-extraction/TextExtraction.h
M Source/WebCore/page/text-extraction/TextExtractionTypes.h
M Source/WebKit/Shared/TextExtractionToStringConversion.cpp
M Source/WebKit/Shared/TextExtractionToStringConversion.h
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/API/Cocoa/WKWebView+TextExtraction.mm
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/WebFrame.cpp
M Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.h
M Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm
Log Message:
-----------
[Text Extraction] Include links and link URLs in extracted PDFs
https://bugs.webkit.org/show_bug.cgi?id=320847
rdar://183875371
Reviewed by Abrar Rahman Protyasha.
Refactor how text extraction handles PDF data to properly handle link URLs; see
below for more info.
Test: TextExtractionTests.ExtractFromPDFLink
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::shortenedURLString):
(WebCore::TextExtraction::extractRecursive):
(WebCore::TextExtraction::extractItem):
* Source/WebCore/page/text-extraction/TextExtraction.h:
* Source/WebCore/page/text-extraction/TextExtractionTypes.h:
Remove `pdfMarkdownContent`, and push existing PDF text extraction logic into
`UnifiedPDFPlugin`,
where we can more easily include structured data (like links with link URLs).
* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::formatPDFMarkdownForOutput): Deleted.
* Source/WebKit/Shared/TextExtractionToStringConversion.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView+TextExtraction.mm:
(-[WKWebView
_extractDebugTextWithConfigurationWithoutUpdatingFilterRules:assertionScope:completionHandler:]):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::textExtractionContent const):
Add a helper method that returns a textual representation of the extracted PDF
that includes URLs
(in the future, we can augment this to include more metadata, such as lists and
images).
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::textExtractionContent const):
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::textExtractionContent const):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::itemsForPDFTextAndLinks):
(WebKit::WebFrame::requestTextExtraction):
* Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.h:
* Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.mm:
(TestWebKitAPI::appendPDFBytes):
(TestWebKitAPI::testPDFDataWithLink):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm:
(TestWebKitAPI::(TextExtractionTests, ExtractFromPDFLink)):
Canonical link: https://commits.webkit.org/318433@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications