Changeset 262456 in webkit
- Timestamp:
- Jun 2, 2020, 3:26:02 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/media/modern-media-controls/placard-support/placard-support-pip-expected.txt (modified) (1 diff)
-
LayoutTests/media/modern-media-controls/placard-support/placard-support-pip.html (modified) (2 diffs)
-
LayoutTests/media/presentationmodechanged-fired-once-expected.txt (modified) (2 diffs)
-
LayoutTests/media/presentationmodechanged-fired-once.html (modified) (2 diffs)
-
LayoutTests/media/video-presentation-mode-expected.txt (modified) (3 diffs)
-
LayoutTests/media/video-presentation-mode.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Element.h (modified) (1 diff)
-
Source/WebCore/dom/FullscreenManager.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLMediaElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLMediaElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLVideoElement.cpp (modified) (4 diffs)
-
Source/WebCore/html/HTMLVideoElement.h (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm (modified) (2 diffs)
-
Source/WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (modified) (1 diff)
-
Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (modified) (4 diffs)
-
Source/WebKitLegacy/mac/WebView/WebView.mm (modified) (2 diffs)
-
Source/WebKitLegacy/mac/WebView/WebViewData.h (modified) (1 diff)
-
Source/WebKitLegacy/mac/WebView/WebViewInternal.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r262438 r262456 1 2020-06-02 Peng Liu <peng.liu6@apple.com> 2 3 Stressing webkitSetPresentationMode leads to wrong inline video dimensions 4 https://bugs.webkit.org/show_bug.cgi?id=202425 5 6 Reviewed by Eric Carlson. 7 8 Enable the mock video presentation mode in WebKitTestRunner and 9 only request a video element to enter/exit fullscreen/picture-in-picture when 10 the element is ready to do so (by checking the attribute webkitDisplayingFullscreen). 11 12 * media/modern-media-controls/placard-support/placard-support-pip-expected.txt: 13 * media/modern-media-controls/placard-support/placard-support-pip.html: 14 * media/presentationmodechanged-fired-once-expected.txt: 15 * media/presentationmodechanged-fired-once.html: 16 * media/video-presentation-mode-expected.txt: 17 * media/video-presentation-mode.html: 18 1 19 2020-06-02 Simon Fraser <simon.fraser@apple.com> 2 20 -
trunk/LayoutTests/media/modern-media-controls/placard-support/placard-support-pip-expected.txt
r218241 r262456 4 4 5 5 6 PASS media.webkitDisplayingFullscreen became true 6 7 PASS mediaController.controls.placard is mediaController.controls.pipPlacard 7 8 PASS mediaController.controls.children.includes(mediaController.controls.pipPlacard) is true 9 PASS media.webkitDisplayingFullscreen became false 8 10 PASS mediaController.controls.placard is null 9 11 PASS mediaController.controls.children.includes(mediaController.controls.pipPlacard) is false -
trunk/LayoutTests/media/modern-media-controls/placard-support/placard-support-pip.html
r218725 r262456 26 26 description("Testing the <code>PlacardSupport</code> behavior when entering picture-in-picture."); 27 27 28 if (window.internals) 28 if (window.internals) { 29 29 window.internals.settings.setAllowsPictureInPictureMediaPlayback(true); 30 window.internals.setMockVideoPresentationModeEnabled(true); 31 } 30 32 31 33 const container = document.querySelector("div#host"); … … 37 39 38 40 button.addEventListener("click", togglePiP); 39 40 41 media.addEventListener("webkitpresentationmodechanged", () => { 41 42 if (media.webkitPresentationMode == "picture-in-picture") { 42 shouldBe("mediaController.controls.placard", "mediaController.controls.pipPlacard"); 43 shouldBeTrue("mediaController.controls.children.includes(mediaController.controls.pipPlacard)"); 44 togglePiP(); 43 shouldBecomeEqual("media.webkitDisplayingFullscreen", "true", () => { 44 shouldBe("mediaController.controls.placard", "mediaController.controls.pipPlacard"); 45 shouldBeTrue("mediaController.controls.children.includes(mediaController.controls.pipPlacard)"); 46 togglePiP(); 47 }); 45 48 } else { 46 shouldBeNull("mediaController.controls.placard"); 47 shouldBeFalse("mediaController.controls.children.includes(mediaController.controls.pipPlacard)"); 48 container.remove(); 49 media.remove(); 50 button.remove(); 51 finishJSTest(); 49 shouldBecomeEqual("media.webkitDisplayingFullscreen", "false", () => { 50 shouldBeNull("mediaController.controls.placard"); 51 shouldBeFalse("mediaController.controls.children.includes(mediaController.controls.pipPlacard)"); 52 container.remove(); 53 media.remove(); 54 button.remove(); 55 finishJSTest(); 56 }); 52 57 } 53 58 }); -
trunk/LayoutTests/media/presentationmodechanged-fired-once-expected.txt
r249141 r262456 1 1 This tests that the "webkitpresentationmodechanged" event is fired only once when the browser switches back to inline from the picture-in-picture mode. 2 2 3 RUN(internals.settings.setAllowsPictureInPictureMediaPlayback(true))4 3 RUN(video.src = findMediaFile("video", "content/test")) 5 4 EVENT(canplaythrough) … … 7 6 RUN(video.webkitSetPresentationMode("picture-in-picture")) 8 7 EVENT(webkitpresentationmodechanged) 8 EXPECTED (video.webkitDisplayingFullscreen == 'true') OK 9 9 EXPECTED (video.webkitPresentationMode == 'picture-in-picture') OK 10 10 RUN(video.webkitSetPresentationMode("inline")) -
trunk/LayoutTests/media/presentationmodechanged-fired-once.html
r249141 r262456 9 9 function go() 10 10 { 11 if (window.internals) { 12 internals.settings.setAllowsPictureInPictureMediaPlayback(true); 13 internals.setMockVideoPresentationModeEnabled(true); 14 } 15 11 16 findMediaElement(); 12 run('internals.settings.setAllowsPictureInPictureMediaPlayback(true)');13 17 run('video.src = findMediaFile("video", "content/test")'); 14 18 waitForEventOnce('canplaythrough', canPlayThrough); … … 22 26 } 23 27 24 function presentationModeChanged1()28 async function presentationModeChanged1() 25 29 { 30 await testExpectedEventually('video.webkitDisplayingFullscreen', true); 26 31 testExpected("video.webkitPresentationMode", "picture-in-picture"); 27 32 runWithKeyDown('video.webkitSetPresentationMode("inline")'); -
trunk/LayoutTests/media/video-presentation-mode-expected.txt
r261203 r262456 10 10 RUN(video.webkitSetPresentationMode('fullscreen')) 11 11 EVENT(webkitpresentationmodechanged) 12 EXPECTED (video.webkitDisplayingFullscreen == 'true') OK 12 13 13 14 ** Entered fullscreen … … 17 18 RUN(video.webkitSetPresentationMode('picture-in-picture')) 18 19 EVENT(webkitpresentationmodechanged) 20 EXPECTED (video.webkitDisplayingFullscreen == 'true') OK 19 21 20 22 ** Entered picture-in-picture … … 24 26 RUN(video.webkitSetPresentationMode('inline')) 25 27 EVENT(webkitpresentationmodechanged) 28 EXPECTED (video.webkitDisplayingFullscreen == 'false') OK 26 29 27 30 ** Returned to inline -
trunk/LayoutTests/media/video-presentation-mode.html
r261203 r262456 2 2 <html> 3 3 <head> 4 <script src=media-file.js></script>5 <script src=video-test.js></script>6 <script>4 <script src=media-file.js></script> 5 <script src=video-test.js></script> 6 <script> 7 7 function start() 8 8 { 9 if (window.internals) {10 window.internals.settings.setAllowsPictureInPictureMediaPlayback(true);11 window.internals.setMockVideoPresentationModeEnabled(true);9 if (window.internals) { 10 internals.settings.setAllowsPictureInPictureMediaPlayback(true); 11 internals.setMockVideoPresentationModeEnabled(true); 12 12 } 13 14 video = document.getElementsByTagName('video')[0];15 waitForEventOnce("canplaythrough", canplaythrough);16 video.src = findMediaFile("video", "content/test");17 13 18 consoleWrite(""); 14 video = document.getElementsByTagName('video')[0]; 15 waitForEventOnce("canplaythrough", canplaythrough); 16 video.src = findMediaFile("video", "content/test"); 17 18 consoleWrite(""); 19 19 } 20 21 function canplaythrough() 22 { 23 testExpected("video.webkitSupportsFullscreen", true); 24 testExpected("video.webkitDisplayingFullscreen", false); 25 26 consoleWrite("<br>** Try to enter fullscreen"); 27 runWithKeyDown("video.webkitSetPresentationMode('fullscreen')"); 28 waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged1); 29 } 30 31 function presentationModeChanged1() 32 { 33 consoleWrite("<br>** Entered fullscreen"); 34 testExpected("video.webkitPresentationMode", "fullscreen"); 35 consoleWrite("<br>** Try to enter picture-in-picture"); 36 waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged2); 37 runWithKeyDown("video.webkitSetPresentationMode('picture-in-picture')"); 38 } 39 40 function presentationModeChanged2() 41 { 42 consoleWrite("<br>** Entered picture-in-picture"); 43 testExpected("video.webkitPresentationMode", "picture-in-picture"); 44 consoleWrite("<br>** Try to return to inline"); 45 waitForEventOnce('webkitpresentationmodechanged', testCompleted); 46 runWithKeyDown("video.webkitSetPresentationMode('inline')"); 47 } 48 49 function testCompleted() 50 { 51 consoleWrite("<br>** Returned to inline"); 52 testExpected("video.webkitPresentationMode", "inline"); 53 consoleWrite("<br>** Test Completed"); 54 endTest(); 55 } 56 </script> 57 </head> 58 59 <body onload="start()"> 60 <video controls playsinline></video> 61 <p>Test the video presentation mode (video fullscreen and picture-in-picture) API.</p> 62 </body> 20 21 async function canplaythrough() 22 { 23 testExpected("video.webkitSupportsFullscreen", true); 24 await testExpectedEventually('video.webkitDisplayingFullscreen', false); 25 26 consoleWrite("<br>** Try to enter fullscreen"); 27 runWithKeyDown("video.webkitSetPresentationMode('fullscreen')"); 28 waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged1); 29 } 30 31 async function presentationModeChanged1() 32 { 33 await testExpectedEventually('video.webkitDisplayingFullscreen', true); 34 consoleWrite("<br>** Entered fullscreen"); 35 testExpected("video.webkitPresentationMode", "fullscreen"); 36 consoleWrite("<br>** Try to enter picture-in-picture"); 37 waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged2); 38 runWithKeyDown("video.webkitSetPresentationMode('picture-in-picture')"); 39 } 40 41 async function presentationModeChanged2() 42 { 43 await testExpectedEventually('video.webkitDisplayingFullscreen', true); 44 consoleWrite("<br>** Entered picture-in-picture"); 45 testExpected("video.webkitPresentationMode", "picture-in-picture"); 46 consoleWrite("<br>** Try to return to inline"); 47 waitForEventOnce('webkitpresentationmodechanged', testCompleted); 48 runWithKeyDown("video.webkitSetPresentationMode('inline')"); 49 } 50 51 async function testCompleted() 52 { 53 await testExpectedEventually('video.webkitDisplayingFullscreen', false); 54 consoleWrite("<br>** Returned to inline"); 55 testExpected("video.webkitPresentationMode", "inline"); 56 consoleWrite("<br>** Test Completed"); 57 endTest(); 58 } 59 </script> 60 </head> 61 62 <body onload="start()"> 63 <video controls playsinline></video> 64 <p>Test the video presentation mode (video fullscreen and picture-in-picture) API.</p> 65 </body> 63 66 </html> -
trunk/Source/WebCore/ChangeLog
r262437 r262456 1 2020-06-02 Peng Liu <peng.liu6@apple.com> 2 3 Stressing webkitSetPresentationMode leads to wrong inline video dimensions 4 https://bugs.webkit.org/show_bug.cgi?id=202425 5 6 Reviewed by Eric Carlson. 7 8 Make the HTMLVideoElement::setFullscreenMode() robust under stress tests 9 by ignoring a request when the video element is not ready yet. 10 11 Manually tested. 12 13 * dom/Element.h: 14 (WebCore::Element::didStopBeingFullscreenElement): 15 Add a callback to indicate that the element has exited fullscreen. 16 * dom/FullscreenManager.cpp: 17 (WebCore::FullscreenManager::didExitFullscreen): 18 Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen. 19 20 * html/HTMLMediaElement.cpp: 21 (WebCore::HTMLMediaElement::enterFullscreen): 22 * html/HTMLMediaElement.h: 23 24 * html/HTMLVideoElement.cpp: 25 (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): 26 This function will return true when a video element is in the process to exit 27 fullscreen/picture-in-picture until it has completed the process. Therefore, a page 28 can safely request the video element to enter fullscreen/picture-in-picture when 29 this function returns false. 30 31 (WebCore::HTMLVideoElement::setFullscreenMode): 32 (WebCore::HTMLVideoElement::didBecomeFullscreenElement): 33 (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): 34 (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted. 35 (WebCore::HTMLVideoElement::didExitFullscreen): Deleted. 36 * html/HTMLVideoElement.h: 37 Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only 38 change the presentation mode when the flag is false. 39 1 40 2020-06-01 Simon Fraser <simon.fraser@apple.com> 2 41 -
trunk/Source/WebCore/dom/Element.h
r262154 r262456 424 424 virtual void didBecomeFullscreenElement() { } 425 425 virtual void willStopBeingFullscreenElement() { } 426 virtual void didStopBeingFullscreenElement() { } 426 427 427 428 bool isFinishedParsingChildren() const { return isParsingChildrenFinished(); } -
trunk/Source/WebCore/dom/FullscreenManager.cpp
r257644 r262456 422 422 return; 423 423 fullscreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); 424 m_fullscreenElement->didStopBeingFullscreenElement(); 424 425 425 426 m_areKeysEnabledInFullscreen = false; -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r261899 r262456 5993 5993 return; 5994 5994 5995 if (m_waitingToEnterFullscreen) 5996 return; 5997 5995 5998 #if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_USES_ELEMENT_FULLSCREEN) 5996 5999 if (document().settings().fullScreenEnabled() && mode == VideoFullscreenModeStandard) { -
trunk/Source/WebCore/html/HTMLMediaElement.h
r262038 r262456 562 562 bool isSuspended() const final; 563 563 564 WEBCORE_EXPORT void didBecomeFullscreenElement() final;564 WEBCORE_EXPORT void didBecomeFullscreenElement() override; 565 565 WEBCORE_EXPORT void willExitFullscreen(); 566 566 -
trunk/Source/WebCore/html/HTMLVideoElement.cpp
r262038 r262456 349 349 bool HTMLVideoElement::webkitDisplayingFullscreen() 350 350 { 351 return isFullscreen() && !waitingToEnterFullscreen(); 351 // This function starts to return true after the video element has entered 352 // fullscreen/picture-in-picture until it has exited fullscreen/picture-in-picture 353 return (isFullscreen() && !waitingToEnterFullscreen()) || (!isFullscreen() && m_isChangingPresentationMode); 352 354 } 353 355 … … 468 470 INFO_LOG(LOGIDENTIFIER, ", mode = ", mode); 469 471 472 if (m_isChangingPresentationMode) 473 return; 474 470 475 if (mode == VideoFullscreenModeNone) { 471 476 if (isFullscreen()) { 472 477 if (toPresentationMode(fullscreenMode()) == VideoPresentationMode::PictureInPicture) 473 478 m_isEnteringOrExitingPictureInPicture = true; 479 480 m_isChangingPresentationMode = true; 474 481 exitFullscreen(); 475 482 } … … 484 491 m_isEnteringOrExitingPictureInPicture = true; 485 492 486 enterFullscreen(mode); 493 if (mode != fullscreenMode()) { 494 m_isChangingPresentationMode = true; 495 enterFullscreen(mode); 496 } 487 497 } 488 498 … … 505 515 } 506 516 507 void HTMLVideoElement::didEnterFullscreen() 508 { 517 void HTMLVideoElement::didBecomeFullscreenElement() 518 { 519 m_isChangingPresentationMode = false; 509 520 if (m_isEnteringOrExitingPictureInPicture) 510 521 m_isWaitingForPictureInPictureWindowFrame = true; 511 } 512 513 void HTMLVideoElement::didExitFullscreen() 514 { 522 523 HTMLMediaElement::didBecomeFullscreenElement(); 524 } 525 526 void HTMLVideoElement::didStopBeingFullscreenElement() 527 { 528 m_isChangingPresentationMode = false; 515 529 if (m_isEnteringOrExitingPictureInPicture) { 516 530 m_isEnteringOrExitingPictureInPicture = false; -
trunk/Source/WebCore/html/HTMLVideoElement.h
r262038 r262456 90 90 void fullscreenModeChanged(VideoFullscreenMode) final; 91 91 92 WEBCORE_EXPORT void did EnterFullscreen();93 WEBCORE_EXPORT void did ExitFullscreen();92 WEBCORE_EXPORT void didBecomeFullscreenElement() final; 93 WEBCORE_EXPORT void didStopBeingFullscreenElement() final; 94 94 void setVideoFullscreenFrame(FloatRect) final; 95 95 … … 135 135 unsigned m_lastReportedVideoHeight { 0 }; 136 136 137 bool m_isChangingPresentationMode { false }; 137 138 bool m_isEnteringOrExitingPictureInPicture { false }; 138 139 bool m_isWaitingForPictureInPictureWindowFrame { false }; -
trunk/Source/WebKit/ChangeLog
r262455 r262456 1 2020-06-02 Peng Liu <peng.liu6@apple.com> 2 3 Stressing webkitSetPresentationMode leads to wrong inline video dimensions 4 https://bugs.webkit.org/show_bug.cgi?id=202425 5 6 Reviewed by Eric Carlson. 7 8 * WebProcess/cocoa/VideoFullscreenManager.mm: 9 (WebKit::VideoFullscreenManager::didEnterFullscreen): 10 (WebKit::VideoFullscreenManager::didCleanupFullscreen): 11 1 12 2020-06-02 Kate Cheney <katherine_cheney@apple.com> 2 13 -
trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm
r262038 r262456 442 442 return; 443 443 444 videoElement->didEnterFullscreen();445 446 444 dispatch_async(dispatch_get_main_queue(), [protectedThis = makeRefPtr(this), videoElement] { 447 445 videoElement->didBecomeFullscreenElement(); … … 509 507 RefPtr<HTMLVideoElement> videoElement = model->videoElement(); 510 508 if (videoElement) 511 videoElement->did ExitFullscreen();509 videoElement->didStopBeingFullscreenElement(); 512 510 513 511 interface->setFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone); -
trunk/Source/WebKitLegacy/mac/ChangeLog
r262395 r262456 1 2020-06-02 Peng Liu <peng.liu6@apple.com> 2 3 Stressing webkitSetPresentationMode leads to wrong inline video dimensions 4 https://bugs.webkit.org/show_bug.cgi?id=202425 5 6 Reviewed by Eric Carlson. 7 8 Move DumpRenderTree's implementation of the mock video presentation mode from WebView 9 to WebChromeClient and call videoElement.didStopBeingFullscreenElement() when a video 10 element exits fullscreen. 11 12 * WebCoreSupport/WebChromeClient.h: 13 * WebCoreSupport/WebChromeClient.mm: 14 (WebChromeClient::setMockVideoPresentationModeEnabled): 15 (WebChromeClient::enterVideoFullscreenForVideoElement): 16 (WebChromeClient::exitVideoFullscreenForVideoElement): 17 (WebChromeClient::exitVideoFullscreenToModeWithoutAnimation): 18 * WebView/WebView.mm: 19 (-[WebView _enterVideoFullscreenForVideoElement:mode:]): 20 (-[WebView _exitVideoFullscreen]): 21 (-[WebView _setMockVideoPresentationModeEnabled:]): Deleted. 22 * WebView/WebViewData.h: 23 * WebView/WebViewInternal.h: 24 1 25 2020-06-01 David Kilzer <ddkilzer@apple.com> 2 26 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h
r261203 r262456 237 237 String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL&) const final; 238 238 239 bool m_mockVideoPresentationModeEnabled { false }; 239 240 WebView *m_webView; 240 241 }; -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm
r261203 r262456 73 73 #import <WebCore/HTMLNames.h> 74 74 #import <WebCore/HTMLPlugInImageElement.h> 75 #import <WebCore/HTMLVideoElement.h> 75 76 #import <WebCore/HitTestResult.h> 76 77 #import <WebCore/Icon.h> … … 970 971 void WebChromeClient::setMockVideoPresentationModeEnabled(bool enabled) 971 972 { 972 [m_webView _setMockVideoPresentationModeEnabled:enabled];973 m_mockVideoPresentationModeEnabled = enabled; 973 974 } 974 975 … … 978 979 ASSERT(mode != HTMLMediaElementEnums::VideoFullscreenModeNone); 979 980 BEGIN_BLOCK_OBJC_EXCEPTIONS; 980 [m_webView _enterVideoFullscreenForVideoElement:&videoElement mode:mode]; 981 if (m_mockVideoPresentationModeEnabled) 982 videoElement.didBecomeFullscreenElement(); 983 else 984 [m_webView _enterVideoFullscreenForVideoElement:&videoElement mode:mode]; 981 985 END_BLOCK_OBJC_EXCEPTIONS; 982 986 } 983 987 984 void WebChromeClient::exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement& )988 void WebChromeClient::exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement& videoElement) 985 989 { 986 990 BEGIN_BLOCK_OBJC_EXCEPTIONS; 987 [m_webView _exitVideoFullscreen]; 991 if (m_mockVideoPresentationModeEnabled) 992 videoElement.didStopBeingFullscreenElement(); 993 else 994 [m_webView _exitVideoFullscreen]; 988 995 END_BLOCK_OBJC_EXCEPTIONS; 989 996 } … … 992 999 { 993 1000 BEGIN_BLOCK_OBJC_EXCEPTIONS; 994 [m_webView _exitVideoFullscreen]; 1001 if (m_mockVideoPresentationModeEnabled) 1002 videoElement.didStopBeingFullscreenElement(); 1003 else 1004 [m_webView _exitVideoFullscreen]; 995 1005 END_BLOCK_OBJC_EXCEPTIONS; 996 1006 } -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r262395 r262456 9290 9290 #if ENABLE(VIDEO_PRESENTATION_MODE) 9291 9291 9292 - (void)_setMockVideoPresentationModeEnabled:(BOOL)enabled9293 {9294 _private->mockVideoPresentationModeEnabled = enabled;9295 }9296 9297 9292 - (void)_enterVideoFullscreenForVideoElement:(NakedPtr<WebCore::HTMLVideoElement>)videoElement mode:(WebCore::HTMLMediaElementEnums::VideoFullscreenMode)mode 9298 9293 { 9299 if (_private->mockVideoPresentationModeEnabled) {9300 videoElement->didBecomeFullscreenElement();9301 return;9302 }9303 9304 9294 if (_private->fullscreenController) { 9305 9295 if ([_private->fullscreenController videoElement] == videoElement) { … … 9330 9320 - (void)_exitVideoFullscreen 9331 9321 { 9332 if (_private->mockVideoPresentationModeEnabled)9333 return;9334 9335 9322 if (!_private->fullscreenController && _private->fullscreenControllersExiting.isEmpty()) 9336 9323 return; -
trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h
r262272 r262456 324 324 #endif 325 325 326 #if ENABLE(VIDEO_PRESENTATION_MODE)327 BOOL mockVideoPresentationModeEnabled;328 #endif329 330 326 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE) 331 327 RefPtr<WebCore::PlaybackSessionModelMediaElement> playbackSessionModel; -
trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h
r261981 r262456 271 271 #if ENABLE(VIDEO) && defined(__cplusplus) 272 272 #if ENABLE(VIDEO_PRESENTATION_MODE) 273 - (void)_setMockVideoPresentationModeEnabled:(BOOL)enabled;274 273 - (void)_enterVideoFullscreenForVideoElement:(NakedPtr<WebCore::HTMLVideoElement>)videoElement mode:(WebCore::HTMLMediaElementEnums::VideoFullscreenMode)mode; 275 274 - (void)_exitVideoFullscreen; -
trunk/Tools/ChangeLog
r262432 r262456 1 2020-06-02 Peng Liu <peng.liu6@apple.com> 2 3 Stressing webkitSetPresentationMode leads to wrong inline video dimensions 4 https://bugs.webkit.org/show_bug.cgi?id=202425 5 6 Reviewed by Eric Carlson. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: 9 (TEST): 10 1 11 2020-06-02 Youenn Fablet <youenn@apple.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm
r256528 r262456 39 39 40 40 [webView synchronouslyLoadHTMLString:@"<video src=video-with-audio.mp4 webkit-playsinline></video>"]; 41 42 [webView objectByEvaluatingJavaScriptWithUserGesture:@"document.querySelector('video').webkitSetPresentationMode('picture-in-picture')"]; 43 44 do { 45 id result = [webView objectByEvaluatingJavaScript:@"document.querySelector('video').webkitDisplayingFullscreen"]; 46 if ([result boolValue]) 47 break; 48 49 TestWebKitAPI::Util::sleep(0.5); 50 } while (true); 51 41 52 [webView objectByEvaluatingJavaScript:@"document.querySelector('video').addEventListener('webkitpresentationmodechanged', event => { window.webkit.messageHandlers.testHandler.postMessage('presentationmodechanged'); });"]; 42 53 43 54 __block bool presentationModeChanged = false; 44 [webView performAfterReceivingMessage:@"presentationmodechanged" action:^{ presentationModeChanged = true; }];45 46 [webView objectByEvaluatingJavaScriptWithUserGesture:@"document.querySelector('video').webkitSetPresentationMode('picture-in-picture')"];47 48 TestWebKitAPI::Util::run(&presentationModeChanged);49 50 presentationModeChanged = false;51 55 [webView performAfterReceivingMessage:@"presentationmodechanged" action:^{ presentationModeChanged = true; }]; 52 56
Note:
See TracChangeset
for help on using the changeset viewer.