Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dd4b8a6a214f6510433efd5b26267338a829157f
      
https://github.com/WebKit/WebKit/commit/dd4b8a6a214f6510433efd5b26267338a829157f
  Author: Andy Estes <[email protected]>
  Date:   2025-11-03 (Mon, 03 Nov 2025)

  Changed paths:
    M Source/WebCore/platform/cocoa/VideoPresentationModel.h
    M Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.h
    M Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.mm
    M Source/WebCore/platform/graphics/cocoa/NullVideoPresentationInterface.h
    M Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.h
    M Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.mm
    M Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
    M Source/WebCore/platform/mac/VideoPresentationInterfaceMac.h
    M Source/WebCore/platform/mac/VideoPresentationInterfaceMac.mm
    M Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.mm
    M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.h
    M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm
    M Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.h
    M Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm
    M Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h
    M Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm
    M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm

  Log Message:
  -----------
  [visionOS] Chrome missing after exiting spatial fullscreen on uploadvr.com
https://bugs.webkit.org/show_bug.cgi?id=301851
rdar://159979195

Reviewed by Jer Noble.

The following order of events can cause window chrome to be hidden in the 
WKWebView's window after
watching a video in spatial fullscreen:

1. The user enters element fullscreen; WKFullscreenWindowController saves the 
state of the
   WKWebView window’s chrome, then hides the chrome.
2. The user enters spatial fullscreen; LinearMediaKit saves the state of the 
WKWebView window’s
   chrome, then hides the chrome again.
3. The website calls document.exitFullscreen(); WKFullscreenWindowController 
closes the element
   fullscreen window and restores the saved state of the WKWebView window’s 
chrome.
4. The user exits spatial fullscreen; LinearMediaKit restores the saved state 
of the WKWebView
   window’s chrome.

Since when LinearMediaKit saved the state of the window chrome it was hidden, 
it is restored to a
hidden state in (4) even though it was previously made visible in (3).

Resolved this by checking if the native fullscreen-eligible video is in 
fullscreen when exiting
element fullscreen. If it is, WKFullscreenWindowController retains 
_parentWindowState so that it
can be later restored when native fullscreen exits. Made 
WKFullscreenWindowController a client of
the VideoPresentationModel that enters spatial fullscreen (or any other native 
fullscreen mode) so
that it can learn when the user exits native fullscreen (which required adding 
a new
VideoPresentationModelClient callback). and when they do, used 
_parentWindowState to restore window
chrome (as well as other state like ornaments and resizing behavior).

* Source/WebCore/platform/cocoa/VideoPresentationModel.h:
(WebCore::VideoPresentationModelClient::fullscreenModeChanged):
* Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.h:
* Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.mm:
(WebCore::VideoPresentationModelVideoElement::fullscreenModeChanged):
* Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.h:
* Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.mm:
(WebCore::VideoPresentationInterfaceIOS::enterFullscreenHandler):
(WebCore::VideoPresentationInterfaceIOS::exitFullscreenHandler):
(WebCore::VideoPresentationInterfaceIOS::didStartPictureInPicture):
(WebCore::VideoPresentationInterfaceIOS::failedToStartPictureInPicture):
(WebCore::VideoPresentationInterfaceIOS::didStopPictureInPicture):
(WebCore::VideoPresentationInterfaceIOS::setMode):
(WebCore::VideoPresentationInterfaceIOS::clearMode):
* Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm:
(VideoFullscreenControllerContext::fullscreenModeChanged):
* Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.mm:
(WebKit::VideoPresentationInterfaceLMK::swapFullscreenModesWith):
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.h:
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm:
(WebKit::VideoPresentationModelContext::fullscreenModeChanged):
(WebKit::VideoPresentationManagerProxy::setVideoFullscreenMode):
(WebKit::VideoPresentationManagerProxy::didCleanupFullscreen):
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.h:
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
(-[WKFullScreenViewController invalidate]):
(-[WKFullScreenViewController _bestVideoPresentationInterface]):
(-[WKFullScreenViewController 
configureEnvironmentPickerOrFullscreenVideoButtonView]):
(-[WKFullScreenViewController _playbackSessionInterface]):
(-[WKFullScreenViewController _enterVideoFullscreenAction:]):
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h:
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController initWithWebView:]):
(-[WKFullScreenWindowController _completedExitFullScreen:]):
(-[WKFullScreenWindowController _isBestVideoInFullScreen]):
(-[WKFullScreenWindowController _shouldShowOrnaments]):
(-[WKFullScreenWindowController 
_performSpatialFullScreenTransition:completionHandler:]):
(-[WKFullScreenWindowController bestVideoFullscreenModeChanged]):
(-[WKFullScreenWindowController fullScreenViewControllerDidInvalidate:]):
(-[WKFullScreenWindowController 
fullScreenViewController:bestVideoPresentationInterfaceDidChange:]):
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm:
(WebKit::VideoPresentationManager::fullscreenModeChanged):

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



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

Reply via email to