Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7d91d4c0f10fd596dd39a44424aac2a76f7deca6
      
https://github.com/WebKit/WebKit/commit/7d91d4c0f10fd596dd39a44424aac2a76f7deca6
  Author: Razvan Caliman <[email protected]>
  Date:   2026-10-07 (Wed, 07 Oct 2026)

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

  Log Message:
  -----------
  [Site Isolation] Remove usage of `convertRectToMainFrameCoordinates` in 
WebAutomationSession.cpp
https://bugs.webkit.org/show_bug.cgi?id=324499
rdar://187738534

Reviewed by Kiet Ho and BJ Burg.

The Automation protocol reports `LayoutViewport` coordinates relative to the 
page's main frame.

`WebAutomationSessionProxy::computeElementLayout()` could not produce those for 
an out-of-process
iframe, so it stopped at the frame's local root and 
`WebAutomationSession::computeElementLayout()`
finished the walk in the UI process with one IPC round trip per ancestor frame, 
then subtracted
the obscured content insets to approximate the layout viewport.

This patch changes that to do the whole conversion in the element's own web 
process instead.
Following https://commits.webkit.org/320835@main, 
`convertToRootViewAcrossIsolatedFrames()` crosses process boundaries
using the geometry already synced into that process by `FrameGeometrySyncData` 
and `FrameScrollPosition`.

The main frame's view is a `RemoteFrameView` there, which is enough (it 
overrides
`layoutViewportRect()`) so the web process can apply `rootViewToContents()` and
`absoluteToLayoutViewportRect()` itself and the UI process does nothing.

This closes the layout-viewport-offset half of the FIXME for 
webkit.org/b/322023.
The offset is now taken from the main frame's real `layoutViewportRect()` 
rather than approximated by subtracting insets.
The page-scale half stays open; `Page::pageScaleFactor()` is not broadcast to 
subframe processes.

Tests in Safari repository.

* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::sendComputeElementLayout):
(WebKit::WebAutomationSession::computeElementLayout):
(WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
(WebKit::localRootFrameNeedingMainFrameConversion): Deleted.
(WebKit::obscuredContentInsetOffset): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::convertPointToMainFrameCoordinates): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::convertRectFromFrameClientToMainFrameView):
(WebKit::convertPointFromFrameClientToMainFrameView):
(WebKit::WebAutomationSessionProxy::computeElementLayout):
(WebKit::convertRectFromFrameClientToRootView): Deleted.
(WebKit::convertPointFromFrameClientToRootView): Deleted.

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



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

Reply via email to