Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3b224ebe719589c5f37a98cf6e7739c0ba4b2169
      
https://github.com/WebKit/WebKit/commit/3b224ebe719589c5f37a98cf6e7739c0ba4b2169
  Author: Zak Ridouh <[email protected]>
  Date:   2026-10-02 (Fri, 02 Oct 2026)

  Changed paths:
    M Source/WebCore/platform/Widget.h
    M Source/WebKit/UIProcess/API/mac/WKWebViewPrivateForTestingMac.h
    M Source/WebKit/UIProcess/API/mac/WKWebViewTestingMac.mm
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm

  Log Message:
  -----------
  [Site Isolation] Look Up menu and context menu are displaced on cross origin 
iframe src=pdf
https://bugs.webkit.org/show_bug.cgi?id=322555
rdar://163147553

Reviewed by Abrar Rahman Protyasha.

A PDF in a cross-origin iframe showed its Look Up highlight and popover, and its
context menu, offset by the iframe's position in the page.

Under site isolation, the iframe is the root frame of its own web process, so 
the
PDF plugin's "root view" coordinates are relative to the iframe, not the main 
frame.
Geometry sent to the UI process has to be converted the rest of the way.

Add PDFPluginBase::convertFromRootViewToMainFrameView(), which does that 
conversion
in the web process with FrameView::convertToRootViewAcrossIsolatedFrames(), 
starting
from the top of the plugin's widget tree. Export Widget::root() for this. Use 
it for:

- PDF text indicators, in textIndicatorForPageRect(). Other text indicators 
have been
  in main frame coordinates since 321708@main.
- The context menu location, in createContextMenu().
- The Look Up popup origin, in showDefinitionForSelection(). This isn't done in
  dictionaryPopupInfoForSelection() because the force touch path still converts 
the
  origin with RemoteDictionaryPopupInfoToRootView. Removing that is bug 326008.

Add -[WKWebView _setDidPerformDictionaryLookupHandlerForTesting:] so tests can 
check
the Look Up geometry without the Reveal framework.

Also share the site isolation parameters of the UnifiedPDF test suites in a
SiteIsolationParams struct, and drop the redundant configurations that enable 
the
shared process without site isolation.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm

* Source/WebCore/platform/Widget.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewPrivateForTestingMac.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewTestingMac.mm:
(-[WKWebView _setDidPerformDictionaryLookupHandlerForTesting:]):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::didPerformDictionaryLookup):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::rootView const):
(WebKit::PDFPluginBase::convertFromRootViewToMainFrameView const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::createContextMenu const):
(WebKit::UnifiedPDFPlugin::textIndicatorForPageRect):
(WebKit::UnifiedPDFPlugin::showDefinitionForSelection):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm:
(TestWebKitAPI::testName):
(TestWebKitAPI::SiteIsolationParams::pdfURL const):
(TestWebKitAPI::SiteIsolationParams::applyTo const):
(TestWebKitAPI::SiteIsolationParams::testName const):
(TestWebKitAPI::withEachPDFEmbedElement):
(TestWebKitAPI::EmbeddedPDFFitsToFrame::embedElement const):
(TestWebKitAPI::EmbeddedPDFFitsToFrame::SetUp):
(TestWebKitAPI::EmbeddedPDFFitsToFrame::testNameGenerator):
(TestWebKitAPI::EmbeddedPDFLookUp::SetUp):
(TestWebKitAPI::EmbeddedPDFLookUp::loadAndFindPointOverPDFText):
(TestWebKitAPI::EmbeddedPDFLookUp::lookUpAtPoint):
(TestWebKitAPI::EmbeddedPDFLookUp::testNameGenerator):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::embedElement const):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::mainHTML const):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::SetUp):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::testNameGenerator):
(TestWebKitAPI::TEST_P):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to