Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fe0e6eb35c7b113c44dfe6a3d3be81240f30d19a
      
https://github.com/WebKit/WebKit/commit/fe0e6eb35c7b113c44dfe6a3d3be81240f30d19a
  Author: Razvan Caliman <[email protected]>
  Date:   2026-08-18 (Tue, 18 Aug 2026)

  Changed paths:
    M Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
    M Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp

  Log Message:
  -----------
  [Web Automation] Element Click targets the wrong position inside a 
cross-origin iframe under Site Isolation
https://bugs.webkit.org/show_bug.cgi?id=321593
rdar://184713255

Reviewed by BJ Burg.

The `LayoutViewport` coordinates that 
`WebAutomationSessionProxy::computeElementLayout()`
reports are relative to the frame's local root, because a frame's web process 
cannot see
where that frame sits within the page. With Site Isolation enabled, a 
cross-origin iframe's
local root is the iframe itself,
so the reported in-view center point is missing the frame's
offset within the page. The Automation client feeds that point to the pointer 
input
dispatcher, which synthesizes events at a page-level position, so Element Click 
lands
somewhere other than the element.

Finish the conversion in the UI process, which is the only side that knows the 
whole frame
tree. The web process now stops at local root contents coordinates when its 
local root is
not the main frame, and `WebAutomationSession` walks them up to the main frame 
with the
existing `convertRectToMainFrameCoordinates()` and 
`convertPointToMainFrameCoordinates()`.

Those return main frame root view coordinates, which include the obscured 
content inset area,
whereas the `LayoutViewport` space excludes it and consumers add it back when 
synthesizing
events (see `viewportLocationToWindowLocation()`); subtract the insets so both 
paths report
the same space.

Without Site Isolation a frame's local root is always the main
frame, so the new conversion
does not run and behavior is unchanged.

* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::localRootFrameNeedingMainFrameConversion):
(WebKit::obscuredContentInsetOffset):
(WebKit::WebAutomationSession::computeElementLayout):
(WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
* Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::computeElementLayout):

Canonical link: 
https://flagged.apple.com:443/proxy?t2=DF5I1U9nY4&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE5Mzg0QG1haW4=&emid=4cf9218f-e6c9-4061-9a4a-aa0267fb6f9e&c=11



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

Reply via email to