Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 545bccd54800338a09aa33bed6aecafc07ca7380
      
https://github.com/WebKit/WebKit/commit/545bccd54800338a09aa33bed6aecafc07ca7380
  Author: Alex Christensen <[email protected]>
  Date:   2026-07-07 (Tue, 07 Jul 2026)

  Changed paths:
    M LayoutTests/http/tests/site-isolation/fullscreen-expected.txt
    M LayoutTests/http/tests/site-isolation/fullscreen.html
    M Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp
    M Source/WebKit/UIProcess/WebFullScreenManagerProxy.h
    M Source/WebKit/UIProcess/WebFullScreenManagerProxy.messages.in
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/mac/PageClientImplMac.h
    M Source/WebKit/UIProcess/mac/PageClientImplMac.mm
    M Source/WebKit/UIProcess/mac/WKFullScreenWindowController.h
    M Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm
    M
Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp
    M Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.h
    M Tools/WebKitTestRunner/TestController.cpp
    M Tools/WebKitTestRunner/TestController.h

  Log Message:
  -----------
  [Site Isolation] Enter fullscreen animation begin needs coordinate 
transformation with site isolation on
https://bugs.webkit.org/show_bug.cgi?id=318149
rdar://153776866

Reviewed by Andy Estes.

This was attempted once before in 301065@main but it was reverted in 
302010@main because it changed what
coordinates are used for fullscreen transitions.  This happened because the 
prior approach was to transform
the coordinates in WebFullScreenManagerProxy::enterFullScreen and use them in
WebFullScreenManagerProxy::beganEnterFullScreen, but in order to do that we 
changed the time when the initial
and final coordinates were gathered and stored.  In a process that has multiple 
IPC roundtrips to give the
page a chance to change to
the new size then transition to the new size, this timing change broke things.

In this PR, I take a different approach.  I don't change when I gather or store 
the coordinates, but I
change what coordinate space they are in.  Instead of converting to screen 
space in the web content process,
I convert to root frame coordinate space in the web content process, then in 
the UI process I take those
coordinates and convert them to main frame space then to screen space.  This 
would be easier, but when I'm
doing those transformations the window has already been detached so I can't use 
WebPageProxy::syncRootViewToScreen
because that uses the wrong window and therefore gives me the wrong 
coordinates.  Instead, I introduce a new
utility, convertMainFrameCoordinatesInFullscreenPlaceholderViewToScreen, that 
uses the old window to do the
same coordinate transformation.  I verified that the coordinates before and 
after this change are identical.

The only remaining tricky part once I got
that working was to get it working with site isolation.  At the
point in time when I would like to convert iframe coordinates to main frame 
coordinates, the frame coordinates
have already been changed by enterFullScreenForOwnerElementsInOtherProcesses so 
WebPageProxy's
geometry conversion utilities like convertRectToMainFrameCoordinates are also 
giving the wrong values.  The
page has already changed in multiple processes, so the ability to transform 
coordinates from iframe space
to main frame space has been destroyed.  To make it work I use a cached value 
of m_rootFrameOriginInMainFrameCoordinates
that I stored from convertPointToMainFrameCoordinates before 
enterFullScreenForOwnerElementsInOtherProcesses
was called to transform the coordinates.  This is somewhat equivalent to our 
previous approach of using a
web process's cached values of the location of its window in the screen.

While I was reorganizing things around 
enterFullScreenForOwnerElementsInOtherProcesses, I
realized that
the condition in which we need a call to nextPresentationUpdate after it was 
not when site isolation is enabled,
but rather when 
WebFullScreenManagerProxy::enterFullScreenForOwnerElementsInOtherProcesses 
sends IPC to other
processes to tell them to update their geometry for entering fullscreen.  We 
need the nextPresentationUpdate call
in that case because we need the geometry changes to percolate down the frame 
tree scattered across multiple
web content processes.

The test and infrastructure is taken from Nipun's earlier work, 301065@main.

* LayoutTests/http/tests/site-isolation/fullscreen-expected.txt:
* LayoutTests/http/tests/site-isolation/fullscreen.html:
*
Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::enterFullScreen):
(WebKit::WebFullScreenManagerProxy::enterFullScreenForOwnerElementsInOtherProcesses):
(WebKit::WebFullScreenManagerProxy::convertFromRootViewToScreenCoordinates):
(WebKit::WebFullScreenManagerProxy::beganEnterFullScreen):
(WebKit::WebFullScreenManagerProxy::beganExitFullScreen):
(WebKit::WebFullScreenManagerProxyClient::convertMainFrameCoordinatesInFullscreenPlaceholderViewToScreen
 const):
* Source/WebKit/UIProcess/WebFullScreenManagerProxy.h:
* Source/WebKit/UIProcess/WebFullScreenManagerProxy.messages.in:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::convertPointToMainFrameCoordinates):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/mac/PageClientImplMac.h:
* Source/WebKit/UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::convertMainFrameCoordinatesInFullscreenPlaceholderViewToScreen
 const):
*
Source/WebKit/UIProcess/mac/WKFullScreenWindowController.h:
* Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController 
convertMainFrameCoordinatesInFullscreenPlaceholderViewToScreen:]):
* Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::rootViewRectOfContents):
(WebKit::WebFullScreenManager::performEnterFullScreen):
(WebKit::WebFullScreenManager::willEnterFullScreen):
(WebKit::WebFullScreenManager::willExitFullScreen):
(WebKit::screenRectOfContents): Deleted.
* Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.h:
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::beganEnterFullScreen):
(WTR::TestController::beganExitFullScreen):
(WTR::TestController::resetStateToConsistentValues):
* Tools/WebKitTestRunner/TestController.h:
(WTR::TestController::dumpFullScreenOrigin):

Canonical link:
https://flagged.apple.com:443/proxy?t2=Dz9U8l1dB7&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE2NjcwQG1haW4=&emid=85e3ad45-ffd8-45cc-9bbc-564f8d6b8525&c=11



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

Reply via email to