WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Fix an API test failure
bug-202425-20200602135643.patch (text/plain), 33.94 KB, created by
Peng Liu
on 2020-06-02 13:56:44 PDT
(
hide
)
Description:
Fix an API test failure
Filename:
MIME Type:
Creator:
Peng Liu
Created:
2020-06-02 13:56:44 PDT
Size:
33.94 KB
patch
obsolete
>Subversion Revision: 262334 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7d19e153bd1605d97350867ef5d9eed0ca4f00e0..7fb005ad2cfec84ede5e4dfdd3d8c472e4e7be98 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,42 @@ >+2020-06-02 Peng Liu <peng.liu6@apple.com> >+ >+ Stressing webkitSetPresentationMode leads to wrong inline video dimensions >+ https://bugs.webkit.org/show_bug.cgi?id=202425 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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. >+ > 2020-05-29 Andy Estes <aestes@apple.com> > > [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4) >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index ed7a0d4c3812fc9b9b8d067f6b34a50c1f09201b..39d8fe3411e3f557c06a9af013821f8297dee0f4 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,14 @@ >+2020-06-02 Peng Liu <peng.liu6@apple.com> >+ >+ Stressing webkitSetPresentationMode leads to wrong inline video dimensions >+ https://bugs.webkit.org/show_bug.cgi?id=202425 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/cocoa/VideoFullscreenManager.mm: >+ (WebKit::VideoFullscreenManager::didEnterFullscreen): >+ (WebKit::VideoFullscreenManager::didCleanupFullscreen): >+ > 2020-05-29 Peng Liu <peng.liu6@apple.com> > > Replace callOnMainThread() with callOnMainRunLoop() in AudioSessionRoutingArbitratorProxyCocoa.mm >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 5c2094a95c834ed33e49b557eb002d30cdda18f1..a09b80462b56a2273c410ea1395ca2afe7dca3e7 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,27 @@ >+2020-06-02 Peng Liu <peng.liu6@apple.com> >+ >+ Stressing webkitSetPresentationMode leads to wrong inline video dimensions >+ https://bugs.webkit.org/show_bug.cgi?id=202425 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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: >+ > 2020-05-29 Andy Estes <aestes@apple.com> > > [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4) >diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h >index 67902041f3717db7efb6dc090f91b8fc841502fe..7ddb7970a739089796ca87fc220cd87205849500 100644 >--- a/Source/WebCore/dom/Element.h >+++ b/Source/WebCore/dom/Element.h >@@ -423,6 +423,7 @@ public: > virtual void ancestorWillEnterFullscreen() { } > virtual void didBecomeFullscreenElement() { } > virtual void willStopBeingFullscreenElement() { } >+ virtual void didStopBeingFullscreenElement() { } > > bool isFinishedParsingChildren() const { return isParsingChildrenFinished(); } > void finishParsingChildren() override; >diff --git a/Source/WebCore/dom/FullscreenManager.cpp b/Source/WebCore/dom/FullscreenManager.cpp >index f90a53fc1dbfb335b8a2eb5aacfe79119a61b51b..0ac74215b7f4751a19f43fc865c7f7dc90321ab2 100644 >--- a/Source/WebCore/dom/FullscreenManager.cpp >+++ b/Source/WebCore/dom/FullscreenManager.cpp >@@ -421,6 +421,7 @@ void FullscreenManager::didExitFullscreen() > if (!hasLivingRenderTree() || backForwardCacheState() != Document::NotInBackForwardCache) > return; > fullscreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); >+ m_fullscreenElement->didStopBeingFullscreenElement(); > > m_areKeysEnabledInFullscreen = false; > >diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp >index 11e3f230e0223cbdb511b523bdf37fc129ac64cf..bb7537db4cfd2a12a1f3809977d45ab8ffca89db 100644 >--- a/Source/WebCore/html/HTMLMediaElement.cpp >+++ b/Source/WebCore/html/HTMLMediaElement.cpp >@@ -5992,6 +5992,9 @@ void HTMLMediaElement::enterFullscreen(VideoFullscreenMode mode) > if (m_videoFullscreenMode == mode) > return; > >+ if (m_waitingToEnterFullscreen) >+ return; >+ > #if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_USES_ELEMENT_FULLSCREEN) > if (document().settings().fullScreenEnabled() && mode == VideoFullscreenModeStandard) { > m_temporarilyAllowingInlinePlaybackAfterFullscreen = false; >diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h >index d39db91ec1c8d0d0bac589f06d5fcfeafabf5914..2b68de88fc80cbf41e82cfb59f42c09682976536 100644 >--- a/Source/WebCore/html/HTMLMediaElement.h >+++ b/Source/WebCore/html/HTMLMediaElement.h >@@ -561,7 +561,7 @@ public: > > bool isSuspended() const final; > >- WEBCORE_EXPORT void didBecomeFullscreenElement() final; >+ WEBCORE_EXPORT void didBecomeFullscreenElement() override; > WEBCORE_EXPORT void willExitFullscreen(); > > #if ENABLE(PICTURE_IN_PICTURE_API) >diff --git a/Source/WebCore/html/HTMLVideoElement.cpp b/Source/WebCore/html/HTMLVideoElement.cpp >index bcced6f2b3ee83bd1096e286aee0868ee22a226e..b894c5ff52aaf60ff6715ab3850b3ac5f54f4eaf 100644 >--- a/Source/WebCore/html/HTMLVideoElement.cpp >+++ b/Source/WebCore/html/HTMLVideoElement.cpp >@@ -348,7 +348,9 @@ bool HTMLVideoElement::webkitSupportsFullscreen() > > bool HTMLVideoElement::webkitDisplayingFullscreen() > { >- return isFullscreen() && !waitingToEnterFullscreen(); >+ // This function starts to return true after the video element has entered >+ // fullscreen/picture-in-picture until it has exited fullscreen/picture-in-picture >+ return (isFullscreen() && !waitingToEnterFullscreen()) || (!isFullscreen() && m_isChangingPresentationMode); > } > > void HTMLVideoElement::ancestorWillEnterFullscreen() >@@ -467,10 +469,15 @@ void HTMLVideoElement::setFullscreenMode(HTMLMediaElementEnums::VideoFullscreenM > { > INFO_LOG(LOGIDENTIFIER, ", mode = ", mode); > >+ if (m_isChangingPresentationMode) >+ return; >+ > if (mode == VideoFullscreenModeNone) { > if (isFullscreen()) { > if (toPresentationMode(fullscreenMode()) == VideoPresentationMode::PictureInPicture) > m_isEnteringOrExitingPictureInPicture = true; >+ >+ m_isChangingPresentationMode = true; > exitFullscreen(); > } > >@@ -483,7 +490,10 @@ void HTMLVideoElement::setFullscreenMode(HTMLMediaElementEnums::VideoFullscreenM > if (mode == VideoFullscreenModePictureInPicture) > m_isEnteringOrExitingPictureInPicture = true; > >- enterFullscreen(mode); >+ if (mode != fullscreenMode()) { >+ m_isChangingPresentationMode = true; >+ enterFullscreen(mode); >+ } > } > > auto HTMLVideoElement::webkitPresentationMode() const -> VideoPresentationMode >@@ -504,14 +514,18 @@ void HTMLVideoElement::fullscreenModeChanged(VideoFullscreenMode mode) > HTMLMediaElement::fullscreenModeChanged(mode); > } > >-void HTMLVideoElement::didEnterFullscreen() >+void HTMLVideoElement::didBecomeFullscreenElement() > { >+ m_isChangingPresentationMode = false; > if (m_isEnteringOrExitingPictureInPicture) > m_isWaitingForPictureInPictureWindowFrame = true; >+ >+ HTMLMediaElement::didBecomeFullscreenElement(); > } > >-void HTMLVideoElement::didExitFullscreen() >+void HTMLVideoElement::didStopBeingFullscreenElement() > { >+ m_isChangingPresentationMode = false; > if (m_isEnteringOrExitingPictureInPicture) { > m_isEnteringOrExitingPictureInPicture = false; > #if ENABLE(PICTURE_IN_PICTURE_API) >diff --git a/Source/WebCore/html/HTMLVideoElement.h b/Source/WebCore/html/HTMLVideoElement.h >index a524ff49696aa35cc64e8c3763d328b72db7db3f..01fba60efdff1d2093e64967b20628007408fe5b 100644 >--- a/Source/WebCore/html/HTMLVideoElement.h >+++ b/Source/WebCore/html/HTMLVideoElement.h >@@ -89,8 +89,8 @@ public: > void setFullscreenMode(VideoFullscreenMode); > void fullscreenModeChanged(VideoFullscreenMode) final; > >- WEBCORE_EXPORT void didEnterFullscreen(); >- WEBCORE_EXPORT void didExitFullscreen(); >+ WEBCORE_EXPORT void didBecomeFullscreenElement() final; >+ WEBCORE_EXPORT void didStopBeingFullscreenElement() final; > void setVideoFullscreenFrame(FloatRect) final; > > #if ENABLE(PICTURE_IN_PICTURE_API) >@@ -134,6 +134,7 @@ private: > unsigned m_lastReportedVideoWidth { 0 }; > unsigned m_lastReportedVideoHeight { 0 }; > >+ bool m_isChangingPresentationMode { false }; > bool m_isEnteringOrExitingPictureInPicture { false }; > bool m_isWaitingForPictureInPictureWindowFrame { false }; > #if ENABLE(PICTURE_IN_PICTURE_API) >diff --git a/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm b/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm >index 23d15aded0dd09b0f4070ad9926f6d2372ab373a..fdb4b704f18fda0a8f7671e19aa0e2abaa4949c1 100644 >--- a/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm >+++ b/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm >@@ -441,8 +441,6 @@ void VideoFullscreenManager::didEnterFullscreen(uint64_t contextId) > if (!videoElement) > return; > >- videoElement->didEnterFullscreen(); >- > dispatch_async(dispatch_get_main_queue(), [protectedThis = makeRefPtr(this), videoElement] { > videoElement->didBecomeFullscreenElement(); > }); >@@ -508,7 +506,7 @@ void VideoFullscreenManager::didCleanupFullscreen(uint64_t contextId) > model->setVideoFullscreenLayer(nil); > RefPtr<HTMLVideoElement> videoElement = model->videoElement(); > if (videoElement) >- videoElement->didExitFullscreen(); >+ videoElement->didStopBeingFullscreenElement(); > > interface->setFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone); > interface->setFullscreenStandby(false); >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h >index 3ac230d8a26d701634657f2b8bc29914b0a1c0b9..8905c48d41c5c368dc4dd160b8c862ce8deb41cf 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h >@@ -236,5 +236,6 @@ private: > > String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL&) const final; > >+ bool m_mockVideoPresentationModeEnabled { false }; > WebView *m_webView; > }; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm >index 894816376bf87e32137885e00609c23c96c4f509..35e839fe6fa8ff44ec3c4c7cf5e2362652652e06 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm >@@ -72,6 +72,7 @@ > #import <WebCore/HTMLInputElement.h> > #import <WebCore/HTMLNames.h> > #import <WebCore/HTMLPlugInImageElement.h> >+#import <WebCore/HTMLVideoElement.h> > #import <WebCore/HitTestResult.h> > #import <WebCore/Icon.h> > #import <WebCore/IntPoint.h> >@@ -969,7 +970,7 @@ bool WebChromeClient::supportsVideoFullscreen(HTMLMediaElementEnums::VideoFullsc > > void WebChromeClient::setMockVideoPresentationModeEnabled(bool enabled) > { >- [m_webView _setMockVideoPresentationModeEnabled:enabled]; >+ m_mockVideoPresentationModeEnabled = enabled; > } > > void WebChromeClient::enterVideoFullscreenForVideoElement(HTMLVideoElement& videoElement, HTMLMediaElementEnums::VideoFullscreenMode mode, bool standby) >@@ -977,21 +978,30 @@ void WebChromeClient::enterVideoFullscreenForVideoElement(HTMLVideoElement& vide > ASSERT_UNUSED(standby, !standby); > ASSERT(mode != HTMLMediaElementEnums::VideoFullscreenModeNone); > BEGIN_BLOCK_OBJC_EXCEPTIONS; >- [m_webView _enterVideoFullscreenForVideoElement:&videoElement mode:mode]; >+ if (m_mockVideoPresentationModeEnabled) >+ videoElement.didBecomeFullscreenElement(); >+ else >+ [m_webView _enterVideoFullscreenForVideoElement:&videoElement mode:mode]; > END_BLOCK_OBJC_EXCEPTIONS; > } > >-void WebChromeClient::exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) >+void WebChromeClient::exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement& videoElement) > { > BEGIN_BLOCK_OBJC_EXCEPTIONS; >- [m_webView _exitVideoFullscreen]; >+ if (m_mockVideoPresentationModeEnabled) >+ videoElement.didStopBeingFullscreenElement(); >+ else >+ [m_webView _exitVideoFullscreen]; > END_BLOCK_OBJC_EXCEPTIONS; > } > > void WebChromeClient::exitVideoFullscreenToModeWithoutAnimation(HTMLVideoElement& videoElement, HTMLMediaElementEnums::VideoFullscreenMode targetMode) > { > BEGIN_BLOCK_OBJC_EXCEPTIONS; >- [m_webView _exitVideoFullscreen]; >+ if (m_mockVideoPresentationModeEnabled) >+ videoElement.didStopBeingFullscreenElement(); >+ else >+ [m_webView _exitVideoFullscreen]; > END_BLOCK_OBJC_EXCEPTIONS; > } > >diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm >index 87c7782012cbbedb194973c8702197d70c44f6e3..0ade678549fcc4f342b4004e9263109ef0ceaa6c 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -9274,18 +9274,8 @@ - (void)_scheduleRenderingUpdateForPendingTileCacheRepaint > > #if ENABLE(VIDEO_PRESENTATION_MODE) > >-- (void)_setMockVideoPresentationModeEnabled:(BOOL)enabled >-{ >- _private->mockVideoPresentationModeEnabled = enabled; >-} >- > - (void)_enterVideoFullscreenForVideoElement:(NakedPtr<WebCore::HTMLVideoElement>)videoElement mode:(WebCore::HTMLMediaElementEnums::VideoFullscreenMode)mode > { >- if (_private->mockVideoPresentationModeEnabled) { >- videoElement->didBecomeFullscreenElement(); >- return; >- } >- > if (_private->fullscreenController) { > if ([_private->fullscreenController videoElement] == videoElement) { > // The backend may just warn us that the underlaying plaftormMovie() >@@ -9314,9 +9304,6 @@ - (void)_enterVideoFullscreenForVideoElement:(NakedPtr<WebCore::HTMLVideoElement > > - (void)_exitVideoFullscreen > { >- if (_private->mockVideoPresentationModeEnabled) >- return; >- > if (!_private->fullscreenController && _private->fullscreenControllersExiting.isEmpty()) > return; > >diff --git a/Source/WebKitLegacy/mac/WebView/WebViewData.h b/Source/WebKitLegacy/mac/WebView/WebViewData.h >index ae8add4024913cc6e335272c40767b7ad10bbdcc..84f0df08fef34f0df162668704f7c180a674d5e6 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebViewData.h >+++ b/Source/WebKitLegacy/mac/WebView/WebViewData.h >@@ -323,10 +323,6 @@ private: > Vector<RetainPtr<WebVideoFullscreenController>> fullscreenControllersExiting; > #endif > >-#if ENABLE(VIDEO_PRESENTATION_MODE) >- BOOL mockVideoPresentationModeEnabled; >-#endif >- > #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE) > RefPtr<WebCore::PlaybackSessionModelMediaElement> playbackSessionModel; > RefPtr<WebCore::PlaybackSessionInterfaceMac> playbackSessionInterface; >diff --git a/Source/WebKitLegacy/mac/WebView/WebViewInternal.h b/Source/WebKitLegacy/mac/WebView/WebViewInternal.h >index 576629aba69a6ca0bf56a5b9e69a3319127382c8..7d70c04a0ce134cfe87d56fd811f4dc5fbcb3889 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebViewInternal.h >+++ b/Source/WebKitLegacy/mac/WebView/WebViewInternal.h >@@ -270,7 +270,6 @@ WebLayoutMilestones kitLayoutMilestones(OptionSet<WebCore::LayoutMilestone>); > > #if ENABLE(VIDEO) && defined(__cplusplus) > #if ENABLE(VIDEO_PRESENTATION_MODE) >-- (void)_setMockVideoPresentationModeEnabled:(BOOL)enabled; > - (void)_enterVideoFullscreenForVideoElement:(NakedPtr<WebCore::HTMLVideoElement>)videoElement mode:(WebCore::HTMLMediaElementEnums::VideoFullscreenMode)mode; > - (void)_exitVideoFullscreen; > #if PLATFORM(MAC) >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 686ebd849e86b77a040774144cbc2330dabf35cf..2f5543523dd4c6e5c920ce9cdcb0f4cbf16a17ce 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,13 @@ >+2020-06-02 Peng Liu <peng.liu6@apple.com> >+ >+ Stressing webkitSetPresentationMode leads to wrong inline video dimensions >+ https://bugs.webkit.org/show_bug.cgi?id=202425 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: >+ (TEST): >+ > 2020-05-29 Andy Estes <aestes@apple.com> > > [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4) >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm >index 227b5de9ab10128685df5b1b4971187db3f62a57..2e63bc27a221ebebcb958393b3ca3c75a26532a4 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm >@@ -38,16 +38,20 @@ TEST(WKWebViewCloseAllMediaPresentations, PictureInPicture) > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]); > > [webView synchronouslyLoadHTMLString:@"<video src=video-with-audio.mp4 webkit-playsinline></video>"]; >- [webView objectByEvaluatingJavaScript:@"document.querySelector('video').addEventListener('webkitpresentationmodechanged', event => { window.webkit.messageHandlers.testHandler.postMessage('presentationmodechanged'); });"]; >- >- __block bool presentationModeChanged = false; >- [webView performAfterReceivingMessage:@"presentationmodechanged" action:^{ presentationModeChanged = true; }]; > > [webView objectByEvaluatingJavaScriptWithUserGesture:@"document.querySelector('video').webkitSetPresentationMode('picture-in-picture')"]; > >- TestWebKitAPI::Util::run(&presentationModeChanged); >+ do { >+ id result = [webView objectByEvaluatingJavaScript:@"document.querySelector('video').webkitDisplayingFullscreen"]; >+ if ([result boolValue]) >+ break; > >- presentationModeChanged = false; >+ TestWebKitAPI::Util::sleep(0.5); >+ } while (true); >+ >+ [webView objectByEvaluatingJavaScript:@"document.querySelector('video').addEventListener('webkitpresentationmodechanged', event => { window.webkit.messageHandlers.testHandler.postMessage('presentationmodechanged'); });"]; >+ >+ __block bool presentationModeChanged = false; > [webView performAfterReceivingMessage:@"presentationmodechanged" action:^{ presentationModeChanged = true; }]; > > [webView _closeAllMediaPresentations]; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 2bf6e2a511c4cb3bdaa2345e0ef5b431656cd168..bd947d0d6e77b95e5deabb4b673bac1ae15574fd 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,21 @@ >+2020-06-02 Peng Liu <peng.liu6@apple.com> >+ >+ Stressing webkitSetPresentationMode leads to wrong inline video dimensions >+ https://bugs.webkit.org/show_bug.cgi?id=202425 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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: >+ > 2020-05-29 Oriol Brufau <obrufau@igalia.com> > > [css-grid] Update WPT grid-items-sizing-alignment-001.html >diff --git a/LayoutTests/media/modern-media-controls/placard-support/placard-support-pip-expected.txt b/LayoutTests/media/modern-media-controls/placard-support/placard-support-pip-expected.txt >index 4f5fd917edf1eab46e5a9195fb3220ee2843ef7f..71e314011a9f636dbec08f214965f4cfa0adc1ab 100644 >--- a/LayoutTests/media/modern-media-controls/placard-support/placard-support-pip-expected.txt >+++ b/LayoutTests/media/modern-media-controls/placard-support/placard-support-pip-expected.txt >@@ -3,8 +3,10 @@ Testing the PlacardSupport behavior when entering picture-in-picture. > On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". > > >+PASS media.webkitDisplayingFullscreen became true > PASS mediaController.controls.placard is mediaController.controls.pipPlacard > PASS mediaController.controls.children.includes(mediaController.controls.pipPlacard) is true >+PASS media.webkitDisplayingFullscreen became false > PASS mediaController.controls.placard is null > PASS mediaController.controls.children.includes(mediaController.controls.pipPlacard) is false > PASS successfullyParsed is true >diff --git a/LayoutTests/media/modern-media-controls/placard-support/placard-support-pip.html b/LayoutTests/media/modern-media-controls/placard-support/placard-support-pip.html >index 1aafa087ad93c0e5dc3bec319bae9958de2604ee..3226fc86264f99e6d895211fe3ca7f72dae579cf 100644 >--- a/LayoutTests/media/modern-media-controls/placard-support/placard-support-pip.html >+++ b/LayoutTests/media/modern-media-controls/placard-support/placard-support-pip.html >@@ -25,8 +25,10 @@ window.jsTestIsAsync = true; > > description("Testing the <code>PlacardSupport</code> behavior when entering picture-in-picture."); > >-if (window.internals) >+if (window.internals) { > window.internals.settings.setAllowsPictureInPictureMediaPlayback(true); >+ window.internals.setMockVideoPresentationModeEnabled(true); >+} > > const container = document.querySelector("div#host"); > const media = document.querySelector("video"); >@@ -36,19 +38,22 @@ const button = document.body.appendChild(document.createElement("div")); > button.innerText = "Enter picture-in-picture"; > > button.addEventListener("click", togglePiP); >- > media.addEventListener("webkitpresentationmodechanged", () => { > if (media.webkitPresentationMode == "picture-in-picture") { >- shouldBe("mediaController.controls.placard", "mediaController.controls.pipPlacard"); >- shouldBeTrue("mediaController.controls.children.includes(mediaController.controls.pipPlacard)"); >- togglePiP(); >+ shouldBecomeEqual("media.webkitDisplayingFullscreen", "true", () => { >+ shouldBe("mediaController.controls.placard", "mediaController.controls.pipPlacard"); >+ shouldBeTrue("mediaController.controls.children.includes(mediaController.controls.pipPlacard)"); >+ togglePiP(); >+ }); > } else { >- shouldBeNull("mediaController.controls.placard"); >- shouldBeFalse("mediaController.controls.children.includes(mediaController.controls.pipPlacard)"); >- container.remove(); >- media.remove(); >- button.remove(); >- finishJSTest(); >+ shouldBecomeEqual("media.webkitDisplayingFullscreen", "false", () => { >+ shouldBeNull("mediaController.controls.placard"); >+ shouldBeFalse("mediaController.controls.children.includes(mediaController.controls.pipPlacard)"); >+ container.remove(); >+ media.remove(); >+ button.remove(); >+ finishJSTest(); >+ }); > } > }); > >diff --git a/LayoutTests/media/presentationmodechanged-fired-once-expected.txt b/LayoutTests/media/presentationmodechanged-fired-once-expected.txt >index ac3b6360565cfa1f3605fb0140c7c31f8c489ad2..a18e8bb86ee37c239b87692d1801a85d2b0e2d9c 100644 >--- a/LayoutTests/media/presentationmodechanged-fired-once-expected.txt >+++ b/LayoutTests/media/presentationmodechanged-fired-once-expected.txt >@@ -1,11 +1,11 @@ > This tests that the "webkitpresentationmodechanged" event is fired only once when the browser switches back to inline from the picture-in-picture mode. > >-RUN(internals.settings.setAllowsPictureInPictureMediaPlayback(true)) > RUN(video.src = findMediaFile("video", "content/test")) > EVENT(canplaythrough) > RUN(video.play()) > RUN(video.webkitSetPresentationMode("picture-in-picture")) > EVENT(webkitpresentationmodechanged) >+EXPECTED (video.webkitDisplayingFullscreen == 'true') OK > EXPECTED (video.webkitPresentationMode == 'picture-in-picture') OK > RUN(video.webkitSetPresentationMode("inline")) > EVENT(webkitpresentationmodechanged) >diff --git a/LayoutTests/media/presentationmodechanged-fired-once.html b/LayoutTests/media/presentationmodechanged-fired-once.html >index de83dea5c4ac9ef2b54667c37843b96a48e99c36..538bd127bc91a9990a507c924f3cbb5431aa47d4 100644 >--- a/LayoutTests/media/presentationmodechanged-fired-once.html >+++ b/LayoutTests/media/presentationmodechanged-fired-once.html >@@ -8,8 +8,12 @@ > > function go() > { >+ if (window.internals) { >+ internals.settings.setAllowsPictureInPictureMediaPlayback(true); >+ internals.setMockVideoPresentationModeEnabled(true); >+ } >+ > findMediaElement(); >- run('internals.settings.setAllowsPictureInPictureMediaPlayback(true)'); > run('video.src = findMediaFile("video", "content/test")'); > waitForEventOnce('canplaythrough', canPlayThrough); > } >@@ -21,8 +25,9 @@ > waitForEventOnce("webkitpresentationmodechanged", presentationModeChanged1); > } > >- function presentationModeChanged1() >+ async function presentationModeChanged1() > { >+ await testExpectedEventually('video.webkitDisplayingFullscreen', true); > testExpected("video.webkitPresentationMode", "picture-in-picture"); > runWithKeyDown('video.webkitSetPresentationMode("inline")'); > waitForEvent("webkitpresentationmodechanged", presentationModeChanged2); >diff --git a/LayoutTests/media/video-presentation-mode-expected.txt b/LayoutTests/media/video-presentation-mode-expected.txt >index e01c437ca5dca01d75a89d1257ccadf37d974592..1d7db0282499d39309afa20d9ec75d1c8a251359 100644 >--- a/LayoutTests/media/video-presentation-mode-expected.txt >+++ b/LayoutTests/media/video-presentation-mode-expected.txt >@@ -9,6 +9,7 @@ EXPECTED (video.webkitDisplayingFullscreen == 'false') OK > ** Try to enter fullscreen > RUN(video.webkitSetPresentationMode('fullscreen')) > EVENT(webkitpresentationmodechanged) >+EXPECTED (video.webkitDisplayingFullscreen == 'true') OK > > ** Entered fullscreen > EXPECTED (video.webkitPresentationMode == 'fullscreen') OK >@@ -16,6 +17,7 @@ EXPECTED (video.webkitPresentationMode == 'fullscreen') OK > ** Try to enter picture-in-picture > RUN(video.webkitSetPresentationMode('picture-in-picture')) > EVENT(webkitpresentationmodechanged) >+EXPECTED (video.webkitDisplayingFullscreen == 'true') OK > > ** Entered picture-in-picture > EXPECTED (video.webkitPresentationMode == 'picture-in-picture') OK >@@ -23,6 +25,7 @@ EXPECTED (video.webkitPresentationMode == 'picture-in-picture') OK > ** Try to return to inline > RUN(video.webkitSetPresentationMode('inline')) > EVENT(webkitpresentationmodechanged) >+EXPECTED (video.webkitDisplayingFullscreen == 'false') OK > > ** Returned to inline > EXPECTED (video.webkitPresentationMode == 'inline') OK >diff --git a/LayoutTests/media/video-presentation-mode.html b/LayoutTests/media/video-presentation-mode.html >index bce808ddd7434ccf5f9a38034b1ca3f5592c5250..3056d15e1a9c2d1cafcb1e0e28cfa4b7b97764d8 100644 >--- a/LayoutTests/media/video-presentation-mode.html >+++ b/LayoutTests/media/video-presentation-mode.html >@@ -1,63 +1,66 @@ > <!doctype html> > <html> > <head> >- <script src=media-file.js></script> >- <script src=video-test.js></script> >- <script> >+ <script src=media-file.js></script> >+ <script src=video-test.js></script> >+ <script> > function start() > { >- if (window.internals) { >- window.internals.settings.setAllowsPictureInPictureMediaPlayback(true); >- window.internals.setMockVideoPresentationModeEnabled(true); >+ if (window.internals) { >+ internals.settings.setAllowsPictureInPictureMediaPlayback(true); >+ internals.setMockVideoPresentationModeEnabled(true); > } >- >- video = document.getElementsByTagName('video')[0]; >- waitForEventOnce("canplaythrough", canplaythrough); >- video.src = findMediaFile("video", "content/test"); > >- consoleWrite(""); >+ video = document.getElementsByTagName('video')[0]; >+ waitForEventOnce("canplaythrough", canplaythrough); >+ video.src = findMediaFile("video", "content/test"); >+ >+ consoleWrite(""); >+ } >+ >+ async function canplaythrough() >+ { >+ testExpected("video.webkitSupportsFullscreen", true); >+ await testExpectedEventually('video.webkitDisplayingFullscreen', false); >+ >+ consoleWrite("<br>** Try to enter fullscreen"); >+ runWithKeyDown("video.webkitSetPresentationMode('fullscreen')"); >+ waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged1); >+ } >+ >+ async function presentationModeChanged1() >+ { >+ await testExpectedEventually('video.webkitDisplayingFullscreen', true); >+ consoleWrite("<br>** Entered fullscreen"); >+ testExpected("video.webkitPresentationMode", "fullscreen"); >+ consoleWrite("<br>** Try to enter picture-in-picture"); >+ waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged2); >+ runWithKeyDown("video.webkitSetPresentationMode('picture-in-picture')"); > } >- >- function canplaythrough() >- { >- testExpected("video.webkitSupportsFullscreen", true); >- testExpected("video.webkitDisplayingFullscreen", false); >- >- consoleWrite("<br>** Try to enter fullscreen"); >- runWithKeyDown("video.webkitSetPresentationMode('fullscreen')"); >- waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged1); >- } >- >- function presentationModeChanged1() >- { >- consoleWrite("<br>** Entered fullscreen"); >- testExpected("video.webkitPresentationMode", "fullscreen"); >- consoleWrite("<br>** Try to enter picture-in-picture"); >- waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged2); >- runWithKeyDown("video.webkitSetPresentationMode('picture-in-picture')"); >- } >- >- function presentationModeChanged2() >- { >- consoleWrite("<br>** Entered picture-in-picture"); >- testExpected("video.webkitPresentationMode", "picture-in-picture"); >- consoleWrite("<br>** Try to return to inline"); >- waitForEventOnce('webkitpresentationmodechanged', testCompleted); >- runWithKeyDown("video.webkitSetPresentationMode('inline')"); >- } >- >- function testCompleted() >- { >- consoleWrite("<br>** Returned to inline"); >- 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> >+ >+ async function presentationModeChanged2() >+ { >+ await testExpectedEventually('video.webkitDisplayingFullscreen', true); >+ consoleWrite("<br>** Entered picture-in-picture"); >+ testExpected("video.webkitPresentationMode", "picture-in-picture"); >+ consoleWrite("<br>** Try to return to inline"); >+ waitForEventOnce('webkitpresentationmodechanged', testCompleted); >+ runWithKeyDown("video.webkitSetPresentationMode('inline')"); >+ } >+ >+ async function testCompleted() >+ { >+ await testExpectedEventually('video.webkitDisplayingFullscreen', false); >+ consoleWrite("<br>** Returned to inline"); >+ 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> > </html> >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 202425
:
379929
|
379930
|
400739
|
400781
|
400786
| 400853