Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5a4a08911c195448ffc07d8ba5917399d2dd205c
      
https://github.com/WebKit/WebKit/commit/5a4a08911c195448ffc07d8ba5917399d2dd205c
  Author: Dana Estra <[email protected]>
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
    M Source/WebCore/dom/FullscreenManager.cpp
    M Source/WebCore/html/HTMLMediaElement.cpp
    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/mac/VideoPresentationInterfaceMac.h
    M Source/WebCore/platform/mac/VideoPresentationInterfaceMac.mm
    M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.h
    M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.messages.in
    M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm
    M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.h
    M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm

  Log Message:
  -----------
  Video Viewer: Missing PIP when leaving Safari with PIP enabled
https://bugs.webkit.org/show_bug.cgi?id=275876
rdar://124376686

Reviewed by Andy Estes.

Currently when a window is in in-window / viewer mode and the safari window
is minimized, safari asks webkit to toggle PIP, but this does
not successfully occur. This is because currently we return early
from HTMLMediaElement::enterFullscreen if the document hidden.
This check has been changed to not return early if the document is
the new mode is PIP.

The above change revealed that we do not successfully return to
in-window mode when the window is maximized again, or when the
PIP return button is clicked.

To fix the case where the window is maximized but the video
does not return to in-window, this patch has us no longer return early
from FullscreenManager::requestFullscreenForElement when the document
is hidden but the new mode is in-window.

To fix the case where the the return button is clicked on the PIP
window and the video does not return to in-window, this patch has
VideoPresentationInterfaceMac wait for the document to become
visible before beginning to exit PIP. To facilitate this,
VideoPresentationModelVideoElement now listens to
visibilitychangeEvent from Document and propagates the information
to VideoPresentationInterfaceMac.

This patch lastly removes the user gesture check from the
FullscreenManager::requestFullscreenForElement prefixed API
code path, to unify the prefixed and unprefixed
paths, and to not break the behavior of manually returning to viewer
from pip.

* Source/WebCore/dom/FullscreenManager.cpp:
(WebCore::FullscreenManager::requestFullscreenForElement):
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::enterFullscreen):
* Source/WebCore/platform/cocoa/VideoPresentationModel.h:
(WebCore::VideoPresentationModelClient::documentVisibilityChanged):
* Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.h:
* Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.mm:
(WebCore::VideoPresentationModelVideoElement::cleanVideoListeners):
(WebCore::VideoPresentationModelVideoElement::setVideoElement):
(WebCore::VideoPresentationModelVideoElement::updateForEventName):
(WebCore::VideoPresentationModelVideoElement::documentVisibilityChanged):
(WebCore::VideoPresentationModelVideoElement::documentObservedEventNames):
* Source/WebCore/platform/mac/VideoPresentationInterfaceMac.h:
* Source/WebCore/platform/mac/VideoPresentationInterfaceMac.mm:
(WebCore::VideoPresentationInterfaceMac::requestHideAndExitPiP):
(WebCore::VideoPresentationInterfaceMac::documentVisibilityChanged):
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.h:
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.messages.in:
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm:
(WebKit::VideoPresentationManagerProxy::setDocumentVisibility):
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.h:
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm:
(WebKit::VideoPresentationInterfaceContext::documentVisibilityChanged):
(WebKit::VideoPresentationManager::documentVisibilityChanged):

Canonical link: https://commits.webkit.org/280360@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