Title: [261493] trunk
Revision
261493
Author
[email protected]
Date
2020-05-11 14:03:24 -0700 (Mon, 11 May 2020)

Log Message

Enable the mock video presentation mode in related layout tests and fix test failures
https://bugs.webkit.org/show_bug.cgi?id=211645

Reviewed by Darin Adler.

Source/WebCore:

Clean up the internal states of video element regarding video presentation mode
to simplify the task to write reliable layout tests for video fullscreen and
Picture-in-Picture.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::enterFullscreen):
Update the states after we are sure the video element will enter fullscreen.

(WebCore::HTMLMediaElement::exitFullscreen):
Remove the unnecessary "fullscreenModeChanged(VideoFullscreenModeNone)".

* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::waitingToEnterFullscreen):

* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::webkitDisplayingFullscreen):
The function webkitDisplayingFullscreen() will return true after the process
to enter fullscreen is completed.

* html/HTMLVideoElement.h:
Expose didBecomeFullscreenElement() when VIDEO_PRESENTATION_MODE is enabled.

Source/WebKit:

Fix the mistake in VideoFullscreenManager::supportsVideoFullscreen() introduced in r202274.

* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::supportsVideoFullscreen const):

Source/WebKitLegacy/mac:

Call HTMLVideoElement::didBecomeFullscreenElement() after a video element enters
fullscreen (to be consistent with WK2).

* WebView/WebVideoFullscreenController.mm:
(-[WebVideoFullscreenController windowDidEnterFullScreen:]):
* WebView/WebView.mm:
(-[WebView _enterVideoFullscreenForVideoElement:mode:]):

LayoutTests:

* 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/media-fullscreen-inline.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/media-fullscreen.js:
(async beginfullscreen):
(async fullscreenerror):
(addEventListeners):
(beginfullscreen): Deleted.
(fullscreenerror): Deleted.
* media/modern-media-controls/css/webkit-cursor-visibility-auto-hide-expected.txt:
* media/modern-media-controls/css/webkit-cursor-visibility-auto-hide.html:
* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt:
* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt:
* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html:
* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html:
* media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen-expected.txt:
* media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen.html:
* media/modern-media-controls/media-controller/media-controller-fullscreen-ltr-expected.txt:
* media/modern-media-controls/media-controller/media-controller-fullscreen-ltr.html:
* media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback-expected.txt:
* media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html:
* media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen-expected.txt:
* media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen.html:
* media/video-fullscreen-only-playback-expected.txt:
* media/video-fullscreen-only-playback.html:
* platform/ios/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/mac-wk2/TestExpectations:
* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261492 => 261493)


--- trunk/LayoutTests/ChangeLog	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/ChangeLog	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,3 +1,46 @@
+2020-05-11  Peng Liu  <[email protected]>
+
+        Enable the mock video presentation mode in related layout tests and fix test failures
+        https://bugs.webkit.org/show_bug.cgi?id=211645
+
+        Reviewed by Darin Adler.
+
+        * 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/media-fullscreen-inline.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/media-fullscreen.js:
+        (async beginfullscreen):
+        (async fullscreenerror):
+        (addEventListeners):
+        (beginfullscreen): Deleted.
+        (fullscreenerror): Deleted.
+        * media/modern-media-controls/css/webkit-cursor-visibility-auto-hide-expected.txt:
+        * media/modern-media-controls/css/webkit-cursor-visibility-auto-hide.html:
+        * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt:
+        * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt:
+        * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html:
+        * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html:
+        * media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen-expected.txt:
+        * media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen.html:
+        * media/modern-media-controls/media-controller/media-controller-fullscreen-ltr-expected.txt:
+        * media/modern-media-controls/media-controller/media-controller-fullscreen-ltr.html:
+        * media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback-expected.txt:
+        * media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html:
+        * media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen-expected.txt:
+        * media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen.html:
+        * media/video-fullscreen-only-playback-expected.txt:
+        * media/video-fullscreen-only-playback.html:
+        * platform/ios/TestExpectations:
+        * platform/mac-wk1/TestExpectations:
+        * platform/mac-wk2/TestExpectations:
+        * platform/mac/TestExpectations:
+
 2020-05-11  Ryan Haddad  <[email protected]>
 
         Unreviewed, reverting r261446.

Modified: trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt (261492 => 261493)


--- trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -3,6 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS media.webkitDisplayingFullscreen became true
 PASS media.duration became Number.POSITIVE_INFINITY
 PASS mediaController.controls.rewindButton.enabled is false
 PASS mediaController.controls.forwardButton.enabled is false

Modified: trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html (261492 => 261493)


--- trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -15,19 +15,18 @@
 const mediaController = createControls(shadowRoot, media, null);
 
 media.addEventListener("webkitfullscreenchange", () => {
-    if (!media.webkitDisplayingFullscreen)
-        return;
+    shouldBecomeEqual("media.webkitDisplayingFullscreen", "true", () => {
+        shouldBecomeEqual("media.duration", "Number.POSITIVE_INFINITY", () => {
+            shouldBeFalse("mediaController.controls.rewindButton.enabled");
+            shouldBeFalse("mediaController.controls.forwardButton.enabled");
+            shouldBe("mediaController.controls.timeControl.parent", "null");
+            shouldBe("mediaController.controls.statusLabel.parent", "mediaController.controls.bottomControlsBar");
 
-    shouldBecomeEqual("media.duration", "Number.POSITIVE_INFINITY", () => {
-        shouldBeFalse("mediaController.controls.rewindButton.enabled");
-        shouldBeFalse("mediaController.controls.forwardButton.enabled");
-        shouldBe("mediaController.controls.timeControl.parent", "null");
-        shouldBe("mediaController.controls.statusLabel.parent", "mediaController.controls.bottomControlsBar");
-
-        debug("");
-        media.remove();
-        shadowRoot.host.remove();
-        finishJSTest();
+            debug("");
+            media.remove();
+            shadowRoot.host.remove();
+            finishJSTest();
+        });
     });
 });
 

Modified: trunk/LayoutTests/media/media-fullscreen-inline.html (261492 => 261493)


--- trunk/LayoutTests/media/media-fullscreen-inline.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/media-fullscreen-inline.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
 <html>
     <head>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Modified: trunk/LayoutTests/media/media-fullscreen-loop-inline-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/media-fullscreen-loop-inline-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/media-fullscreen-loop-inline-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,19 +1,24 @@
 
-RUN(internals.settings.setAllowsInlineMediaPlayback(false))
-RUN(internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true))
-RUN(internals.settings.setFullScreenEnabled(false))
-RUN(internals.setMediaElementRestrictions(video, "NoRestrictions"))
+Test that a <video> keeps playing and looping after exiting fullscreen when the internal property "allowsInlineMediaPlaybackAfterFullscreen" is true.
+
 RUN(video.loop = true)
 RUN(video.src = "" "content/test"))
+EVENT(canplaythrough)
 RUN(video.play())
-EVENT(webkitbeginfullscreen)
+Wait to enter fullscreen
+EVENT(webkitpresentationmodechanged)
+EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
+Entered fullscreen
 RUN(video.currentTime = 5)
 RUN(video.webkitExitFullscreen())
-EVENT(webkitendfullscreen)
+Wait to exit fullscreen
+EVENT(webkitpresentationmodechanged)
+EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
+Exited fullscreen
 EXPECTED (video.paused == 'false') OK
 RUN(video._ontimeupdate_ = timeupdate)
+Looped
 RUN(video._ontimeupdate_ = null)
-Looped
 EXPECTED (video.playsInline == 'false') OK
 EXPECTED (video.paused == 'false') OK
 END OF TEST

Modified: trunk/LayoutTests/media/media-fullscreen-loop-inline.html (261492 => 261493)


--- trunk/LayoutTests/media/media-fullscreen-loop-inline.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/media-fullscreen-loop-inline.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,44 +1,62 @@
 <!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=false ] -->
 <html>
 <head>
-    <title>media-fullscreen-return-to-inline</title>
-
+    <title>media-fullscreen-loop-inline</title>
     <script src=""
     <script src=""
-
     <script>
     function go()
     {
+        if (!window.internals) {
+            failTest('This test requires window.internals.');
+            return;
+        }
+
         findMediaElement();
-        run('internals.settings.setAllowsInlineMediaPlayback(false)');
-        run('internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true)');
-        run('internals.settings.setFullScreenEnabled(false)');
-        run('internals.setMediaElementRestrictions(video, "NoRestrictions")');
+
+        internals.settings.setAllowsInlineMediaPlayback(false);
+        internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true);
+        // Disable the Fullscreen API (element fullscreen) support
+        internals.settings.setFullScreenEnabled(false);
+        internals.setMockVideoPresentationModeEnabled(true);
+        internals.setMediaElementRestrictions(video, "NoRestrictions");
+
+        waitForEventOnce('canplaythrough', canplaythrough);
         run('video.loop = true');
         run('video.src = "" "content/test")');
-        waitForEventOnce('webkitbeginfullscreen', beginfullscreen);
+    }
+
+    function canplaythrough()
+    {
+        waitForEventOnce('webkitpresentationmodechanged', beginfullscreen);
         run('video.play()');
+        consoleWrite("Wait to enter fullscreen");
     }
 
-    function beginfullscreen()
+    async function beginfullscreen()
     {
+        await testExpectedEventually('video.webkitDisplayingFullscreen', true);
+        consoleWrite("Entered fullscreen");
         run('video.currentTime = 5');
         run('video.webkitExitFullscreen()');
-        waitForEventOnce('webkitendfullscreen', endfullscreen);
+        waitForEventOnce('webkitpresentationmodechanged', endfullscreen);
+        consoleWrite("Wait to exit fullscreen");
     }
 
-    function endfullscreen()
+    async function endfullscreen()
     {
+        await testExpectedEventually('video.webkitDisplayingFullscreen', false);
+        consoleWrite("Exited fullscreen");
         testExpected('video.paused', false);
         run('video._ontimeupdate_ = timeupdate');
-        waitForEventAndFail('webkitbeginfullscreen');
+        waitForEventAndFail('webkitpresentationmodechanged');
     }
 
     function timeupdate()
     {
         if (video.currentTime == 0) {
+            consoleWrite("Looped");
             run('video._ontimeupdate_ = null');
-            consoleWrite("Looped");
             testExpected('video.playsInline', false);
             setTimeout(function loopCompleted() {
                testExpected('video.paused', false);
@@ -46,12 +64,10 @@
             }, 0);
         }
     }
-
     </script>
-
 </head>
-
 <body _onload_="go()">
     <video controls></video>
+    <p>Test that a &lt;video&gt; keeps playing and looping after exiting fullscreen when the internal property "allowsInlineMediaPlaybackAfterFullscreen" is true.</p>
 </body>
 </html>

Modified: trunk/LayoutTests/media/media-fullscreen-pause-inline-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/media-fullscreen-pause-inline-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/media-fullscreen-pause-inline-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,13 +1,13 @@
 
-RUN(internals.settings.setAllowsInlineMediaPlayback(false))
-RUN(internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true))
-RUN(internals.settings.setFullScreenEnabled(false))
-RUN(internals.setMediaElementRestrictions(video, "NoRestrictions"))
+Test that a <video> keeps playing after exiting fullscreen when the internal property "allowsInlineMediaPlaybackAfterFullscreen" is true.
+
 RUN(video.src = "" "content/test"))
+EVENT(canplaythrough)
 RUN(video.play().then(playing);)
 EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
 RUN(video.webkitExitFullscreen())
-EVENT(webkitendfullscreen)
+EVENT(webkitpresentationmodechanged)
+EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
 EXPECTED (video.paused == 'false') OK
 RUN(video.pause())
 EVENT(pause)

Modified: trunk/LayoutTests/media/media-fullscreen-pause-inline.html (261492 => 261493)


--- trunk/LayoutTests/media/media-fullscreen-pause-inline.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/media-fullscreen-pause-inline.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,8 +1,7 @@
 <!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=false ] -->
 <html>
 <head>
-    <title>media-fullscreen-return-to-inline</title>
-
+    <title>media-fullscreen-pause-inline</title>
     <script src=""
     <script src=""
 
@@ -9,47 +8,59 @@
     <script>
     function go()
     {
+        if (!window.internals) {
+            failTest('This test requires window.internals.');
+            return;
+        }
+
         findMediaElement();
-        run('internals.settings.setAllowsInlineMediaPlayback(false)');
-        run('internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true)');
-        run('internals.settings.setFullScreenEnabled(false)');
-        run('internals.setMediaElementRestrictions(video, "NoRestrictions")');
+
+        internals.settings.setAllowsInlineMediaPlayback(false);
+        internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true);
+        // Disable the Fullscreen API (element fullscreen) support
+        internals.settings.setFullScreenEnabled(false);
+        internals.setMockVideoPresentationModeEnabled(true);
+        internals.setMediaElementRestrictions(video, "NoRestrictions");
+
+        waitForEventOnce('canplaythrough', canplaythrough);
         run('video.src = "" "content/test")');
+    }
+
+    function canplaythrough()
+    {
         run('video.play().then(playing);');
     }
 
-    function playing()
+    async function playing()
     {
-        testExpected('video.webkitDisplayingFullscreen', true);
-        waitForEventOnce('webkitendfullscreen', endfullscreen);
+        await testExpectedEventually('video.webkitDisplayingFullscreen', true);
+        waitForEventOnce('webkitpresentationmodechanged', endfullscreen);
         run('video.webkitExitFullscreen()');
     }
 
-    function endfullscreen()
+    async function endfullscreen()
     {
+        await testExpectedEventually('video.webkitDisplayingFullscreen', false);
         testExpected('video.paused', false);
+        waitForEventOnce('pause', paused);
         run('video.pause()');
-        waitForEventOnce('pause', paused);
     }
 
     function paused()
     {
         testExpected('video.paused', true);
-        setTimeout(function(){ run('video.play().then(playingAgain)');}, 0)
+        setTimeout(function(){ run('video.play().then(playingAgain)'); }, 0);
     }
 
-    function playingAgain()
+    async function playingAgain()
     {
-
-        testExpected('video.webkitDisplayingFullscreen', true);
+        await testExpectedEventually('video.webkitDisplayingFullscreen', true);
         endTest();
     }
-
     </script>
-
 </head>
-
 <body _onload_="go()">
     <video controls></video>
+    <p>Test that a &lt;video&gt; keeps playing after exiting fullscreen when the internal property "allowsInlineMediaPlaybackAfterFullscreen" is true.</p>
 </body>
-</html>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/media/media-fullscreen-return-to-inline-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/media-fullscreen-return-to-inline-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/media-fullscreen-return-to-inline-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,17 +1,21 @@
 
-RUN(internals.settings.setAllowsInlineMediaPlayback(false))
-RUN(internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(false))
+Test that a <video> pauses after exiting fullscreen when the internal property "allowsInlineMediaPlaybackAfterFullscreen" is false.
+
 RUN(video.src = "" "content/test"))
 EVENT(canplaythrough)
 RUN(video.play())
-EVENT(webkitfullscreenchange)
+EVENT(webkitpresentationmodechanged)
+EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
 RUN(video.webkitExitFullscreen())
 EVENT(pause)
-RUN(internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true))
+EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
+EXPECTED (video.paused == 'true') OK
 RUN(video.play())
-EVENT(webkitfullscreenchange)
+EVENT(webkitpresentationmodechanged)
+EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
 RUN(video.webkitExitFullscreen())
-EVENT(webkitfullscreenchange)
+EVENT(webkitpresentationmodechanged)
+EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
 EXPECTED (video.paused == 'false') OK
 END OF TEST
 

Modified: trunk/LayoutTests/media/media-fullscreen-return-to-inline.html (261492 => 261493)


--- trunk/LayoutTests/media/media-fullscreen-return-to-inline.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/media-fullscreen-return-to-inline.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -9,48 +9,65 @@
     <script>
     function go()
     {
+        if (!window.internals) {
+            failTest('This test requires window.internals.');
+            return;
+        }
+
         findMediaElement();
-        run('internals.settings.setAllowsInlineMediaPlayback(false)');
-        run('internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(false)');
+
+        internals.settings.setAllowsInlineMediaPlayback(false);
+        internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(false);
+        // Disable the Fullscreen API (element fullscreen) support
+        internals.settings.setFullScreenEnabled(false);
+        internals.setMockVideoPresentationModeEnabled(true);
+
+        waitForEventOnce('canplaythrough', canplaythrough);
         run('video.src = "" "content/test")');
-        waitForEventOnce('canplaythrough', canplaythrough);
     }
 
     function canplaythrough()
     {
+        waitForEventOnce('webkitpresentationmodechanged', beginfullscreen1);
         runWithKeyDown('video.play()');
-        waitForEventOnce('webkitfullscreenchange', beginfullscreen1);
     }
 
-    function beginfullscreen1()
+    async function beginfullscreen1()
     {
+        await testExpectedEventually('video.webkitDisplayingFullscreen', true);
+        waitForEventOnce('pause', pause);
         run('video.webkitExitFullscreen()');
-        waitForEventOnce('pause', pause);
     }
 
-    function pause()
+    async function pause()
     {
-        run('internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true)');
+        await testExpectedEventually('video.webkitDisplayingFullscreen', false);
+        testExpected('video.paused', true);
+
+        internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true);
+
+        waitForEventOnce('webkitpresentationmodechanged', beginfullscreen2);
         runWithKeyDown('video.play()');
-        waitForEventOnce('webkitfullscreenchange', beginfullscreen2);
     }
 
-    function beginfullscreen2()
+    async function beginfullscreen2()
     {
+        await testExpectedEventually('video.webkitDisplayingFullscreen', true);
+        waitForEventOnce('webkitpresentationmodechanged', endfullscreen);
         run('video.webkitExitFullscreen()');
-        waitForEventOnce('webkitfullscreenchange', endfullscreen);
     }
 
-    function endfullscreen()
+    async function endfullscreen()
     {
+        await testExpectedEventually('video.webkitDisplayingFullscreen', false);
         testExpected('video.paused', false);
         endTest();
     }
     </script>
-
 </head>
 
 <body _onload_="go()">
-    <video controls></video>
+    <video controls loop></video>
+    <p>Test that a &lt;video&gt; pauses after exiting fullscreen when the internal property "allowsInlineMediaPlaybackAfterFullscreen" is false.</p>
 </body>
 </html>

Modified: trunk/LayoutTests/media/media-fullscreen.js (261492 => 261493)


--- trunk/LayoutTests/media/media-fullscreen.js	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/media-fullscreen.js	2020-05-11 21:03:24 UTC (rev 261493)
@@ -38,9 +38,9 @@
         endfullscreen();
 }
 
-function beginfullscreen()
+async function beginfullscreen()
 {
-    testExpected("mediaElement.webkitDisplayingFullscreen", true);
+    await testExpectedEventually("mediaElement.webkitDisplayingFullscreen", true);
     run("mediaElement.webkitExitFullScreen()");
 }
 
@@ -49,13 +49,13 @@
     setTimeout(openNextMovie, 10);
 }
 
-function fullscreenerror()
+async function fullscreenerror()
 {
     var movie = movieInfo.movies[movieInfo.current];
     if (movie.inline) {
         failTest("Unexpected fullscreenerror event");
     } else {
-        testExpected("mediaElement.webkitDisplayingFullscreen", false);
+        await testExpectedEventually("mediaElement.webkitDisplayingFullscreen", false);
         openNextMovie();
     }
 }
@@ -138,4 +138,3 @@
     waitForEvent('webkitfullscreenchange', fullscreenchange);
     waitForEvent('webkitfullscreenerror', fullscreenerror);
 }
-

Modified: trunk/LayoutTests/media/modern-media-controls/css/webkit-cursor-visibility-auto-hide-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/css/webkit-cursor-visibility-auto-hide-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/css/webkit-cursor-visibility-auto-hide-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -6,7 +6,7 @@
 PASS media.webkitDisplayingFullscreen is false
 PASS getComputedStyle(window.internals.shadowRoot(media).querySelector('.media-controls-container')).webkitCursorVisibility is "auto"
 
-PASS media.webkitDisplayingFullscreen is true
+PASS media.webkitDisplayingFullscreen became true
 PASS getComputedStyle(window.internals.shadowRoot(media).querySelector('.media-controls-container')).webkitCursorVisibility is "auto-hide"
 
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/media/modern-media-controls/css/webkit-cursor-visibility-auto-hide.html (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/css/webkit-cursor-visibility-auto-hide.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/css/webkit-cursor-visibility-auto-hide.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -17,12 +17,13 @@
     debug("");
 
     media.addEventListener("webkitfullscreenchange", () => {
-        shouldBeTrue("media.webkitDisplayingFullscreen");
-        shouldBeEqualToString("getComputedStyle(window.internals.shadowRoot(media).querySelector('.media-controls-container')).webkitCursorVisibility", "auto-hide");
-        debug("");
-        button.remove();
-        media.remove();
-        finishJSTest();
+        shouldBecomeEqual("media.webkitDisplayingFullscreen", "true", () => {
+            shouldBeEqualToString("getComputedStyle(window.internals.shadowRoot(media).querySelector('.media-controls-container')).webkitCursorVisibility", "auto-hide");
+            debug("");
+            button.remove();
+            media.remove();
+            finishJSTest();
+        });
     });
 
     const button = document.body.appendChild(document.createElement("div"));

Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -3,6 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS media.webkitDisplayingFullscreen became true
 PASS !!mediaControls.querySelector('.buttons-container.left') became true
 PASS mediaControls.querySelector('.buttons-container.left').style.width became "118px"
 PASS mediaControls.querySelector('.controls-bar').style.transform is "translate(-50px, -100px)"

Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -3,6 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS media.webkitDisplayingFullscreen became true
 PASS !!mediaControls.querySelector('.buttons-container.left') became true
 PASS mediaControls.querySelector('.buttons-container.left').style.width became "118px"
 PASS mediaControls.querySelector('.controls-bar').style.transform is ""

Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -17,7 +17,7 @@
 });
 
 media.addEventListener("webkitfullscreenchange", () => {
-    if (media.webkitDisplayingFullscreen) {
+    shouldBecomeEqual("media.webkitDisplayingFullscreen", "true", () => {
         mediaControls = shadowRoot.lastChild;
         shouldBecomeEqual("!!mediaControls.querySelector('.buttons-container.left')", "true", () => {
             shouldBecomeEqualToString("mediaControls.querySelector('.buttons-container.left').style.width", "118px", () => {
@@ -33,7 +33,7 @@
                 });
             });
         });
-    }
+    });
 });
 
 media.addEventListener("play", () => {

Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -17,7 +17,7 @@
 });
 
 media.addEventListener("webkitfullscreenchange", () => {
-    if (media.webkitDisplayingFullscreen) {
+    shouldBecomeEqual("media.webkitDisplayingFullscreen", "true", () => {
         mediaControls = shadowRoot.lastChild;
         shouldBecomeEqual("!!mediaControls.querySelector('.buttons-container.left')", "true", () => {
             shouldBecomeEqualToString("mediaControls.querySelector('.buttons-container.left').style.width", "118px", () => {
@@ -33,7 +33,7 @@
                 });
             });
         });
-    }
+    });
 });
 
 media.addEventListener("play", () => {

Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -6,7 +6,7 @@
 PASS mediaControls.querySelector('button.fullscreen') instanceof HTMLButtonElement became true
 
 Entering fullscreen
-PASS media.webkitDisplayingFullscreen is true
+PASS media.webkitDisplayingFullscreen became true
 PASS media.paused is false
 
 Clicking on video background

Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen.html (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -22,21 +22,22 @@
 
 
 media.addEventListener("webkitfullscreenchange", () => {
-    shouldBeTrue("media.webkitDisplayingFullscreen");
-    shouldBeFalse("media.paused");
+    shouldBecomeEqual("media.webkitDisplayingFullscreen", "true", () => {
+        shouldBeFalse("media.paused");
 
-    const bounds = media.getBoundingClientRect();
-    debug("");
-    debug("Clicking on video background");
-    eventSender.mouseMoveTo(bounds.left + 5, bounds.top + 5);
-    eventSender.mouseDown();
-    eventSender.mouseUp();
+        const bounds = media.getBoundingClientRect();
+        debug("");
+        debug("Clicking on video background");
+        eventSender.mouseMoveTo(bounds.left + 5, bounds.top + 5);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
 
-    shouldBeTrue("media.paused");
+        shouldBeTrue("media.paused");
 
-    debug("");
-    media.remove();
-    finishJSTest();
+        debug("");
+        media.remove();
+        finishJSTest();
+    });
 });
 
 </script>

Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-fullscreen-ltr-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-fullscreen-ltr-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-fullscreen-ltr-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -3,6 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS media.webkitDisplayingFullscreen became true
 Media entered fullscreen
 PASS mediaControlsElement.classList.contains('uses-ltr-user-interface-layout-direction') is true
 PASS document.defaultView.getComputedStyle(volumeSliderElement).transform is "none"

Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-fullscreen-ltr.html (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-fullscreen-ltr.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-fullscreen-ltr.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -15,7 +15,7 @@
 let mediaControlsElement, volumeSliderElement;
 
 media.addEventListener("webkitfullscreenchange", function() {
-    if (media.webkitDisplayingFullscreen) {
+    shouldBecomeEqual("media.webkitDisplayingFullscreen", "true", () => {
         window.requestAnimationFrame(() => {
             window.requestAnimationFrame(() => {
                 debug("Media entered fullscreen");
@@ -44,7 +44,7 @@
                 finishJSTest();
             });
         });
-    }
+    });
 });
 
 media.addEventListener("loadedmetadata", () => {

Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -9,7 +9,7 @@
 Entering fullscreen.
 
 Obtained a 'webkitfullscreenchange' event.
-media.webkitDisplayingFullscreen = true.
+PASS media.webkitDisplayingFullscreen became true
 PASS media.paused is false
 
 Pressing the space bar.
@@ -21,7 +21,6 @@
 Obtained a 'play' event.
 
 Obtained a 'webkitfullscreenchange' event.
-media.webkitDisplayingFullscreen = false.
 
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -16,11 +16,12 @@
 media.addEventListener("webkitfullscreenchange", () => {
     debug("");
     debug("Obtained a 'webkitfullscreenchange' event.");
-    debug(`media.webkitDisplayingFullscreen = ${media.webkitDisplayingFullscreen}.`);
 
-    if (media.webkitDisplayingFullscreen) {
-        shouldBeFalse("media.paused");
-        pressSpace();
+    if (playCount == 1) {
+        shouldBecomeEqual('media.webkitDisplayingFullscreen', 'true', () => {
+            shouldBeFalse("media.paused");
+            pressSpace();
+        });
     } else
         endTest();
 });
@@ -46,7 +47,6 @@
     pressSpace();
 });
 
-
 function enterFullscreen() {
     debug("");
     debug("Entering fullscreen.");

Modified: trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -5,6 +5,7 @@
 
 PASS internals.shadowRoot(media).querySelector("button.fullscreen") became different from null
 PASS internals.shadowRoot(media).querySelector("button.fullscreen").getBoundingClientRect().width became different from 0
+PASS media.webkitDisplayingFullscreen became true
 PASS internals.shadowRoot(media).querySelector("button.tracks") became different from null
 PASS internals.shadowRoot(media).querySelector("button.tracks").getBoundingClientRect().width became different from 0
 PASS internals.shadowRoot(media).querySelector("button.tracks").getBoundingClientRect().right became 582

Modified: trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen.html (261492 => 261493)


--- trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -12,19 +12,18 @@
 const media = document.querySelector("video");
 
 media.addEventListener("webkitfullscreenchange", () => {
-    if (!media.webkitDisplayingFullscreen)
-        return;
-
-    shouldBecomeDifferent(`internals.shadowRoot(media).querySelector("button.tracks")`, "null", () => {
-        shouldBecomeDifferent(`internals.shadowRoot(media).querySelector("button.tracks").getBoundingClientRect().width`, "0", () => {
-            shouldBecomeEqual(`internals.shadowRoot(media).querySelector("button.tracks").getBoundingClientRect().right`, "582", () => {
-                pressOnElement(internals.shadowRoot(media).querySelector("button.tracks"));
-                shouldBecomeDifferent(`internals.shadowRoot(media).querySelector('.tracks-panel')`, "null", () => {
-                    shouldBeEqualToString("internals.shadowRoot(media).querySelector('.tracks-panel').style.right", "218px");
-                    shouldBeEqualToString("internals.shadowRoot(media).querySelector('.tracks-panel').style.bottom", "101px");
-                    debug("");
-                    media.remove();
-                    finishJSTest();
+    shouldBecomeEqual("media.webkitDisplayingFullscreen", "true", () => {
+        shouldBecomeDifferent(`internals.shadowRoot(media).querySelector("button.tracks")`, "null", () => {
+            shouldBecomeDifferent(`internals.shadowRoot(media).querySelector("button.tracks").getBoundingClientRect().width`, "0", () => {
+                shouldBecomeEqual(`internals.shadowRoot(media).querySelector("button.tracks").getBoundingClientRect().right`, "582", () => {
+                    pressOnElement(internals.shadowRoot(media).querySelector("button.tracks"));
+                    shouldBecomeDifferent(`internals.shadowRoot(media).querySelector('.tracks-panel')`, "null", () => {
+                        shouldBeEqualToString("internals.shadowRoot(media).querySelector('.tracks-panel').style.right", "218px");
+                        shouldBeEqualToString("internals.shadowRoot(media).querySelector('.tracks-panel').style.bottom", "101px");
+                        debug("");
+                        media.remove();
+                        finishJSTest();
+                    });
                 });
             });
         });

Modified: trunk/LayoutTests/media/video-fullscreen-only-playback-expected.txt (261492 => 261493)


--- trunk/LayoutTests/media/video-fullscreen-only-playback-expected.txt	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/video-fullscreen-only-playback-expected.txt	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,18 +1,18 @@
 
-Test play() when <video> playback requires fullscreen.
+Test the play() function of <video> when fullscreen is required.
 
-RUN(internals.settings.setAllowsInlineMediaPlayback(false))
 
 EVENT(canplaythrough)
 EXPECTED (video.webkitSupportsFullscreen == 'true') OK
 EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
-
-** Clicking 'play' button...
+RUN(video.play())
 EVENT(playing)
+EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
 
 ** Entered fullscreen
-EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
 RUN(video.webkitExitFullScreen())
+EVENT(webkitpresentationmodechanged)
+EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
 
 ** Exited fullscreen
 END OF TEST

Modified: trunk/LayoutTests/media/video-fullscreen-only-playback.html (261492 => 261493)


--- trunk/LayoutTests/media/video-fullscreen-only-playback.html	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/media/video-fullscreen-only-playback.html	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,4 +1,4 @@
-<!-- webkit-test-runner [ enableModernMediaControls=false ] -->
+<!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=false ] -->
 <html>
     <head>
         <script src=""
@@ -5,24 +5,24 @@
         <script src=""
         <script src=""
         <script>
-
-            function fullscreenchange()
+            function start()
             {
-                if (!document.webkitIsFullScreen)
-                    endfullscreen();
-            }
+                if (!window.internals) {
+                    failTest('This test requires window.internals.');
+                    return;
+                }
 
-            function playing()
-            {
-                consoleWrite("<br>** Entered fullscreen");
-                testExpected("video.webkitDisplayingFullscreen", true);
-                run("video.webkitExitFullScreen()");
-            }
+                video = document.getElementsByTagName('video')[0];
+                waitForEvent("canplaythrough", canplaythrough);
+                waitForEvent('playing', playing);
+                video.src = "" "content/test");
 
-            function endfullscreen()
-            {
-                consoleWrite("<br>** Exited fullscreen");
-                endTest();
+                internals.settings.setAllowsInlineMediaPlayback(false);
+                // Disable the Fullscreen API (element fullscreen) support
+                internals.settings.setFullScreenEnabled(false);
+                internals.setMockVideoPresentationModeEnabled(true);
+
+                consoleWrite("");
             }
 
             function canplaythrough()
@@ -30,10 +30,8 @@
                 testExpected("video.webkitSupportsFullscreen", true);
                 testExpected("video.webkitDisplayingFullscreen", false);
 
-                consoleWrite("<br>** Clicking \'play\' button...");
-
                 try {
-                    clickPlayButton(video);
+                    runWithKeyDown("video.play()");
                 } catch (exception) {
                     failTest(exception.description);
                     return;
@@ -40,25 +38,19 @@
                 }
             }
 
+            async function playing()
+            {
+                await testExpectedEventually("video.webkitDisplayingFullscreen", true);
+                consoleWrite("<br>** Entered fullscreen");
+                waitForEvent('webkitpresentationmodechanged', endfullscreen);
+                run("video.webkitExitFullScreen()");
+            }
 
-            function start()
+            async function endfullscreen()
             {
-                if (!window.internals) {
-                    failTest('This test requires window.internals.');
-                    return;
-                }
-
-                video = document.getElementsByTagName('video')[0];
-                waitForEvent("canplaythrough", canplaythrough);
-                waitForEvent('playing', playing);
-
-                video.addEventListener('webkitendfullscreen', endfullscreen, true);
-                video.addEventListener('webkitfullscreenchange', fullscreenchange, true);
-
-                video.src = "" "content/test");
-
-                run("internals.settings.setAllowsInlineMediaPlayback(false)");
-                consoleWrite("");
+                await testExpectedEventually("video.webkitDisplayingFullscreen", false);
+                consoleWrite("<br>** Exited fullscreen");
+                endTest();
             }
         </script>
     </head>
@@ -65,6 +57,6 @@
 
     <body _onload_="start()">
         <video controls></video>
-        <p>Test play() when &lt;video&gt; playback requires fullscreen.</p>
+        <p>Test the play() function of &lt;video&gt; when fullscreen is required.</p>
     </body>
 </html>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (261492 => 261493)


--- trunk/LayoutTests/platform/ios/TestExpectations	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2020-05-11 21:03:24 UTC (rev 261493)
@@ -2430,7 +2430,6 @@
 webkit.org/b/136708 media/media-fullscreen-not-in-document.html
 
 media/media-controls-accessibility.html [ Timeout ]
-media/media-fullscreen-return-to-inline.html
 media/no-autoplay-with-user-gesture-requirement.html
 media/video-controls-drag.html
 media/video-controls-fullscreen-volume.html
@@ -2567,7 +2566,6 @@
 webkit.org/b/163291 media/require-user-gesture-to-load-video.html
 webkit.org/b/163291 media/video-controls-transformed.html [ Failure ]
 webkit.org/b/163291 media/video-controls-visible-audio-only.html [ Failure ]
-webkit.org/b/163291 media/video-fullscreen-only-playback.html [ Failure ]
 webkit.org/b/163291 media/video-play-audio-require-user-gesture.html [ Failure ]
 webkit.org/b/163291 media/video-play-require-user-gesture.html
 
@@ -3156,11 +3154,6 @@
 # <rdar://problem/36455339> LayoutTest compositing/ios/overflow-scroll-touch-tiles.html is a flaky failure
 compositing/ios/overflow-scroll-touch-tiles.html [ Pass Failure ]
 
-# <rdar://problem/41546970> REGRESSION: LayoutTest media/media-fullscreen-loop-inline.html is a flaky timeout
-media/media-fullscreen-loop-inline.html [ Pass Timeout ]
-
-webkit.org/b/187618 [ Release ] media/media-fullscreen-pause-inline.html [ Pass Failure ]
-
 # Disabled globally.
 http/tests/xmlhttprequest/gzip-content-type-no-content-encoding.html [ Pass ]
 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (261492 => 261493)


--- trunk/LayoutTests/platform/mac/TestExpectations	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2020-05-11 21:03:24 UTC (rev 261493)
@@ -759,7 +759,6 @@
 webkit.org/b/135071 media/video-seek-with-negative-playback.html [ Pass Timeout ]
 webkit.org/b/135160 media/track/track-in-band-subtitles-too-large.html [ Failure ]
 webkit.org/b/135160 media/track/track-long-word-container-sizing.html [ Failure ]
-webkit.org/b/137311 media/video-fullscreen-only-playback.html [ Pass Timeout Crash ]
 webkit.org/b/139789 media/media-controls-timeline-updates.html [ Pass Failure ]
 webkit.org/b/139825 media/video-seek-past-end-paused.html [ Pass Timeout ]
 webkit.org/b/141084 http/tests/media/video-preload.html [ Pass Timeout ]
@@ -1641,8 +1640,6 @@
 webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ready-states/autoplay.html [ Pass Failure ]
 webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/error-codes/error.html [ Pass Failure ]
 
-webkit.org/b/193399 media/media-fullscreen-return-to-inline.html [ Pass Timeout ]
-
 http/tests/websocket/tests/hybi/handshake-ok-with-legacy-sec-websocket-response-headers.html [ Pass Failure ]
 
 webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute-width-1000px.html [ Pass Failure ]
@@ -1948,8 +1945,6 @@
 
 webkit.org/b/210046 [ Release ] storage/indexeddb/value-cursor-cycle.html [ Pass Failure ]
 
-webkit.org/b/182571 [ Debug ] media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen.html [ Pass Timeout ]
-
 webkit.org/b/207160 css2.1/20110323/replaced-intrinsic-ratio-001.htm [ Pass Failure ]
 
 webkit.org/b/210351 scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe.html [ Pass Timeout ]

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (261492 => 261493)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2020-05-11 21:03:24 UTC (rev 261493)
@@ -616,7 +616,6 @@
 webkit.org/b/172807 imported/w3c/web-platform-tests/css/selectors/focus-within-display-none-001.html [ Pass Failure ]
 
 webkit.org/b/168409 media/modern-media-controls/airplay-button/airplay-button.html [ Pass Timeout ]
-webkit.org/b/175195 media/modern-media-controls/css/webkit-cursor-visibility-auto-hide.html [ Pass Failure ]
 webkit.org/b/168265 media/modern-media-controls/forward-button/forward-button.html [ Pass Timeout ]
 
 

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (261492 => 261493)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-05-11 21:03:24 UTC (rev 261493)
@@ -341,10 +341,6 @@
 
 webkit.org/b/151709 [ Release ] http/tests/xmlhttprequest/workers/methods.html [ Pass Timeout ]
 
-# Video fullscreen is not implemented for mac wk2 in webkittestrunner
-media/media-fullscreen-loop-inline.html [ Skip ]
-media/media-fullscreen-pause-inline.html [ Skip ]
-
 ### END OF (1) Classified failures with bug reports
 ########################################
 

Modified: trunk/Source/WebCore/ChangeLog (261492 => 261493)


--- trunk/Source/WebCore/ChangeLog	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/Source/WebCore/ChangeLog	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,3 +1,32 @@
+2020-05-11  Peng Liu  <[email protected]>
+
+        Enable the mock video presentation mode in related layout tests and fix test failures
+        https://bugs.webkit.org/show_bug.cgi?id=211645
+
+        Reviewed by Darin Adler.
+
+        Clean up the internal states of video element regarding video presentation mode
+        to simplify the task to write reliable layout tests for video fullscreen and
+        Picture-in-Picture.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::enterFullscreen):
+        Update the states after we are sure the video element will enter fullscreen.
+
+        (WebCore::HTMLMediaElement::exitFullscreen):
+        Remove the unnecessary "fullscreenModeChanged(VideoFullscreenModeNone)".
+
+        * html/HTMLMediaElement.h:
+        (WebCore::HTMLMediaElement::waitingToEnterFullscreen):
+
+        * html/HTMLVideoElement.cpp:
+        (WebCore::HTMLVideoElement::webkitDisplayingFullscreen):
+        The function webkitDisplayingFullscreen() will return true after the process
+        to enter fullscreen is completed.
+
+        * html/HTMLVideoElement.h:
+        Expose didBecomeFullscreenElement() when VIDEO_PRESENTATION_MODE is enabled.
+
 2020-05-11  Antoine Quint  <[email protected]>
 
         [Web Animations] Document.getAnimations() should only consider document connection and not timeline association

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (261492 => 261493)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-05-11 21:03:24 UTC (rev 261493)
@@ -5989,11 +5989,10 @@
     if (m_videoFullscreenMode == mode)
         return;
 
-    m_temporarilyAllowingInlinePlaybackAfterFullscreen = false;
-    m_waitingToEnterFullscreen = true;
-
 #if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_USES_ELEMENT_FULLSCREEN)
     if (document().settings().fullScreenEnabled() && mode == VideoFullscreenModeStandard) {
+        m_temporarilyAllowingInlinePlaybackAfterFullscreen = false;
+        m_waitingToEnterFullscreen = true;
         document().fullscreenManager().requestFullscreenForElement(this, FullscreenManager::ExemptIFrameAllowFullscreenRequirement);
         return;
     }
@@ -6005,12 +6004,16 @@
             return;
         }
 
-        fullscreenModeChanged(mode);
-        configureMediaControls();
         if (is<HTMLVideoElement>(*this)) {
             HTMLVideoElement& asVideo = downcast<HTMLVideoElement>(*this);
-            if (document().page()->chrome().client().supportsVideoFullscreen(m_videoFullscreenMode)) {
-                INFO_LOG(LOGIDENTIFIER, "Entering fullscreen mode ", m_videoFullscreenMode, ", m_videoFullscreenStandby = ", m_videoFullscreenStandby);
+            if (document().page()->chrome().client().supportsVideoFullscreen(mode)) {
+                INFO_LOG(LOGIDENTIFIER, "Entering fullscreen mode ", mode, ", m_videoFullscreenStandby = ", m_videoFullscreenStandby);
+
+                m_temporarilyAllowingInlinePlaybackAfterFullscreen = false;
+                m_waitingToEnterFullscreen = true;
+                fullscreenModeChanged(mode);
+                configureMediaControls();
+
                 document().page()->chrome().client().enterVideoFullscreenForVideoElement(asVideo, m_videoFullscreenMode, m_videoFullscreenStandby);
                 scheduleEvent(eventNames().webkitbeginfullscreenEvent);
             }
@@ -6041,7 +6044,6 @@
 
     ASSERT(m_videoFullscreenMode != VideoFullscreenModeNone);
     VideoFullscreenMode oldVideoFullscreenMode = m_videoFullscreenMode;
-    fullscreenModeChanged(VideoFullscreenModeNone);
     Ref<HTMLMediaElement> protectedThis(*this); // updateMediaControlsAfterPresentationModeChange calls methods that can trigger arbitrary DOM mutations.
     updateMediaControlsAfterPresentationModeChange();
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (261492 => 261493)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2020-05-11 21:03:24 UTC (rev 261493)
@@ -614,6 +614,7 @@
     void updateMediaControlsAfterPresentationModeChange();
 
     void scheduleEvent(const AtomString&);
+    bool waitingToEnterFullscreen() { return m_waitingToEnterFullscreen; }
 
 private:
     void createMediaPlayer();

Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (261492 => 261493)


--- trunk/Source/WebCore/html/HTMLVideoElement.cpp	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp	2020-05-11 21:03:24 UTC (rev 261493)
@@ -346,7 +346,7 @@
 
 bool HTMLVideoElement::webkitDisplayingFullscreen()
 {
-    return isFullscreen();
+    return isFullscreen() && !waitingToEnterFullscreen();
 }
 
 void HTMLVideoElement::ancestorWillEnterFullscreen()
@@ -523,7 +523,6 @@
     HTMLMediaElement::fullscreenModeChanged(mode);
 }
 
-#if ENABLE(PICTURE_IN_PICTURE_API)
 void HTMLVideoElement::didBecomeFullscreenElement()
 {
     m_isFullscreen = true;
@@ -531,6 +530,7 @@
     HTMLMediaElement::didBecomeFullscreenElement();
 }
 
+#if ENABLE(PICTURE_IN_PICTURE_API)
 void HTMLVideoElement::setPictureInPictureObserver(PictureInPictureObserver* observer)
 {
     m_pictureInPictureObserver = observer;

Modified: trunk/Source/WebCore/html/HTMLVideoElement.h (261492 => 261493)


--- trunk/Source/WebCore/html/HTMLVideoElement.h	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/Source/WebCore/html/HTMLVideoElement.h	2020-05-11 21:03:24 UTC (rev 261493)
@@ -88,9 +88,9 @@
     VideoPresentationMode webkitPresentationMode() const;
     void setFullscreenMode(VideoFullscreenMode);
     void fullscreenModeChanged(VideoFullscreenMode) final;
+    WEBCORE_EXPORT void didBecomeFullscreenElement() final;
 
 #if ENABLE(PICTURE_IN_PICTURE_API)
-    WEBCORE_EXPORT void didBecomeFullscreenElement() final;
     void setPictureInPictureObserver(PictureInPictureObserver*);
     WEBCORE_EXPORT void setPictureInPictureAPITestEnabled(bool);
 #endif

Modified: trunk/Source/WebKit/ChangeLog (261492 => 261493)


--- trunk/Source/WebKit/ChangeLog	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/Source/WebKit/ChangeLog	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,3 +1,15 @@
+2020-05-11  Peng Liu  <[email protected]>
+
+        Enable the mock video presentation mode in related layout tests and fix test failures
+        https://bugs.webkit.org/show_bug.cgi?id=211645
+
+        Reviewed by Darin Adler.
+
+        Fix the mistake in VideoFullscreenManager::supportsVideoFullscreen() introduced in r202274.
+
+        * WebProcess/cocoa/VideoFullscreenManager.mm:
+        (WebKit::VideoFullscreenManager::supportsVideoFullscreen const):
+
 2020-05-11  Per Arne Vollan  <[email protected]>
 
         [iOS] Update message filtering rules in the WebContent process' sandbox

Modified: trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm (261492 => 261493)


--- trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm	2020-05-11 21:03:24 UTC (rev 261493)
@@ -223,7 +223,7 @@
     UNUSED_PARAM(mode);
     return DeprecatedGlobalSettings::avKitEnabled();
 #else
-    return mode == HTMLMediaElementEnums::VideoFullscreenModePictureInPicture && supportsPictureInPicture();
+    return mode == HTMLMediaElementEnums::VideoFullscreenModeStandard || (mode == HTMLMediaElementEnums::VideoFullscreenModePictureInPicture && supportsPictureInPicture());
 #endif
 }
 

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (261492 => 261493)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-05-11 21:03:24 UTC (rev 261493)
@@ -1,3 +1,18 @@
+2020-05-11  Peng Liu  <[email protected]>
+
+        Enable the mock video presentation mode in related layout tests and fix test failures
+        https://bugs.webkit.org/show_bug.cgi?id=211645
+
+        Reviewed by Darin Adler.
+
+        Call HTMLVideoElement::didBecomeFullscreenElement() after a video element enters
+        fullscreen (to be consistent with WK2).
+
+        * WebView/WebVideoFullscreenController.mm:
+        (-[WebVideoFullscreenController windowDidEnterFullScreen:]):
+        * WebView/WebView.mm:
+        (-[WebView _enterVideoFullscreenForVideoElement:mode:]):
+
 2020-05-07  Darin Adler  <[email protected]>
 
         Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm (261492 => 261493)


--- trunk/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm	2020-05-11 21:03:24 UTC (rev 261493)
@@ -312,6 +312,8 @@
     [_playerView willChangeValueForKey:@"isFullScreen"];
     _isFullScreen = YES;
     [_playerView didChangeValueForKey:@"isFullScreen"];
+    if (_videoElement)
+        _videoElement->didBecomeFullscreenElement();
 }
 
 - (void)windowWillExitFullScreen:(NSNotification *)notification

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (261492 => 261493)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-05-11 20:32:19 UTC (rev 261492)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-05-11 21:03:24 UTC (rev 261493)
@@ -9269,8 +9269,10 @@
 
 - (void)_enterVideoFullscreenForVideoElement:(NakedPtr<WebCore::HTMLVideoElement>)videoElement mode:(WebCore::HTMLMediaElementEnums::VideoFullscreenMode)mode
 {
-    if (_private->mockVideoPresentationModeEnabled)
+    if (_private->mockVideoPresentationModeEnabled) {
+        videoElement->didBecomeFullscreenElement();
         return;
+    }
 
     if (_private->fullscreenController) {
         if ([_private->fullscreenController videoElement] == videoElement) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to