Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7a705637560288b60961f3e81a806bba25ac4c99
https://github.com/WebKit/WebKit/commit/7a705637560288b60961f3e81a806bba25ac4c99
Author: Zak Ridouh <[email protected]>
Date: 2026-10-09 (Fri, 09 Oct 2026)
Changed paths:
M Source/WebKit/UIProcess/mac/WebViewImpl.h
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm
M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm
Log Message:
-----------
[Site Isolation] Remove usage of `convertRectToMainFrameCoordinates` in
`WebViewImpl::convertPDFHUDBoundingBoxToWebViewCoordinates`
https://bugs.webkit.org/show_bug.cgi?id=325001
rdar://188208698
Reviewed by Abrar Rahman Protyasha and Tim Nguyen.
The web process sent the PDF HUD's bounding box in the plugin frame's local
root view
coordinates, so WebViewImpl had to convert it to main frame coordinates with
convertRectToMainFrameCoordinates, an asynchronous round trip through the
process of each
ancestor frame. Because of that, WebViewImpl also had to track HUDs pending
creation and
buffer location and accessibility display mode updates that arrived during the
conversion.
That conversion also mispositioned the HUD for a PDF inside a scrolled
cross-origin iframe.
The bounding box already accounted for the iframe's scroll position, but
ContentsToRootViewRect
treated it as contents coordinates and subtracted the scroll position a second
time, so the
HUD was offset by the iframe's scroll position.
Instead, compute the bounding box in main frame view coordinates in the web
process using
PDFPluginBase::convertFromRootViewToMainFrameView, which already accounts for
cross-origin
ancestor frames. WebViewImpl now creates and moves the HUD synchronously with
the rect it
receives, so remove convertPDFHUDBoundingBoxToWebViewCoordinates and
m_pdfHUDsPendingCreation.
Added an API test that scrolls an iframe containing an embedded PDF and
verifies that the HUD
follows it, for each embedding element and site isolation configuration.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::createPDFHUD):
(WebKit::WebViewImpl::updatePDFHUDLocation):
(WebKit::WebViewImpl::updatePDFHUDAccessibilityDisplayMode):
(WebKit::WebViewImpl::removePDFHUD):
(WebKit::WebViewImpl::removeAllPDFHUDs):
(WebKit::WebViewImpl::convertPDFHUDBoundingBoxToWebViewCoordinates): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::updateHUDVisibility):
(WebKit::PDFPluginBase::updateHUDLocation):
(WebKit::PDFPluginBase::frameForHUDInMainFrameViewCoordinates):
(WebKit::PDFPluginBase::frameForHUDInRootViewCoordinates): Deleted.
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::updatePDFHUDLocationsAfterRemoteFrameGeometryChange):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm:
(TestWebKitAPI::SiteIsolationParams::frameURL const):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::embeddedPDFHTML const):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::mainHTML const):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::mainHTMLWithIframe const):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::scrollableFrameHTML const):
(TestWebKitAPI::TEST_P(EmbeddedPDFHUDSiteIsolation, HUDTracksScrolledIframe)):
Canonical link: https://commits.webkit.org/323194@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications