haikuwebkit/LayoutTests/media/video-webkit-playsinline-ex...

29 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

[iPhone] Playing a video on tudou.com plays only sound, no video https://bugs.webkit.org/show_bug.cgi?id=160178 <rdar://problem/27535468> Source/WebCore: Reviewed by Eric Carlson and Dan Bernstein. This patch re-implements r203520 in a much simpler way which doesn't involve a new SPI. The biggest problem with r203520 is that it make it impossible for a WKWebView to match MobileSafari's behavior. Instead of adding this new SPI, a simple version check should be used to keep old apps working. The new behavior is characterized by the following table: | iOS | Non-iOS ============================================================================================= requiresPlayInlineAttribute == true | Old app: honor -webkit-playsinline | honor playsinline | New app: honor playsinline | honor playsinline --------------------------------------------------------------------------------------------- requiresPlayInlineAttribute == false | Always inline | Always inline Specifically, this patch reverts r203545 which is the commit which actually removes the old SPI. As soon as Safari is migrated back to this old SPI, I'll remove the two new SPIs added in r203520. Tests: media/video-playsinline.html media/video-webkit-playsinline.html * html/MediaElementSession.cpp: (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback): * page/Settings.cpp: * page/Settings.in: * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setInlineMediaPlaybackRequiresPlaysInlineAttribute): * testing/InternalSettings.h: * testing/InternalSettings.idl: Source/WebKit/mac: Reviewed by Eric Carlson and Dan Bernstein. * WebView/WebPreferenceKeysPrivate.h: * WebView/WebPreferences.mm: (+[WebPreferences initialize]): (-[WebPreferences inlineMediaPlaybackRequiresPlaysInlineAttribute]): (-[WebPreferences setInlineMediaPlaybackRequiresPlaysInlineAttribute:]): * WebView/WebPreferencesPrivate.h: * WebView/WebView.mm: (-[WebView _preferencesChanged:]): Source/WebKit2: Reviewed by Eric Carlson and Dan Bernstein. * Shared/WebPreferencesDefinitions.h: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetInlineMediaPlaybackRequiresPlaysInlineAttribute): (WKPreferencesGetInlineMediaPlaybackRequiresPlaysInlineAttribute): * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration _inlineMediaPlaybackRequiresPlaysInlineAttribute]): (-[WKWebViewConfiguration _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Tools: Reviewed by Dan Bernstein. * DumpRenderTree/mac/DumpRenderTree.mm: (setDefaultsToConsistentValuesForTesting): * TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm: (RequiresUserActionForPlaybackTest::SetUp): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::initializeWebViewConfiguration): LayoutTests: Reviewed by Eric Carlson and Dan Bernstein. * media/video-playsinline-expected.txt: * media/video-playsinline.html: * media/video-webkit-playsinline-expected.txt: Added. * media/video-webkit-playsinline.html: Added. Canonical link: https://commits.webkit.org/178381@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-26 23:36:52 +00:00
RUN(internals.settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(true))
RUN(video.removeAttribute("webkit-playsinline", ""))
EVENT(canplaythrough)
RUN(video.play())
EVENT(playing)
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
EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
[iPhone] Playing a video on tudou.com plays only sound, no video https://bugs.webkit.org/show_bug.cgi?id=160178 <rdar://problem/27535468> Source/WebCore: Reviewed by Eric Carlson and Dan Bernstein. This patch re-implements r203520 in a much simpler way which doesn't involve a new SPI. The biggest problem with r203520 is that it make it impossible for a WKWebView to match MobileSafari's behavior. Instead of adding this new SPI, a simple version check should be used to keep old apps working. The new behavior is characterized by the following table: | iOS | Non-iOS ============================================================================================= requiresPlayInlineAttribute == true | Old app: honor -webkit-playsinline | honor playsinline | New app: honor playsinline | honor playsinline --------------------------------------------------------------------------------------------- requiresPlayInlineAttribute == false | Always inline | Always inline Specifically, this patch reverts r203545 which is the commit which actually removes the old SPI. As soon as Safari is migrated back to this old SPI, I'll remove the two new SPIs added in r203520. Tests: media/video-playsinline.html media/video-webkit-playsinline.html * html/MediaElementSession.cpp: (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback): * page/Settings.cpp: * page/Settings.in: * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setInlineMediaPlaybackRequiresPlaysInlineAttribute): * testing/InternalSettings.h: * testing/InternalSettings.idl: Source/WebKit/mac: Reviewed by Eric Carlson and Dan Bernstein. * WebView/WebPreferenceKeysPrivate.h: * WebView/WebPreferences.mm: (+[WebPreferences initialize]): (-[WebPreferences inlineMediaPlaybackRequiresPlaysInlineAttribute]): (-[WebPreferences setInlineMediaPlaybackRequiresPlaysInlineAttribute:]): * WebView/WebPreferencesPrivate.h: * WebView/WebView.mm: (-[WebView _preferencesChanged:]): Source/WebKit2: Reviewed by Eric Carlson and Dan Bernstein. * Shared/WebPreferencesDefinitions.h: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetInlineMediaPlaybackRequiresPlaysInlineAttribute): (WKPreferencesGetInlineMediaPlaybackRequiresPlaysInlineAttribute): * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration _inlineMediaPlaybackRequiresPlaysInlineAttribute]): (-[WKWebViewConfiguration _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Tools: Reviewed by Dan Bernstein. * DumpRenderTree/mac/DumpRenderTree.mm: (setDefaultsToConsistentValuesForTesting): * TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm: (RequiresUserActionForPlaybackTest::SetUp): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::initializeWebViewConfiguration): LayoutTests: Reviewed by Eric Carlson and Dan Bernstein. * media/video-playsinline-expected.txt: * media/video-playsinline.html: * media/video-webkit-playsinline-expected.txt: Added. * media/video-webkit-playsinline.html: Added. Canonical link: https://commits.webkit.org/178381@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-26 23:36:52 +00:00
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
RUN(internals.settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(true))
RUN(video.setAttribute("webkit-playsinline", ""))
EVENT(canplaythrough)
RUN(video.play())
EVENT(playing)
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
EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
[iPhone] Playing a video on tudou.com plays only sound, no video https://bugs.webkit.org/show_bug.cgi?id=160178 <rdar://problem/27535468> Source/WebCore: Reviewed by Eric Carlson and Dan Bernstein. This patch re-implements r203520 in a much simpler way which doesn't involve a new SPI. The biggest problem with r203520 is that it make it impossible for a WKWebView to match MobileSafari's behavior. Instead of adding this new SPI, a simple version check should be used to keep old apps working. The new behavior is characterized by the following table: | iOS | Non-iOS ============================================================================================= requiresPlayInlineAttribute == true | Old app: honor -webkit-playsinline | honor playsinline | New app: honor playsinline | honor playsinline --------------------------------------------------------------------------------------------- requiresPlayInlineAttribute == false | Always inline | Always inline Specifically, this patch reverts r203545 which is the commit which actually removes the old SPI. As soon as Safari is migrated back to this old SPI, I'll remove the two new SPIs added in r203520. Tests: media/video-playsinline.html media/video-webkit-playsinline.html * html/MediaElementSession.cpp: (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback): * page/Settings.cpp: * page/Settings.in: * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setInlineMediaPlaybackRequiresPlaysInlineAttribute): * testing/InternalSettings.h: * testing/InternalSettings.idl: Source/WebKit/mac: Reviewed by Eric Carlson and Dan Bernstein. * WebView/WebPreferenceKeysPrivate.h: * WebView/WebPreferences.mm: (+[WebPreferences initialize]): (-[WebPreferences inlineMediaPlaybackRequiresPlaysInlineAttribute]): (-[WebPreferences setInlineMediaPlaybackRequiresPlaysInlineAttribute:]): * WebView/WebPreferencesPrivate.h: * WebView/WebView.mm: (-[WebView _preferencesChanged:]): Source/WebKit2: Reviewed by Eric Carlson and Dan Bernstein. * Shared/WebPreferencesDefinitions.h: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetInlineMediaPlaybackRequiresPlaysInlineAttribute): (WKPreferencesGetInlineMediaPlaybackRequiresPlaysInlineAttribute): * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration _inlineMediaPlaybackRequiresPlaysInlineAttribute]): (-[WKWebViewConfiguration _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Tools: Reviewed by Dan Bernstein. * DumpRenderTree/mac/DumpRenderTree.mm: (setDefaultsToConsistentValuesForTesting): * TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm: (RequiresUserActionForPlaybackTest::SetUp): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::initializeWebViewConfiguration): LayoutTests: Reviewed by Eric Carlson and Dan Bernstein. * media/video-playsinline-expected.txt: * media/video-playsinline.html: * media/video-webkit-playsinline-expected.txt: Added. * media/video-webkit-playsinline.html: Added. Canonical link: https://commits.webkit.org/178381@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-26 23:36:52 +00:00
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
RUN(internals.settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(false))
RUN(video.removeAttribute("webkit-playsinline", ""))
EVENT(canplaythrough)
RUN(video.play())
EVENT(playing)
EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
RUN(internals.settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(false))
RUN(video.setAttribute("webkit-playsinline", ""))
EVENT(canplaythrough)
RUN(video.play())
EVENT(playing)
EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
END OF TEST