RESOLVED FIXED 237408
[iOS] Support PDF search when using a find interaction
https://bugs.webkit.org/show_bug.cgi?id=237408
Summary [iOS] Support PDF search when using a find interaction
Aditya Keerthi
Reported 2022-03-02 22:34:22 PST
...
Attachments
Patch (8.37 KB, patch)
2022-03-02 22:37 PST, Aditya Keerthi
ews-feeder: commit-queue-
Patch (8.76 KB, patch)
2022-03-02 22:56 PST, Aditya Keerthi
wenson_hsieh: review+
Patch for landing (9.52 KB, patch)
2022-03-17 10:18 PDT, Aditya Keerthi
no flags
Address post-landing feedback (1.33 KB, patch)
2022-03-21 13:58 PDT, Aditya Keerthi
no flags
Aditya Keerthi
Comment 1 2022-03-02 22:34:46 PST
Aditya Keerthi
Comment 2 2022-03-02 22:37:23 PST
Aditya Keerthi
Comment 3 2022-03-02 22:56:08 PST
Wenson Hsieh
Comment 4 2022-03-14 08:49:07 PDT
Comment on attachment 453699 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453699&action=review > Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:787 > + if ([_customContentView conformsToProtocol:@protocol(_UITextSearching)]) > + [_findInteraction setSearchableObject:(id<_UITextSearching>)_customContentView.get()]; > + else > + [_findInteraction setSearchableObject:_contentView.get()]; Nit - perhaps you could factor this out into a helper function, and use it both here and in `-_setFindInteractionEnabled:` below. > Source/WebKit/UIProcess/ios/WKPDFView.mm:101 > + auto pos = adoptNS([[WKPDFFoundTextPosition alloc] init]); Nit - we usually don't abbreviate local variable names. Maybe rename to `position`?
Aditya Keerthi
Comment 5 2022-03-17 10:18:06 PDT
Created attachment 454986 [details] Patch for landing
Aditya Keerthi
Comment 6 2022-03-17 10:18:43 PDT
(In reply to Wenson Hsieh from comment #4) > Comment on attachment 453699 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=453699&action=review Thanks for the review! > > Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:787 > > + if ([_customContentView conformsToProtocol:@protocol(_UITextSearching)]) > > + [_findInteraction setSearchableObject:(id<_UITextSearching>)_customContentView.get()]; > > + else > > + [_findInteraction setSearchableObject:_contentView.get()]; > > Nit - perhaps you could factor this out into a helper function, and use it > both here and in `-_setFindInteractionEnabled:` below. Done. > > Source/WebKit/UIProcess/ios/WKPDFView.mm:101 > > + auto pos = adoptNS([[WKPDFFoundTextPosition alloc] init]); > > Nit - we usually don't abbreviate local variable names. Maybe rename to > `position`? Done.
EWS
Comment 7 2022-03-17 14:59:07 PDT
Committed r291445 (248568@main): <https://commits.webkit.org/248568@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 454986 [details].
Darin Adler
Comment 8 2022-03-21 13:14:52 PDT
Comment on attachment 454986 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=454986&action=review > Source/WebKit/UIProcess/ios/WKPDFView.mm:718 > + NSInteger offset = from.index - to.index; > + > + if (offset < 0) > + return NSOrderedAscending; > + > + if (offset > 0) > + return NSOrderedDescending; > + > + return NSOrderedSame; Probably not a real risk here, but typically doing subtraction to determine ordering can introduce overflow, so it’s better not to use that pattern.
Aditya Keerthi
Comment 9 2022-03-21 13:58:32 PDT
Reopening to attach new patch.
Aditya Keerthi
Comment 10 2022-03-21 13:58:33 PDT
Created attachment 455273 [details] Address post-landing feedback
EWS
Comment 11 2022-03-21 17:23:17 PDT
Committed r291591 (248685@main): <https://commits.webkit.org/248685@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 455273 [details].
Note You need to log in before you can comment on or make changes to this bug.