haikuwebkit/LayoutTests/media/video-presentation-mode.html

66 lines
2.8 KiB
HTML
Raw Permalink Normal View History

Update WebKitTestRunner to support running multiple video fullscreen and Picture-in-Picture tests simultaneously https://bugs.webkit.org/show_bug.cgi?id=203723 Reviewed by Jer Noble. Source/WebCore: Test: media/video-presentation-mode.html Add a flag MockVideoPresentationModeEnabled to "internals" for video fullscreen and picture-in-picture tests. * page/ChromeClient.h: (WebCore::ChromeClient::setMockVideoPresentationModeEnabled): * testing/Internals.cpp: (WebCore::Internals::setMockVideoPresentationModeEnabled): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: When the flag MockVideoPresentationModeEnabled is true, the VideoFullscreenManagerProxy in the UI process will mock the behavior of the VideoFullscreenInterface[Mac|AVKit]. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: (WebKit::VideoFullscreenManagerProxy::setMockVideoPresentationModeEnabled): * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::requestHideAndExitFullscreen): (WebKit::VideoFullscreenManagerProxy::applicationDidBecomeActive): (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::setHasVideo): (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): (WebKit::VideoFullscreenManagerProxy::setInlineRect): (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didAttachToRunningProcess): (WebKit::WebPageProxy::setMockVideoPresentationModeEnabled): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockVideoPresentationModeEnabled): (WebKit::WebChromeClient::setUpPlaybackControlsManager): (WebKit::WebChromeClient::clearPlaybackControlsManager): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/cocoa/VideoFullscreenManager.h: Source/WebKitLegacy/mac: When the flag MockVideoPresentationModeEnabled is true, WebView will ignore the requests to WebVideoFullscreenController, so that the DumpRenderTree can run multiple video fullscreen and picture-in-picture tests in parallel. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): * WebView/WebView.mm: * WebView/WebViewData.h: * WebView/WebViewInternal.h: LayoutTests: * media/video-presentation-mode-expected.txt: Added. * media/video-presentation-mode.html: Added. Canonical link: https://commits.webkit.org/224376@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-05 22:37:36 +00:00
<!doctype html>
<html>
<head>
Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. Source/WebCore: Make the HTMLVideoElement::setFullscreenMode() robust under stress tests by ignoring a request when the video element is not ready yet. Manually tested. * dom/Element.h: (WebCore::Element::didStopBeingFullscreenElement): Add a callback to indicate that the element has exited fullscreen. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::didExitFullscreen): Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): This function will return true when a video element is in the process to exit fullscreen/picture-in-picture until it has completed the process. Therefore, a page can safely request the video element to enter fullscreen/picture-in-picture when this function returns false. (WebCore::HTMLVideoElement::setFullscreenMode): (WebCore::HTMLVideoElement::didBecomeFullscreenElement): (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted. (WebCore::HTMLVideoElement::didExitFullscreen): Deleted. * html/HTMLVideoElement.h: Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only change the presentation mode when the flag is false. Source/WebKit: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Source/WebKitLegacy/mac: Move DumpRenderTree's implementation of the mock video presentation mode from WebView to WebChromeClient and call videoElement.didStopBeingFullscreenElement() when a video element exits fullscreen. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): (WebChromeClient::enterVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenToModeWithoutAnimation): * WebView/WebView.mm: (-[WebView _enterVideoFullscreenForVideoElement:mode:]): (-[WebView _exitVideoFullscreen]): (-[WebView _setMockVideoPresentationModeEnabled:]): Deleted. * WebView/WebViewData.h: * WebView/WebViewInternal.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): LayoutTests: Enable the mock video presentation mode in WebKitTestRunner and only request a video element to enter/exit fullscreen/picture-in-picture when the element is ready to do so (by checking the attribute webkitDisplayingFullscreen). * media/modern-media-controls/placard-support/placard-support-pip-expected.txt: * media/modern-media-controls/placard-support/placard-support-pip.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: Canonical link: https://commits.webkit.org/225486@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-02 22:26:02 +00:00
<script src=media-file.js></script>
<script src=video-test.js></script>
<script>
Update WebKitTestRunner to support running multiple video fullscreen and Picture-in-Picture tests simultaneously https://bugs.webkit.org/show_bug.cgi?id=203723 Reviewed by Jer Noble. Source/WebCore: Test: media/video-presentation-mode.html Add a flag MockVideoPresentationModeEnabled to "internals" for video fullscreen and picture-in-picture tests. * page/ChromeClient.h: (WebCore::ChromeClient::setMockVideoPresentationModeEnabled): * testing/Internals.cpp: (WebCore::Internals::setMockVideoPresentationModeEnabled): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: When the flag MockVideoPresentationModeEnabled is true, the VideoFullscreenManagerProxy in the UI process will mock the behavior of the VideoFullscreenInterface[Mac|AVKit]. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: (WebKit::VideoFullscreenManagerProxy::setMockVideoPresentationModeEnabled): * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::requestHideAndExitFullscreen): (WebKit::VideoFullscreenManagerProxy::applicationDidBecomeActive): (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::setHasVideo): (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): (WebKit::VideoFullscreenManagerProxy::setInlineRect): (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didAttachToRunningProcess): (WebKit::WebPageProxy::setMockVideoPresentationModeEnabled): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockVideoPresentationModeEnabled): (WebKit::WebChromeClient::setUpPlaybackControlsManager): (WebKit::WebChromeClient::clearPlaybackControlsManager): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/cocoa/VideoFullscreenManager.h: Source/WebKitLegacy/mac: When the flag MockVideoPresentationModeEnabled is true, WebView will ignore the requests to WebVideoFullscreenController, so that the DumpRenderTree can run multiple video fullscreen and picture-in-picture tests in parallel. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): * WebView/WebView.mm: * WebView/WebViewData.h: * WebView/WebViewInternal.h: LayoutTests: * media/video-presentation-mode-expected.txt: Added. * media/video-presentation-mode.html: Added. Canonical link: https://commits.webkit.org/224376@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-05 22:37:36 +00:00
function start()
{
Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. Source/WebCore: Make the HTMLVideoElement::setFullscreenMode() robust under stress tests by ignoring a request when the video element is not ready yet. Manually tested. * dom/Element.h: (WebCore::Element::didStopBeingFullscreenElement): Add a callback to indicate that the element has exited fullscreen. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::didExitFullscreen): Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): This function will return true when a video element is in the process to exit fullscreen/picture-in-picture until it has completed the process. Therefore, a page can safely request the video element to enter fullscreen/picture-in-picture when this function returns false. (WebCore::HTMLVideoElement::setFullscreenMode): (WebCore::HTMLVideoElement::didBecomeFullscreenElement): (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted. (WebCore::HTMLVideoElement::didExitFullscreen): Deleted. * html/HTMLVideoElement.h: Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only change the presentation mode when the flag is false. Source/WebKit: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Source/WebKitLegacy/mac: Move DumpRenderTree's implementation of the mock video presentation mode from WebView to WebChromeClient and call videoElement.didStopBeingFullscreenElement() when a video element exits fullscreen. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): (WebChromeClient::enterVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenToModeWithoutAnimation): * WebView/WebView.mm: (-[WebView _enterVideoFullscreenForVideoElement:mode:]): (-[WebView _exitVideoFullscreen]): (-[WebView _setMockVideoPresentationModeEnabled:]): Deleted. * WebView/WebViewData.h: * WebView/WebViewInternal.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): LayoutTests: Enable the mock video presentation mode in WebKitTestRunner and only request a video element to enter/exit fullscreen/picture-in-picture when the element is ready to do so (by checking the attribute webkitDisplayingFullscreen). * media/modern-media-controls/placard-support/placard-support-pip-expected.txt: * media/modern-media-controls/placard-support/placard-support-pip.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: Canonical link: https://commits.webkit.org/225486@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-02 22:26:02 +00:00
if (window.internals) {
internals.settings.setAllowsPictureInPictureMediaPlayback(true);
internals.setMockVideoPresentationModeEnabled(true);
Update WebKitTestRunner to support running multiple video fullscreen and Picture-in-Picture tests simultaneously https://bugs.webkit.org/show_bug.cgi?id=203723 Reviewed by Jer Noble. Source/WebCore: Test: media/video-presentation-mode.html Add a flag MockVideoPresentationModeEnabled to "internals" for video fullscreen and picture-in-picture tests. * page/ChromeClient.h: (WebCore::ChromeClient::setMockVideoPresentationModeEnabled): * testing/Internals.cpp: (WebCore::Internals::setMockVideoPresentationModeEnabled): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: When the flag MockVideoPresentationModeEnabled is true, the VideoFullscreenManagerProxy in the UI process will mock the behavior of the VideoFullscreenInterface[Mac|AVKit]. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: (WebKit::VideoFullscreenManagerProxy::setMockVideoPresentationModeEnabled): * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::requestHideAndExitFullscreen): (WebKit::VideoFullscreenManagerProxy::applicationDidBecomeActive): (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::setHasVideo): (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): (WebKit::VideoFullscreenManagerProxy::setInlineRect): (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didAttachToRunningProcess): (WebKit::WebPageProxy::setMockVideoPresentationModeEnabled): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockVideoPresentationModeEnabled): (WebKit::WebChromeClient::setUpPlaybackControlsManager): (WebKit::WebChromeClient::clearPlaybackControlsManager): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/cocoa/VideoFullscreenManager.h: Source/WebKitLegacy/mac: When the flag MockVideoPresentationModeEnabled is true, WebView will ignore the requests to WebVideoFullscreenController, so that the DumpRenderTree can run multiple video fullscreen and picture-in-picture tests in parallel. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): * WebView/WebView.mm: * WebView/WebViewData.h: * WebView/WebViewInternal.h: LayoutTests: * media/video-presentation-mode-expected.txt: Added. * media/video-presentation-mode.html: Added. Canonical link: https://commits.webkit.org/224376@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-05 22:37:36 +00:00
}
Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. Source/WebCore: Make the HTMLVideoElement::setFullscreenMode() robust under stress tests by ignoring a request when the video element is not ready yet. Manually tested. * dom/Element.h: (WebCore::Element::didStopBeingFullscreenElement): Add a callback to indicate that the element has exited fullscreen. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::didExitFullscreen): Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): This function will return true when a video element is in the process to exit fullscreen/picture-in-picture until it has completed the process. Therefore, a page can safely request the video element to enter fullscreen/picture-in-picture when this function returns false. (WebCore::HTMLVideoElement::setFullscreenMode): (WebCore::HTMLVideoElement::didBecomeFullscreenElement): (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted. (WebCore::HTMLVideoElement::didExitFullscreen): Deleted. * html/HTMLVideoElement.h: Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only change the presentation mode when the flag is false. Source/WebKit: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Source/WebKitLegacy/mac: Move DumpRenderTree's implementation of the mock video presentation mode from WebView to WebChromeClient and call videoElement.didStopBeingFullscreenElement() when a video element exits fullscreen. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): (WebChromeClient::enterVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenToModeWithoutAnimation): * WebView/WebView.mm: (-[WebView _enterVideoFullscreenForVideoElement:mode:]): (-[WebView _exitVideoFullscreen]): (-[WebView _setMockVideoPresentationModeEnabled:]): Deleted. * WebView/WebViewData.h: * WebView/WebViewInternal.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): LayoutTests: Enable the mock video presentation mode in WebKitTestRunner and only request a video element to enter/exit fullscreen/picture-in-picture when the element is ready to do so (by checking the attribute webkitDisplayingFullscreen). * media/modern-media-controls/placard-support/placard-support-pip-expected.txt: * media/modern-media-controls/placard-support/placard-support-pip.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: Canonical link: https://commits.webkit.org/225486@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-02 22:26:02 +00:00
video = document.getElementsByTagName('video')[0];
waitForEventOnce("canplaythrough", canplaythrough);
video.src = findMediaFile("video", "content/test");
consoleWrite("");
}
async function canplaythrough()
{
testExpected("video.webkitSupportsFullscreen", true);
Let webkitDisplayingFullscreen() return true when a video element’s fullscreen mode is not VideoFullscreenModeNone https://bugs.webkit.org/show_bug.cgi?id=216426 Reviewed by Jer Noble. Source/WebCore: This patch moves m_changingVideoFullscreenMode of HTMLVideoElement to HTMLMediaElement. The flag is used to protect interfaces regarding video presentation mode changes. It also guards the code path when we use element fullscreen to implement video fullscreen (VIDEO_USES_ELEMENT_FULLSCREEN). It is better to store the flag in HTMLMediaElement to have fine control. This patch reverts the changing regarding HTMLVideoElement::webkitDisplayingFullscreen in r262456. This function will return true in the same run loop as a webkitpresentationmodechanged event is fired when a video element is entering fullscreen or picture-in-picture. Also, this patch adds Internals::isChangingPresentationMode which can be used by layout tests to check whether a video presentation mode change is completed. Covered by existing tests. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::isFullscreen const): Align the implementation with isStandardFullscreen(). (WebCore::HTMLMediaElement::enterFullscreen): Set m_changingVideoFullscreenMode to true if the video element is changing presentation mode. Also fix a bug about the flag m_waitingToEnterFullscreen. (WebCore::HTMLMediaElement::exitFullscreen): Ditto. (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto. (WebCore::HTMLMediaElement::didStopBeingFullscreenElement): Ditto. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::setChangingVideoFullscreenMode): (WebCore::HTMLMediaElement::isChangingVideoFullscreenMode const): (WebCore::HTMLMediaElement::waitingToEnterFullscreen): Deleted. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Revert the change in r262456. Some web sites expect this function to return true if the video element is entering fullscreen and the event webkitpresentationmodechanged is fired. (WebCore::HTMLVideoElement::setPresentationMode): Remove code regarding m_isChangingVideoFullscreenMode. (WebCore::HTMLVideoElement::didEnterFullscreenOrPictureInPicture): Fix an event firing issue when a video element is entering fullscreen while exiting picture-in-picture. (WebCore::HTMLVideoElement::didExitFullscreenOrPictureInPicture): Fix an event firing issue when a video element is exiting picture-in-picture. (WebCore::HTMLVideoElement::isChangingPresentationMode const): This interface is used by layout tests (through Internals) to check whether a video presentation mode change is completed. (WebCore::HTMLVideoElement::didBecomeFullscreenElement): Deleted. * html/HTMLVideoElement.h: * testing/Internals.cpp: (WebCore::Internals::isChangingPresentationMode const): This interface is used by layout tests to check whether a video presentation mode change is completed. * testing/Internals.h: * testing/Internals.idl: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): Use internals.isChangingPresentationMode() to make sure a video presentation mode change (from inline to picture-in-picture) is completed before moving to the next step of the test. LayoutTests: Check Internals::isChangingPresentationMode instead of HTMLVideoElement::webkitDisplayingFullscreen to confirm the video presentation mode change is completed before moving to the next step of a test. * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt: * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html: * media/context-menu-actions.html: * media/media-fullscreen-loop-inline-expected.txt: * media/media-fullscreen-loop-inline.html: * media/media-fullscreen-pause-inline-expected.txt: * media/media-fullscreen-pause-inline.html: * media/media-fullscreen-return-to-inline-expected.txt: * media/media-fullscreen-return-to-inline.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-fullscreen-only-playback-expected.txt: * media/video-fullscreen-only-playback.html: * media/video-playsinline-expected.txt: * media/video-playsinline.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: * media/video-webkit-playsinline-expected.txt: * media/video-webkit-playsinline.html: * platform/mac/TestExpectations: Canonical link: https://commits.webkit.org/230793@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268865 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-22 15:22:39 +00:00
testExpected("video.webkitPresentationMode", "inline");
Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. Source/WebCore: Make the HTMLVideoElement::setFullscreenMode() robust under stress tests by ignoring a request when the video element is not ready yet. Manually tested. * dom/Element.h: (WebCore::Element::didStopBeingFullscreenElement): Add a callback to indicate that the element has exited fullscreen. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::didExitFullscreen): Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): This function will return true when a video element is in the process to exit fullscreen/picture-in-picture until it has completed the process. Therefore, a page can safely request the video element to enter fullscreen/picture-in-picture when this function returns false. (WebCore::HTMLVideoElement::setFullscreenMode): (WebCore::HTMLVideoElement::didBecomeFullscreenElement): (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted. (WebCore::HTMLVideoElement::didExitFullscreen): Deleted. * html/HTMLVideoElement.h: Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only change the presentation mode when the flag is false. Source/WebKit: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Source/WebKitLegacy/mac: Move DumpRenderTree's implementation of the mock video presentation mode from WebView to WebChromeClient and call videoElement.didStopBeingFullscreenElement() when a video element exits fullscreen. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): (WebChromeClient::enterVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenToModeWithoutAnimation): * WebView/WebView.mm: (-[WebView _enterVideoFullscreenForVideoElement:mode:]): (-[WebView _exitVideoFullscreen]): (-[WebView _setMockVideoPresentationModeEnabled:]): Deleted. * WebView/WebViewData.h: * WebView/WebViewInternal.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): LayoutTests: Enable the mock video presentation mode in WebKitTestRunner and only request a video element to enter/exit fullscreen/picture-in-picture when the element is ready to do so (by checking the attribute webkitDisplayingFullscreen). * media/modern-media-controls/placard-support/placard-support-pip-expected.txt: * media/modern-media-controls/placard-support/placard-support-pip.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: Canonical link: https://commits.webkit.org/225486@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-02 22:26:02 +00:00
consoleWrite("<br>** Try to enter fullscreen");
runWithKeyDown("video.webkitSetPresentationMode('fullscreen')");
waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged1);
}
async function presentationModeChanged1()
{
Let webkitDisplayingFullscreen() return true when a video element’s fullscreen mode is not VideoFullscreenModeNone https://bugs.webkit.org/show_bug.cgi?id=216426 Reviewed by Jer Noble. Source/WebCore: This patch moves m_changingVideoFullscreenMode of HTMLVideoElement to HTMLMediaElement. The flag is used to protect interfaces regarding video presentation mode changes. It also guards the code path when we use element fullscreen to implement video fullscreen (VIDEO_USES_ELEMENT_FULLSCREEN). It is better to store the flag in HTMLMediaElement to have fine control. This patch reverts the changing regarding HTMLVideoElement::webkitDisplayingFullscreen in r262456. This function will return true in the same run loop as a webkitpresentationmodechanged event is fired when a video element is entering fullscreen or picture-in-picture. Also, this patch adds Internals::isChangingPresentationMode which can be used by layout tests to check whether a video presentation mode change is completed. Covered by existing tests. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::isFullscreen const): Align the implementation with isStandardFullscreen(). (WebCore::HTMLMediaElement::enterFullscreen): Set m_changingVideoFullscreenMode to true if the video element is changing presentation mode. Also fix a bug about the flag m_waitingToEnterFullscreen. (WebCore::HTMLMediaElement::exitFullscreen): Ditto. (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto. (WebCore::HTMLMediaElement::didStopBeingFullscreenElement): Ditto. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::setChangingVideoFullscreenMode): (WebCore::HTMLMediaElement::isChangingVideoFullscreenMode const): (WebCore::HTMLMediaElement::waitingToEnterFullscreen): Deleted. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Revert the change in r262456. Some web sites expect this function to return true if the video element is entering fullscreen and the event webkitpresentationmodechanged is fired. (WebCore::HTMLVideoElement::setPresentationMode): Remove code regarding m_isChangingVideoFullscreenMode. (WebCore::HTMLVideoElement::didEnterFullscreenOrPictureInPicture): Fix an event firing issue when a video element is entering fullscreen while exiting picture-in-picture. (WebCore::HTMLVideoElement::didExitFullscreenOrPictureInPicture): Fix an event firing issue when a video element is exiting picture-in-picture. (WebCore::HTMLVideoElement::isChangingPresentationMode const): This interface is used by layout tests (through Internals) to check whether a video presentation mode change is completed. (WebCore::HTMLVideoElement::didBecomeFullscreenElement): Deleted. * html/HTMLVideoElement.h: * testing/Internals.cpp: (WebCore::Internals::isChangingPresentationMode const): This interface is used by layout tests to check whether a video presentation mode change is completed. * testing/Internals.h: * testing/Internals.idl: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): Use internals.isChangingPresentationMode() to make sure a video presentation mode change (from inline to picture-in-picture) is completed before moving to the next step of the test. LayoutTests: Check Internals::isChangingPresentationMode instead of HTMLVideoElement::webkitDisplayingFullscreen to confirm the video presentation mode change is completed before moving to the next step of a test. * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt: * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html: * media/context-menu-actions.html: * media/media-fullscreen-loop-inline-expected.txt: * media/media-fullscreen-loop-inline.html: * media/media-fullscreen-pause-inline-expected.txt: * media/media-fullscreen-pause-inline.html: * media/media-fullscreen-return-to-inline-expected.txt: * media/media-fullscreen-return-to-inline.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-fullscreen-only-playback-expected.txt: * media/video-fullscreen-only-playback.html: * media/video-playsinline-expected.txt: * media/video-playsinline.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: * media/video-webkit-playsinline-expected.txt: * media/video-webkit-playsinline.html: * platform/mac/TestExpectations: Canonical link: https://commits.webkit.org/230793@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268865 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-22 15:22:39 +00:00
consoleWrite("<br>** Received webkitpresentationmodechanged event");
await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. Source/WebCore: Make the HTMLVideoElement::setFullscreenMode() robust under stress tests by ignoring a request when the video element is not ready yet. Manually tested. * dom/Element.h: (WebCore::Element::didStopBeingFullscreenElement): Add a callback to indicate that the element has exited fullscreen. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::didExitFullscreen): Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): This function will return true when a video element is in the process to exit fullscreen/picture-in-picture until it has completed the process. Therefore, a page can safely request the video element to enter fullscreen/picture-in-picture when this function returns false. (WebCore::HTMLVideoElement::setFullscreenMode): (WebCore::HTMLVideoElement::didBecomeFullscreenElement): (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted. (WebCore::HTMLVideoElement::didExitFullscreen): Deleted. * html/HTMLVideoElement.h: Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only change the presentation mode when the flag is false. Source/WebKit: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Source/WebKitLegacy/mac: Move DumpRenderTree's implementation of the mock video presentation mode from WebView to WebChromeClient and call videoElement.didStopBeingFullscreenElement() when a video element exits fullscreen. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): (WebChromeClient::enterVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenToModeWithoutAnimation): * WebView/WebView.mm: (-[WebView _enterVideoFullscreenForVideoElement:mode:]): (-[WebView _exitVideoFullscreen]): (-[WebView _setMockVideoPresentationModeEnabled:]): Deleted. * WebView/WebViewData.h: * WebView/WebViewInternal.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): LayoutTests: Enable the mock video presentation mode in WebKitTestRunner and only request a video element to enter/exit fullscreen/picture-in-picture when the element is ready to do so (by checking the attribute webkitDisplayingFullscreen). * media/modern-media-controls/placard-support/placard-support-pip-expected.txt: * media/modern-media-controls/placard-support/placard-support-pip.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: Canonical link: https://commits.webkit.org/225486@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-02 22:26:02 +00:00
testExpected("video.webkitPresentationMode", "fullscreen");
consoleWrite("<br>** Try to enter picture-in-picture");
waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged2);
runWithKeyDown("video.webkitSetPresentationMode('picture-in-picture')");
Update WebKitTestRunner to support running multiple video fullscreen and Picture-in-Picture tests simultaneously https://bugs.webkit.org/show_bug.cgi?id=203723 Reviewed by Jer Noble. Source/WebCore: Test: media/video-presentation-mode.html Add a flag MockVideoPresentationModeEnabled to "internals" for video fullscreen and picture-in-picture tests. * page/ChromeClient.h: (WebCore::ChromeClient::setMockVideoPresentationModeEnabled): * testing/Internals.cpp: (WebCore::Internals::setMockVideoPresentationModeEnabled): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: When the flag MockVideoPresentationModeEnabled is true, the VideoFullscreenManagerProxy in the UI process will mock the behavior of the VideoFullscreenInterface[Mac|AVKit]. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: (WebKit::VideoFullscreenManagerProxy::setMockVideoPresentationModeEnabled): * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::requestHideAndExitFullscreen): (WebKit::VideoFullscreenManagerProxy::applicationDidBecomeActive): (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::setHasVideo): (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): (WebKit::VideoFullscreenManagerProxy::setInlineRect): (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didAttachToRunningProcess): (WebKit::WebPageProxy::setMockVideoPresentationModeEnabled): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockVideoPresentationModeEnabled): (WebKit::WebChromeClient::setUpPlaybackControlsManager): (WebKit::WebChromeClient::clearPlaybackControlsManager): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/cocoa/VideoFullscreenManager.h: Source/WebKitLegacy/mac: When the flag MockVideoPresentationModeEnabled is true, WebView will ignore the requests to WebVideoFullscreenController, so that the DumpRenderTree can run multiple video fullscreen and picture-in-picture tests in parallel. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): * WebView/WebView.mm: * WebView/WebViewData.h: * WebView/WebViewInternal.h: LayoutTests: * media/video-presentation-mode-expected.txt: Added. * media/video-presentation-mode.html: Added. Canonical link: https://commits.webkit.org/224376@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-05 22:37:36 +00:00
}
Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. Source/WebCore: Make the HTMLVideoElement::setFullscreenMode() robust under stress tests by ignoring a request when the video element is not ready yet. Manually tested. * dom/Element.h: (WebCore::Element::didStopBeingFullscreenElement): Add a callback to indicate that the element has exited fullscreen. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::didExitFullscreen): Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): This function will return true when a video element is in the process to exit fullscreen/picture-in-picture until it has completed the process. Therefore, a page can safely request the video element to enter fullscreen/picture-in-picture when this function returns false. (WebCore::HTMLVideoElement::setFullscreenMode): (WebCore::HTMLVideoElement::didBecomeFullscreenElement): (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted. (WebCore::HTMLVideoElement::didExitFullscreen): Deleted. * html/HTMLVideoElement.h: Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only change the presentation mode when the flag is false. Source/WebKit: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Source/WebKitLegacy/mac: Move DumpRenderTree's implementation of the mock video presentation mode from WebView to WebChromeClient and call videoElement.didStopBeingFullscreenElement() when a video element exits fullscreen. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): (WebChromeClient::enterVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenToModeWithoutAnimation): * WebView/WebView.mm: (-[WebView _enterVideoFullscreenForVideoElement:mode:]): (-[WebView _exitVideoFullscreen]): (-[WebView _setMockVideoPresentationModeEnabled:]): Deleted. * WebView/WebViewData.h: * WebView/WebViewInternal.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): LayoutTests: Enable the mock video presentation mode in WebKitTestRunner and only request a video element to enter/exit fullscreen/picture-in-picture when the element is ready to do so (by checking the attribute webkitDisplayingFullscreen). * media/modern-media-controls/placard-support/placard-support-pip-expected.txt: * media/modern-media-controls/placard-support/placard-support-pip.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: Canonical link: https://commits.webkit.org/225486@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-02 22:26:02 +00:00
async function presentationModeChanged2()
{
Let webkitDisplayingFullscreen() return true when a video element’s fullscreen mode is not VideoFullscreenModeNone https://bugs.webkit.org/show_bug.cgi?id=216426 Reviewed by Jer Noble. Source/WebCore: This patch moves m_changingVideoFullscreenMode of HTMLVideoElement to HTMLMediaElement. The flag is used to protect interfaces regarding video presentation mode changes. It also guards the code path when we use element fullscreen to implement video fullscreen (VIDEO_USES_ELEMENT_FULLSCREEN). It is better to store the flag in HTMLMediaElement to have fine control. This patch reverts the changing regarding HTMLVideoElement::webkitDisplayingFullscreen in r262456. This function will return true in the same run loop as a webkitpresentationmodechanged event is fired when a video element is entering fullscreen or picture-in-picture. Also, this patch adds Internals::isChangingPresentationMode which can be used by layout tests to check whether a video presentation mode change is completed. Covered by existing tests. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::isFullscreen const): Align the implementation with isStandardFullscreen(). (WebCore::HTMLMediaElement::enterFullscreen): Set m_changingVideoFullscreenMode to true if the video element is changing presentation mode. Also fix a bug about the flag m_waitingToEnterFullscreen. (WebCore::HTMLMediaElement::exitFullscreen): Ditto. (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto. (WebCore::HTMLMediaElement::didStopBeingFullscreenElement): Ditto. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::setChangingVideoFullscreenMode): (WebCore::HTMLMediaElement::isChangingVideoFullscreenMode const): (WebCore::HTMLMediaElement::waitingToEnterFullscreen): Deleted. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Revert the change in r262456. Some web sites expect this function to return true if the video element is entering fullscreen and the event webkitpresentationmodechanged is fired. (WebCore::HTMLVideoElement::setPresentationMode): Remove code regarding m_isChangingVideoFullscreenMode. (WebCore::HTMLVideoElement::didEnterFullscreenOrPictureInPicture): Fix an event firing issue when a video element is entering fullscreen while exiting picture-in-picture. (WebCore::HTMLVideoElement::didExitFullscreenOrPictureInPicture): Fix an event firing issue when a video element is exiting picture-in-picture. (WebCore::HTMLVideoElement::isChangingPresentationMode const): This interface is used by layout tests (through Internals) to check whether a video presentation mode change is completed. (WebCore::HTMLVideoElement::didBecomeFullscreenElement): Deleted. * html/HTMLVideoElement.h: * testing/Internals.cpp: (WebCore::Internals::isChangingPresentationMode const): This interface is used by layout tests to check whether a video presentation mode change is completed. * testing/Internals.h: * testing/Internals.idl: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): Use internals.isChangingPresentationMode() to make sure a video presentation mode change (from inline to picture-in-picture) is completed before moving to the next step of the test. LayoutTests: Check Internals::isChangingPresentationMode instead of HTMLVideoElement::webkitDisplayingFullscreen to confirm the video presentation mode change is completed before moving to the next step of a test. * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt: * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html: * media/context-menu-actions.html: * media/media-fullscreen-loop-inline-expected.txt: * media/media-fullscreen-loop-inline.html: * media/media-fullscreen-pause-inline-expected.txt: * media/media-fullscreen-pause-inline.html: * media/media-fullscreen-return-to-inline-expected.txt: * media/media-fullscreen-return-to-inline.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-fullscreen-only-playback-expected.txt: * media/video-fullscreen-only-playback.html: * media/video-playsinline-expected.txt: * media/video-playsinline.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: * media/video-webkit-playsinline-expected.txt: * media/video-webkit-playsinline.html: * platform/mac/TestExpectations: Canonical link: https://commits.webkit.org/230793@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268865 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-22 15:22:39 +00:00
consoleWrite("<br>** Received webkitpresentationmodechanged event");
await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. Source/WebCore: Make the HTMLVideoElement::setFullscreenMode() robust under stress tests by ignoring a request when the video element is not ready yet. Manually tested. * dom/Element.h: (WebCore::Element::didStopBeingFullscreenElement): Add a callback to indicate that the element has exited fullscreen. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::didExitFullscreen): Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): This function will return true when a video element is in the process to exit fullscreen/picture-in-picture until it has completed the process. Therefore, a page can safely request the video element to enter fullscreen/picture-in-picture when this function returns false. (WebCore::HTMLVideoElement::setFullscreenMode): (WebCore::HTMLVideoElement::didBecomeFullscreenElement): (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted. (WebCore::HTMLVideoElement::didExitFullscreen): Deleted. * html/HTMLVideoElement.h: Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only change the presentation mode when the flag is false. Source/WebKit: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Source/WebKitLegacy/mac: Move DumpRenderTree's implementation of the mock video presentation mode from WebView to WebChromeClient and call videoElement.didStopBeingFullscreenElement() when a video element exits fullscreen. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): (WebChromeClient::enterVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenToModeWithoutAnimation): * WebView/WebView.mm: (-[WebView _enterVideoFullscreenForVideoElement:mode:]): (-[WebView _exitVideoFullscreen]): (-[WebView _setMockVideoPresentationModeEnabled:]): Deleted. * WebView/WebViewData.h: * WebView/WebViewInternal.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): LayoutTests: Enable the mock video presentation mode in WebKitTestRunner and only request a video element to enter/exit fullscreen/picture-in-picture when the element is ready to do so (by checking the attribute webkitDisplayingFullscreen). * media/modern-media-controls/placard-support/placard-support-pip-expected.txt: * media/modern-media-controls/placard-support/placard-support-pip.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: Canonical link: https://commits.webkit.org/225486@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-02 22:26:02 +00:00
testExpected("video.webkitPresentationMode", "picture-in-picture");
consoleWrite("<br>** Try to return to inline");
waitForEventOnce('webkitpresentationmodechanged', testCompleted);
runWithKeyDown("video.webkitSetPresentationMode('inline')");
}
async function testCompleted()
{
Let webkitDisplayingFullscreen() return true when a video element’s fullscreen mode is not VideoFullscreenModeNone https://bugs.webkit.org/show_bug.cgi?id=216426 Reviewed by Jer Noble. Source/WebCore: This patch moves m_changingVideoFullscreenMode of HTMLVideoElement to HTMLMediaElement. The flag is used to protect interfaces regarding video presentation mode changes. It also guards the code path when we use element fullscreen to implement video fullscreen (VIDEO_USES_ELEMENT_FULLSCREEN). It is better to store the flag in HTMLMediaElement to have fine control. This patch reverts the changing regarding HTMLVideoElement::webkitDisplayingFullscreen in r262456. This function will return true in the same run loop as a webkitpresentationmodechanged event is fired when a video element is entering fullscreen or picture-in-picture. Also, this patch adds Internals::isChangingPresentationMode which can be used by layout tests to check whether a video presentation mode change is completed. Covered by existing tests. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::isFullscreen const): Align the implementation with isStandardFullscreen(). (WebCore::HTMLMediaElement::enterFullscreen): Set m_changingVideoFullscreenMode to true if the video element is changing presentation mode. Also fix a bug about the flag m_waitingToEnterFullscreen. (WebCore::HTMLMediaElement::exitFullscreen): Ditto. (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto. (WebCore::HTMLMediaElement::didStopBeingFullscreenElement): Ditto. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::setChangingVideoFullscreenMode): (WebCore::HTMLMediaElement::isChangingVideoFullscreenMode const): (WebCore::HTMLMediaElement::waitingToEnterFullscreen): Deleted. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Revert the change in r262456. Some web sites expect this function to return true if the video element is entering fullscreen and the event webkitpresentationmodechanged is fired. (WebCore::HTMLVideoElement::setPresentationMode): Remove code regarding m_isChangingVideoFullscreenMode. (WebCore::HTMLVideoElement::didEnterFullscreenOrPictureInPicture): Fix an event firing issue when a video element is entering fullscreen while exiting picture-in-picture. (WebCore::HTMLVideoElement::didExitFullscreenOrPictureInPicture): Fix an event firing issue when a video element is exiting picture-in-picture. (WebCore::HTMLVideoElement::isChangingPresentationMode const): This interface is used by layout tests (through Internals) to check whether a video presentation mode change is completed. (WebCore::HTMLVideoElement::didBecomeFullscreenElement): Deleted. * html/HTMLVideoElement.h: * testing/Internals.cpp: (WebCore::Internals::isChangingPresentationMode const): This interface is used by layout tests to check whether a video presentation mode change is completed. * testing/Internals.h: * testing/Internals.idl: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): Use internals.isChangingPresentationMode() to make sure a video presentation mode change (from inline to picture-in-picture) is completed before moving to the next step of the test. LayoutTests: Check Internals::isChangingPresentationMode instead of HTMLVideoElement::webkitDisplayingFullscreen to confirm the video presentation mode change is completed before moving to the next step of a test. * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt: * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html: * media/context-menu-actions.html: * media/media-fullscreen-loop-inline-expected.txt: * media/media-fullscreen-loop-inline.html: * media/media-fullscreen-pause-inline-expected.txt: * media/media-fullscreen-pause-inline.html: * media/media-fullscreen-return-to-inline-expected.txt: * media/media-fullscreen-return-to-inline.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-fullscreen-only-playback-expected.txt: * media/video-fullscreen-only-playback.html: * media/video-playsinline-expected.txt: * media/video-playsinline.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: * media/video-webkit-playsinline-expected.txt: * media/video-webkit-playsinline.html: * platform/mac/TestExpectations: Canonical link: https://commits.webkit.org/230793@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268865 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-22 15:22:39 +00:00
consoleWrite("<br>** Received webkitpresentationmodechanged event");
await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. Source/WebCore: Make the HTMLVideoElement::setFullscreenMode() robust under stress tests by ignoring a request when the video element is not ready yet. Manually tested. * dom/Element.h: (WebCore::Element::didStopBeingFullscreenElement): Add a callback to indicate that the element has exited fullscreen. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::didExitFullscreen): Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * html/HTMLMediaElement.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): This function will return true when a video element is in the process to exit fullscreen/picture-in-picture until it has completed the process. Therefore, a page can safely request the video element to enter fullscreen/picture-in-picture when this function returns false. (WebCore::HTMLVideoElement::setFullscreenMode): (WebCore::HTMLVideoElement::didBecomeFullscreenElement): (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted. (WebCore::HTMLVideoElement::didExitFullscreen): Deleted. * html/HTMLVideoElement.h: Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only change the presentation mode when the flag is false. Source/WebKit: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Source/WebKitLegacy/mac: Move DumpRenderTree's implementation of the mock video presentation mode from WebView to WebChromeClient and call videoElement.didStopBeingFullscreenElement() when a video element exits fullscreen. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): (WebChromeClient::enterVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenForVideoElement): (WebChromeClient::exitVideoFullscreenToModeWithoutAnimation): * WebView/WebView.mm: (-[WebView _enterVideoFullscreenForVideoElement:mode:]): (-[WebView _exitVideoFullscreen]): (-[WebView _setMockVideoPresentationModeEnabled:]): Deleted. * WebView/WebViewData.h: * WebView/WebViewInternal.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: (TEST): LayoutTests: Enable the mock video presentation mode in WebKitTestRunner and only request a video element to enter/exit fullscreen/picture-in-picture when the element is ready to do so (by checking the attribute webkitDisplayingFullscreen). * media/modern-media-controls/placard-support/placard-support-pip-expected.txt: * media/modern-media-controls/placard-support/placard-support-pip.html: * media/presentationmodechanged-fired-once-expected.txt: * media/presentationmodechanged-fired-once.html: * media/video-presentation-mode-expected.txt: * media/video-presentation-mode.html: Canonical link: https://commits.webkit.org/225486@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-02 22:26:02 +00:00
testExpected("video.webkitPresentationMode", "inline");
consoleWrite("<br>** Test Completed");
endTest();
}
</script>
</head>
<body onload="start()">
<video controls playsinline></video>
<p>Test the video presentation mode (video fullscreen and picture-in-picture) API.</p>
</body>
Update WebKitTestRunner to support running multiple video fullscreen and Picture-in-Picture tests simultaneously https://bugs.webkit.org/show_bug.cgi?id=203723 Reviewed by Jer Noble. Source/WebCore: Test: media/video-presentation-mode.html Add a flag MockVideoPresentationModeEnabled to "internals" for video fullscreen and picture-in-picture tests. * page/ChromeClient.h: (WebCore::ChromeClient::setMockVideoPresentationModeEnabled): * testing/Internals.cpp: (WebCore::Internals::setMockVideoPresentationModeEnabled): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: When the flag MockVideoPresentationModeEnabled is true, the VideoFullscreenManagerProxy in the UI process will mock the behavior of the VideoFullscreenInterface[Mac|AVKit]. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: (WebKit::VideoFullscreenManagerProxy::setMockVideoPresentationModeEnabled): * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::requestHideAndExitFullscreen): (WebKit::VideoFullscreenManagerProxy::applicationDidBecomeActive): (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::setHasVideo): (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): (WebKit::VideoFullscreenManagerProxy::setInlineRect): (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didAttachToRunningProcess): (WebKit::WebPageProxy::setMockVideoPresentationModeEnabled): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockVideoPresentationModeEnabled): (WebKit::WebChromeClient::setUpPlaybackControlsManager): (WebKit::WebChromeClient::clearPlaybackControlsManager): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/cocoa/VideoFullscreenManager.h: Source/WebKitLegacy/mac: When the flag MockVideoPresentationModeEnabled is true, WebView will ignore the requests to WebVideoFullscreenController, so that the DumpRenderTree can run multiple video fullscreen and picture-in-picture tests in parallel. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setMockVideoPresentationModeEnabled): * WebView/WebView.mm: * WebView/WebViewData.h: * WebView/WebViewInternal.h: LayoutTests: * media/video-presentation-mode-expected.txt: Added. * media/video-presentation-mode.html: Added. Canonical link: https://commits.webkit.org/224376@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-05 22:37:36 +00:00
</html>