Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bbc90c010446b48541978c95b55d83151583dfb8
      
https://github.com/WebKit/WebKit/commit/bbc90c010446b48541978c95b55d83151583dfb8
  Author: Abrar Rahman Protyasha <[email protected]>
  Date:   2026-07-28 (Tue, 28 Jul 2026)

  Changed paths:
    M Source/WebKit/UIProcess/mac/WebViewImpl.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm

  Log Message:
  -----------
  [Site Isolation] [macOS] PDF HUD in cross origin <iframe src=pdf> is 
unexpectedly offset
https://bugs.webkit.org/show_bug.cgi?id=320358
rdar://162548811

Reviewed by Richard Robinson and Aditya Keerthi.

A PDF plugin reports its HUD bounding box in its frame tree's root view
coordinate space. When an embedded PDF is in a site isolated subframe,
that root is the subframe rather than the top-level web view the HUD is
a subview of, so the box lacks the subframe's offset within the page and
the HUD is drawn at the wrong location.

In this patch, we convert the bounding box from the plugin frame's local
root to the top-level main frame coordinates in the UI process. Since
this is an async conversion, we defer PDF HUD creation until the frame
has been converted. As such, we introduce a map to keep track of pending
HUD location updates that we apply after HUD creation.

Test: TestWebKitAPI.UnifiedPDF.EmbeddedPDFHUDSiteIsolation

* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::createPDFHUD):
(WebKit::WebViewImpl::updatePDFHUDLocation):
(WebKit::WebViewImpl::convertPDFHUDBoundingBoxToWebViewCoordinates):
(WebKit::WebViewImpl::removePDFHUD):
(WebKit::WebViewImpl::removeAllPDFHUDs):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm:
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::embedElement const):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::crossOrigin const):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::siteIsolationEnabled const):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::mainHTML const):
(TestWebKitAPI::EmbeddedPDFHUDSiteIsolation::testNameGenerator):
(TestWebKitAPI::TEST_P):
  Covers the matrix of { <iframe>, <embed>, <object> } x { same-origin,
  cross-origin } x { SI disabled, enabled } and asserting that the HUD
  frame lands at the emebedded element's offset in every case.

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



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

Reply via email to