[webkit-changes] [WebKit/WebKit] 036ff9: Video Viewer: Exiting pip puts the video into inli...

Dana Estra noreply at github.com
Thu Aug 1 06:21:31 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 036ff9d5b8e45f0f9bfd99ad73c7adb791c65df6
      https://github.com/WebKit/WebKit/commit/036ff9d5b8e45f0f9bfd99ad73c7adb791c65df6
  Author: Dana Estra <destra at apple.com>
  Date:   2024-08-01 (Thu, 01 Aug 2024)

  Changed paths:
    M Source/WebCore/platform/cocoa/PlaybackSessionModel.h
    M Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h
    M Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm
    M Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
    M Source/WebCore/platform/mac/PlaybackSessionInterfaceMac.h
    M Source/WebCore/platform/mac/PlaybackSessionInterfaceMac.mm
    M Source/WebCore/platform/mac/WebPlaybackControlsManager.h
    M Source/WebCore/platform/mac/WebPlaybackControlsManager.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
    M Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h
    M Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm
    M Source/WebKit/UIProcess/mac/WebViewImpl.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h
    M Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in
    M Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm
    M Tools/TestWebKitAPI/Tests/mac/InWindowFullscreen.mm

  Log Message:
  -----------
  Video Viewer: Exiting pip puts the video into inline and shrinks video content
https://bugs.webkit.org/show_bug.cgi?id=277466
rdar://132932256

Reviewed by Jer Noble.

This patch adds new WKWebView SPI _enterInWindow and
_exitInWindow. _toggleInWindow enters in-window if the current mode is
anything other than in-window, and exits in-window if the current mode is
in-window. This patch separates that logic into two different methods. It will
be followed by a Safari patch utilizing the new SPI.

This bug occurs when a window occludes a video that is in viewer / in-window mode,
during which Safari puts the video into PiP mode. Then, if the user clicks
the return button on the pip window, the video enters inline mode instead of
in window mode, and the layout doesn't happen successfully in some way.

This bug is caused by WebKit and Safari racing to both change the video
mode from PiP to in-window. When the return from pip button is clicked,
this triggers webkit to set the presentation mode to in-window.
But during the exit pip process, the window becomes unoccluded,
and Safari calls _toggleInWindow in response. However because webkit has already
set the mode to in-window, calling _toggleInWindow makes the video go into inline.

This patch would give Safari the control to call either _enterInWindow or
_exitInWindow when it knows which one it wants to do. Calling _enterInWindow when the
mode is already set to in-window, or _exitInWindow when it is not in
in-window, has no effect.

* Source/WebCore/platform/cocoa/PlaybackSessionModel.h:
* Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h:
* Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::enterInWindowFullscreen):
(WebCore::PlaybackSessionModelMediaElement::exitInWindowFullscreen):
(WebCore::PlaybackSessionModelMediaElement::toggleInWindowFullscreen): Deleted.
* Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm:
* Source/WebCore/platform/mac/PlaybackSessionInterfaceMac.h:
* Source/WebCore/platform/mac/PlaybackSessionInterfaceMac.mm:
(WebCore::PlaybackSessionInterfaceMac::enterInWindowFullscreen):
(WebCore::PlaybackSessionInterfaceMac::exitInWindowFullscreen):
(WebCore::PlaybackSessionInterfaceMac::toggleInWindowFullscreen): Deleted.
* Source/WebCore/platform/mac/WebPlaybackControlsManager.h:
* Source/WebCore/platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager enterInWindow]):
(-[WebPlaybackControlsManager exitInWindow]):
(-[WebPlaybackControlsManager toggleInWindow]): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _enterInWindow]):
(-[WKWebView _exitInWindow]):
(-[WKWebView _toggleInWindow]): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
* Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
(WebKit::PlaybackSessionModelContext::enterInWindowFullscreen):
(WebKit::PlaybackSessionModelContext::exitInWindowFullscreen):
(WebKit::PlaybackSessionManagerProxy::enterInWindow):
(WebKit::PlaybackSessionManagerProxy::exitInWindow):
(WebKit::PlaybackSessionModelContext::toggleInWindowFullscreen): Deleted.
(WebKit::PlaybackSessionManagerProxy::toggleInWindow): Deleted.
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::enterInWindowFullscreen):
(WebKit::WebViewImpl::exitInWindowFullscreen):
(WebKit::WebViewImpl::toggleInWindowFullscreen): Deleted.
* Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h:
* Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in:
* Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm:
(WebKit::PlaybackSessionManager::enterInWindow):
(WebKit::PlaybackSessionManager::exitInWindow):
(WebKit::PlaybackSessionManager::toggleInWindow): Deleted.
* Tools/TestWebKitAPI/Tests/mac/InWindowFullscreen.mm:
(TestWebKitAPI::TEST(InWindowFullscreen, EnterAndExitChangesIsActive)):
(TestWebKitAPI::TEST(InWindowFullscreen, EnterChangesIsActiveWithoutUserGesture)):
(TestWebKitAPI::TEST(InWindowFullscreen, ToggleChangesIsActive)): Deleted.
(TestWebKitAPI::TEST(InWindowFullscreen, ToggleChangesIsActiveWithoutUserGesture)): Deleted.

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



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


More information about the webkit-changes mailing list