[webkit-changes] [WebKit/WebKit] 1a18f3: [UnifiedPDF][iOS] Add support for returning find m...

Aditya Keerthi noreply at github.com
Sat Sep 28 14:51:54 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1a18f37dc88fade68262e218cfc1fe8f29f59d52
      https://github.com/WebKit/WebKit/commit/1a18f37dc88fade68262e218cfc1fe8f29f59d52
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2024-09-28 (Sat, 28 Sep 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h
    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/WebFoundTextRangeController.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm

  Log Message:
  -----------
  [UnifiedPDF][iOS] Add support for returning find matches and painting holes
https://bugs.webkit.org/show_bug.cgi?id=280545
rdar://136857262

Reviewed by Wenson Hsieh.

Integrate `WebFoundTextRangeController` and `UnifiedPDFPlugin` to implement
a version of Find-in-PDF where all found matches are returned up front, as
expected by the UIKit API.

Following this patch the number of matches is accurately reported and holes
in the find overlay are painted for all matches.

* Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::rectsForTextMatchesInRect const):
(WebKit::UnifiedPDFPlugin::findTextMatches):

Encode a `PDFSelection` as a `WebFoundTextRange::PDFData` so that it can be sent
across the process boundary, and restored as necessary.

(WebKit::UnifiedPDFPlugin::rectsForTextMatch):

Feed rects for PDF text matches to `WebFoundTextRangeController`.

(WebKit::UnifiedPDFPlugin::visibleRectsForFindMatchRects const):

Factor out rect computation into a common method.

(WebKit::UnifiedPDFPlugin::selectionFromWebFoundTextRangePDFData const):

Helper to convert `WebFoundTextRange::PDFData` coming from the UI process back
into a `PDFSelection`.

* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::findTextMatches):
(WebKit::PluginView::rectsForTextMatch):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:
(WebKit::WebFoundTextRangeController::findTextRangesForStringMatches):

Update method to search in PDFs.

(WebKit::WebFoundTextRangeController::decorateTextRangeWithStyle):

Ensure the decorate ranges are updated, in order to paint the holes.

Move the DOM / `SimpleRange` specific logic, so that the common code to both
DOM and PDF searching is run.

(WebKit::WebFoundTextRangeController::rectsForTextMatchesInRect):

Add rects for PDF matches.

(WebKit::WebFoundTextRangeController::simpleRangeFromFoundTextRange):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm:
(configurationForWebViewTestingFindInUnifiedPDF):
(TEST(WebKit, FindInUnifiedPDF)):
(TEST(WebKit, FindInUnifiedPDFAfterReload)):
(TEST(WebKit, FindInUnifiedPDFAfterFindInPage)):

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