Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ebc2413b86622c54219f311b81a98ccdd4b7063d
      
https://github.com/WebKit/WebKit/commit/ebc2413b86622c54219f311b81a98ccdd4b7063d
  Author: Zak Ridouh <[email protected]>
  Date:   2026-08-15 (Sat, 15 Aug 2026)

  Changed paths:
    M Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp
    M Source/WebKit/UIProcess/WebFullScreenManagerProxy.h
    M Source/WebKit/UIProcess/WebFullScreenManagerProxy.messages.in
    M Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M 
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/FullscreenRemoveNodeBeforeEnter.mm

  Log Message:
  -----------
  [Fullscreen] Unwind fullscreen state when entering fullscreen fails
<https://bugs.webkit.org/show_bug.cgi?id=321123>
<rdar://problem/184157871>

Reviewed by Charlie Wolfe.

The UI process sets m_fullscreenState and fullscreens the owner elements in
the
processes hosting ancestor frames before the web process confirms entering. Only
beganExitFullScreen undoes that, and the failure paths send CloseFullScreen()
instead of reaching it, so the page and its ancestor frames stay fullscreened 
for
the lifetime of the page.

Unwind in close(), since CloseFullScreen() means fullscreen failed or is over:
reset m_fullscreenState, exit fullscreen in the ancestor processes, and notify 
the
fullscreen client. Every process hosting a frame of the page can send that
message, so the handler now message checks the sender against the process that
owns fullscreen. Rename Close() to CloseFullScreen() to keep that checked 
handler
distinct from close(), which detachFromClient and closeWithCallback call with no
sender to validate.

The web process keeps the same state stuck: only didExitFullScreen resets
WebPage::m_isInFullscreenMode, which selects native viewport parameters on iOS.
Reset it in WebFullScreenManager::close() too, and return
early when
willEnterFullscreen() throws, since that path closed and then sent
BeganEnterFullScreen anyway.

performEnterFullScreen cleans up locally when the UI process declines: nothing 
was
entered there, and m_fullScreenFrameID can belong to another process.

* Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::closeFullScreen):
(WebKit::WebFullScreenManagerProxy::close):
(WebKit::WebFullScreenManagerProxy::detachFromClient):
(WebKit::WebFullScreenManagerProxy::isFullScreenInSendingProcess const):
* Source/WebKit/UIProcess/WebFullScreenManagerProxy.h:
* Source/WebKit/UIProcess/WebFullScreenManagerProxy.messages.in:
* Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::performEnterFullScreen):
(WebKit::WebFullScreenManager::willEnterFullScreen):
(WebKit::WebFullScreenManager::close):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::closeFullScreen):
*
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/FullscreenRemoveNodeBeforeEnter.mm:
(TestWebKitAPI::TEST):

Canonical link: 
https://flagged.apple.com:443/proxy?t2=Di8F7O1dF9&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE5MjQzQG1haW4=&emid=a1e002ca-44b6-43e7-942d-89cb0cdd61f9&c=11



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

Reply via email to