[webkit-changes] [WebKit/WebKit] dd76ff: [UnifiedPDF][iOS] Update WKFoundTextRange to suppo...

Aditya Keerthi noreply at github.com
Fri Sep 27 10:58:11 PDT 2024


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

  Changed paths:
    M Source/WebKit/Shared/WebFoundTextRange.cpp
    M Source/WebKit/Shared/WebFoundTextRange.h
    M Source/WebKit/Shared/WebFoundTextRange.serialization.in
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp

  Log Message:
  -----------
  [UnifiedPDF][iOS] Update WKFoundTextRange to support found text ranges in PDFs
https://bugs.webkit.org/show_bug.cgi?id=280431
rdar://136778579

Reviewed by Wenson Hsieh and Abrar Rahman Protyasha.

`WKFoundTextRange` currently only works when searching for DOM text ranges. In
order to support searching PDFs using `UIFindInteraction` / `UITextSearching`,
it should also support retrieving and restoring PDF selections.

To achieve this goal, `WKFoundTextRange` is split into `WKFoundDOMTextRange`
and `WKFoundPDFTextRange`. A PDF selection can be encoded in terms of its
start and end pages, and their respective offsets. `WebFoundTextRange` encodes
the necessary data using a variant.

The PDF ranges still encode frame information, to enable an eventual future
where PDFs in subframes are supported.

Note that `WebFoundTextRangeController` still only knows how to return
and handle DOM text ranges. Subsequent patches will add support for PDF
ranges.

* Source/WebKit/Shared/WebFoundTextRange.cpp:
(WebKit::WebFoundTextRange::hash const):
(WebKit::WebFoundTextRange::operator== const):
* Source/WebKit/Shared/WebFoundTextRange.h:
(WTF::WebFoundTextRangeHash::hash):
* Source/WebKit/Shared/WebFoundTextRange.serialization.in:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView offsetFromPosition:toPosition:]):
(+[WKFoundTextRange foundTextRangeWithWebFoundTextRange:]):
(-[WKFoundTextRange isEmpty]):
(-[WKFoundTextRange webFoundTextRange]):
(-[WKFoundDOMTextRange start]):
(-[WKFoundDOMTextRange end]):
(-[WKFoundDOMTextRange webFoundTextRange]):
(+[WKFoundDOMTextPosition textPositionWithOffset:order:]):
(-[WKFoundPDFTextRange start]):
(-[WKFoundPDFTextRange end]):
(-[WKFoundPDFTextRange webFoundTextRange]):
(+[WKFoundPDFTextPosition textPositionWithPage:offset:]):
(-[WKFoundTextRange start]): Deleted.
(-[WKFoundTextRange end]): Deleted.
(+[WKFoundTextPosition textPositionWithOffset:order:]): Deleted.
* Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:
(WebKit::WebFoundTextRangeController::findTextRangesForStringMatches):
(WebKit::WebFoundTextRangeController::redraw):
(WebKit::WebFoundTextRangeController::simpleRangeFromFoundTextRange):

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