Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dd929cd085dc7862b052721523e7b6ba97b98769
      
https://github.com/WebKit/WebKit/commit/dd929cd085dc7862b052721523e7b6ba97b98769
  Author: Richard Robinson <richard_robins...@apple.com>
  Date:   2023-01-31 (Tue, 31 Jan 2023)

  Changed paths:
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm

  Log Message:
  -----------
  Find on page intermittently fails to show results in PDFs in Safari
https://bugs.webkit.org/show_bug.cgi?id=251311
rdar://100155151

Reviewed by Aditya Keerthi.

When viewing a PDF in Safari, Find in Page fails after the following sequence
of events:

1. Open a PDF in Safari
2. Activate Find in Page and search for a string
3. Refresh the page
4. Activate Find in Page again

After the last step, Find In Page will continue to return zero results 
regardless
of the search string.

This is because the `WKPDFView` instance is used as the `UIFindSession`'s 
"searchable object"
to process the search. When the page is refreshed, a new `WKPDFView` instance 
is created, but
not a new `UIFindSession`, and so the session has lost its searchable object.

This PR fixes this by setting the session's searchable object to the new 
`WKPDFView` in the
`_didCommitLoadForMainFrame` method, which is called after the new `WKPDFView` 
has been created.
This ensures that the session's searchable object is up to date.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _didCommitLoadForMainFrame]):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm:
(swizzledPerformTextSearchWithQueryString):
(TEST):

Canonical link: https://commits.webkit.org/259655@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to