Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
ImageAnalysisQueue should reanalyze image elements whose image source…
…s have changed https://bugs.webkit.org/show_bug.cgi?id=240371 rdar://93175651 Reviewed by Tim Horton. Currently, ImageAnalysisQueue maintains the set of all image elements that have been queued for analysis, and avoids re-queueing such image elements. However, on some websites, this leads to stale analysis results being shown in certain image elements that have changed image sources (and subsequently finished loaded the new image). To address this, we introduce a mechanism to remember the latest image URL for image elements that have been analyzed using the analysis queue; we only avoid reanalyzing these same image elements if the source URL is the same as the source URL when we last analyzed it. This allows us (for instance) to handle the scenario where a single image element periodically cycles between different `src` attribute values. Test: ImageAnalysisTests.AnalyzeImageAfterChangingSource * page/ImageAnalysisQueue.cpp: (WebCore::ImageAnalysisQueue::enqueueIfNeeded): Also avoid trying to prematurely analyze images whose cached images only contain the null image. This caused empty results to sometimes be incorrectly cached for some image elements, if analysis is triggered too early. (WebCore::ImageAnalysisQueue::resumeProcessing): * page/ImageAnalysisQueue.h: To aid with debugging similar issues in the future, plumb the image URL through to `requestImageAnalysisWithIdentifier`, which (if an engineering default is specified) will additionally reveal the URL in system logs. * Platform/cocoa/ImageAnalysisUtilities.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::requestTextRecognition): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView requestTextRecognition:imageData:identifier:completionHandler:]): Add an API test to exercise the scenario by verifying that the same image element is reanalyzed after setting the `src` to a different image URL. * TestWebKitAPI/Tests/WebKitCocoa/ImageAnalysisTests.mm: (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/250546@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294179 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
9 changed files
with
110 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters