Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8943706e7394a34d007f9b7b3bb50cb4e4ec8def
      
https://github.com/WebKit/WebKit/commit/8943706e7394a34d007f9b7b3bb50cb4e4ec8def
  Author: Rupin Mittal <[email protected]>
  Date:   2025-09-18 (Thu, 18 Sep 2025)

  Changed paths:
    M Source/WebCore/page/ImageAnalysisQueue.cpp
    M Source/WebCore/page/ImageAnalysisQueue.h
    M Source/WebCore/page/Page.cpp
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  [Site Isolation] Translation does not work for images in cross-site iframes
https://bugs.webkit.org/show_bug.cgi?id=299051
rdar://160809446

Reviewed by Brady Eidson and Wenson Hsieh.

With site-isolation off, translating a page will translate images that are in
cross-site iframes. With site-isolation on, those images are not translated.

There are two issues:

1. WebPageProxy::startVisualTranslation() starts the image translation only in
   the current-process' document. So translation occurs only in the main frame
   and any same-origin iframes.

   We update this to start the image translation in all web content processes.

2. Now the image translation is starting in all processes. But we see that
   WebPage::startVisualTranslation() only enqueues images to be translated if
   it's able to access the main frame's document. For remote frames, this is
   not possible, so the remote frames' images won't get translated.

   We update this to start the translation regardless of if the main frame
   is local or not. Instead of doing a document traversal (which doesn't work
   with site-isolation), we will do a frame traversal.

   Each process will enqueue (and then translate) the images of any frame in
   the frame tree that is local to the process. Since all web content processes
   are doing this, all frames will be translated.

This is tested by a new API test: SiteIsolation.IframeImageTranslation.

With site isolation off, if the page is translated, then a new cross-site iframe
is added, that iframe's images should also be translated. This doesn't happen
with site isolation on but will be fixed in subsequent patches.

* Source/WebCore/page/ImageAnalysisQueue.cpp:
(WebCore::ImageAnalysisQueue::enqueueAllImagesIfNeeded):
(WebCore::ImageAnalysisQueue::enqueueAllImagesRecursive):
* Source/WebCore/page/ImageAnalysisQueue.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::analyzeImagesForFindInPage):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::startVisualTranslation):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::startVisualTranslation):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(processRequestWithResults):
(makeFakeRequest):
(makeImageAnalysisRequestSwizzler):
(-[TestWKWebViewImageAnalysisTests waitForImageAnalysisRequests:]):
(TestWebKitAPI::(SiteIsolation, IframeImageTranslation)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to