Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8da9da634316e1ff561390301de8f03b4c25886a
      
https://github.com/WebKit/WebKit/commit/8da9da634316e1ff561390301de8f03b4c25886a
  Author: Andy Estes <[email protected]>
  Date:   2024-08-13 (Tue, 13 Aug 2024)

  Changed paths:
    M Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.h
    M Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.mm
    M Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.mm
    M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp

  Log Message:
  -----------
  [visionOS] Environment docking may fail if a video's src changes while in 
element fullscreen
https://bugs.webkit.org/show_bug.cgi?id=278004
rdar://130920037

Reviewed by Eric Carlson.

When a video's src (or srcObject) changes a new WebAVPlayerLayer will be 
created in the UI process,
removing the previous layer. 
VideoPresentationManagerProxy::removeClientForContext is called when
the old layer is removed, which invalidates and removes the video presentation 
model and interface
associated with the video element's context ID. When 
VideoPresentationInterfaceLMK is invalidated
it removes its LMPlayableViewController, even though an environment picker 
button owned by that
now-deallocated view controller may be presented in WKFullScreenViewController 
if the video is part
of an element fullscreen presentation. If the user were to tap that button and 
choose an
environment then docking would not occur since the LMPlayzableViewController 
and its associated
playable object no longer exist.

VideoPresentationInterfaceLMK attempted to account for this during invalidation 
by calling
VideoPresentationModel::didCleanupFullscreen(), which would ultimately call
-[WKFullScreenViewController configureEnvironmentPickerButtonView], re-creating 
a new video
presentation interface, LMPlayableViewController, playable object, and 
environment picker button if
the video was still in an element fullscreen presentation. While this 
re-creation did happen after
some forms of invalidation (e.g., when undocking and returning to element 
fullscreen) it did *not*
happen when a video layer changed because in 
VideoPresentationManagerProxy::removeClientForContext
the video presentation model had already been removed from the interface by the 
time
VideoPresentationInterface::invalidate was called.

To account ensure that a valid environment picker button is displayed in this 
case, this change
calls WebPageProxy::didCleanupFullscreen explicitly in 
VideoPresentationManagerProxy::removeClientForContext.
Also added additional logging to help diagnose bugs like this in the future.

* Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.h:
* Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.mm:
(WebCore::VideoPresentationInterfaceIOS::cleanupFullscreen):
* Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.mm:
(WebKit::VideoPresentationInterfaceLMK::invalidatePlayerViewController):
(WebKit::VideoPresentationInterfaceLMK::ensurePlayableViewController):
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm:
(WebKit::VideoPresentationManagerProxy::removeClientForContext):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCleanupFullscreen):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to