Diff
Modified: trunk/LayoutTests/ChangeLog (268864 => 268865)
--- trunk/LayoutTests/ChangeLog 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/ChangeLog 2020-10-22 15:22:39 UTC (rev 268865)
@@ -1,3 +1,34 @@
+2020-10-22 Peng Liu <[email protected]>
+
+ Let webkitDisplayingFullscreen() return true when a video element’s fullscreen mode is not VideoFullscreenModeNone
+ https://bugs.webkit.org/show_bug.cgi?id=216426
+
+ Reviewed by Jer Noble.
+
+ Check Internals::isChangingPresentationMode instead of HTMLVideoElement::webkitDisplayingFullscreen
+ to confirm the video presentation mode change is completed before moving to the next step of a test.
+
+ * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt:
+ * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html:
+ * media/context-menu-actions.html:
+ * media/media-fullscreen-loop-inline-expected.txt:
+ * media/media-fullscreen-loop-inline.html:
+ * media/media-fullscreen-pause-inline-expected.txt:
+ * media/media-fullscreen-pause-inline.html:
+ * media/media-fullscreen-return-to-inline-expected.txt:
+ * media/media-fullscreen-return-to-inline.html:
+ * media/presentationmodechanged-fired-once-expected.txt:
+ * media/presentationmodechanged-fired-once.html:
+ * media/video-fullscreen-only-playback-expected.txt:
+ * media/video-fullscreen-only-playback.html:
+ * media/video-playsinline-expected.txt:
+ * media/video-playsinline.html:
+ * media/video-presentation-mode-expected.txt:
+ * media/video-presentation-mode.html:
+ * media/video-webkit-playsinline-expected.txt:
+ * media/video-webkit-playsinline.html:
+ * platform/mac/TestExpectations:
+
2020-10-22 Antti Koivisto <[email protected]>
[LFC][Integration] Lines with outline should be marked having visual overflow
Modified: trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt (268864 => 268865)
--- trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast-expected.txt 2020-10-22 15:22:39 UTC (rev 268865)
@@ -3,7 +3,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS media.webkitDisplayingFullscreen became true
+PASS media.webkitDisplayingFullscreen is 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 (268864 => 268865)
--- trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -15,18 +15,17 @@
const mediaController = createControls(shadowRoot, media, null);
media.addEventListener("webkitfullscreenchange", () => {
- 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");
+ shouldBeTrue("media.webkitDisplayingFullscreen");
+ 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/context-menu-actions.html (268864 => 268865)
--- trunk/LayoutTests/media/context-menu-actions.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/context-menu-actions.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -1,87 +1,86 @@
+<!DOCTYPE html>
<html>
<head>
- <script src=""
- <script src=""
- <script>
-
- async function playing()
- {
- if (window.testRunner) {
- if (!window.eventSender) {
- testRunner.dumpAsText();
- endTest();
- return;
- }
- } else {
+ <script src=""
+ <script src=""
+ <script>
+ async function playing()
+ {
+ if (window.testRunner) {
+ if (!window.eventSender) {
+ testRunner.dumpAsText();
endTest();
return;
}
+ } else {
+ endTest();
+ return;
+ }
- findMediaElement();
+ findMediaElement();
- var x, y, items;
- x = video.offsetParent.offsetLeft + video.offsetLeft + video.offsetWidth / 2;
- y = video.offsetParent.offsetTop + video.offsetTop + video.offsetHeight / 2;
- eventSender.mouseMoveTo(x, y);
- items = eventSender.contextClick();
+ var x, y, items;
+ x = video.offsetParent.offsetLeft + video.offsetLeft + video.offsetWidth / 2;
+ y = video.offsetParent.offsetTop + video.offsetTop + video.offsetHeight / 2;
+ eventSender.mouseMoveTo(x, y);
+ items = eventSender.contextClick();
+ for (var i = 0; i < items.length; i++)
+ {
+ if (items[i].title.match("Controls")) {
+ testExpected("video.controls", true, '==');
+ consoleWrite("Toggling media controls");
+ items[i].click();
+ testExpected("video.controls", false, '==');
+ consoleWrite("");
+ }
- for (var i = 0; i < items.length; i++)
- {
- if (items[i].title.match("Controls")) {
- testExpected("video.controls", true, '==');
- consoleWrite("Toggling media controls");
- items[i].click();
- testExpected("video.controls", false, '==');
- consoleWrite("");
- }
+ if (items[i].title.match("Pause")) {
+ testExpected("video.paused", false, '==');
+ consoleWrite("Toggling play state");
+ items[i].click();
+ testExpected("video.paused", true, '==');
+ consoleWrite("");
+ }
- if (items[i].title.match("Pause")) {
- testExpected("video.paused", false, '==');
- consoleWrite("Toggling play state");
- items[i].click();
- testExpected("video.paused", true, '==');
- consoleWrite("");
- }
+ if (items[i].title.match("Loop")) {
+ testExpected("video.loop", false, '==');
+ consoleWrite("Toggling loop state");
+ items[i].click();
+ testExpected("video.loop", true, '==');
+ consoleWrite("");
+ }
- if (items[i].title.match("Loop")) {
- testExpected("video.loop", false, '==');
- consoleWrite("Toggling loop state");
- items[i].click();
- testExpected("video.loop", true, '==');
- consoleWrite("");
- }
+ if (items[i].title.match("Mute")) {
+ testExpected("video.muted", false, '==');
+ consoleWrite("Toggling mute state");
+ items[i].click();
+ testExpected("video.muted", true, '==');
+ consoleWrite("");
+ }
- if (items[i].title.match("Mute")) {
- testExpected("video.muted", false, '==');
- consoleWrite("Toggling mute state");
- items[i].click();
- testExpected("video.muted", true, '==');
- consoleWrite("");
- }
+ if (items[i].title.match("Fullscreen") && video.webkitSupportsFullscreen) {
+ testExpected("video.webkitDisplayingFullscreen", false, '==');
+ consoleWrite("Toggling fullscreen state");
+ items[i].click();
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false, '==', 1000);
+ testExpected("video.webkitDisplayingFullscreen", true, '==');
+ consoleWrite("");
+ }
- if (items[i].title.match("Fullscreen") && video.webkitSupportsFullscreen) {
- testExpected("video.webkitDisplayingFullscreen", false, '==');
- consoleWrite("Toggling fullscreen state");
- items[i].click();
- await testExpectedEventually("video.webkitDisplayingFullscreen", true, "==", 1000);
- consoleWrite("");
- }
-
- // TODO: test copy link location and open in new window.
- }
- testRunner.dumpAsText();
- endTest();
+ // TODO: test copy link location and open in new window.
}
+ testRunner.dumpAsText();
+ endTest();
+ }
- async function start()
- {
- findMediaElement();
- waitForEvent('play', playing);
- run("video.src = ''");
- }
-
- </script>
+ async function start()
+ {
+ findMediaElement();
+ waitForEvent('play', playing);
+ run("video.src = ''");
+ }
+ </script>
</head>
<body _onload_="start()">
<p>Test the various actions available in the HTML5 media element context-menu.</p>
Modified: trunk/LayoutTests/media/media-fullscreen-loop-inline-expected.txt (268864 => 268865)
--- trunk/LayoutTests/media/media-fullscreen-loop-inline-expected.txt 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/media-fullscreen-loop-inline-expected.txt 2020-10-22 15:22:39 UTC (rev 268865)
@@ -7,6 +7,7 @@
RUN(video.play())
Wait to enter fullscreen
EVENT(webkitpresentationmodechanged)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
Entered fullscreen
RUN(video.currentTime = 5)
@@ -13,6 +14,7 @@
RUN(video.webkitExitFullscreen())
Wait to exit fullscreen
EVENT(webkitpresentationmodechanged)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
Exited fullscreen
EXPECTED (video.paused == 'false') OK
Modified: trunk/LayoutTests/media/media-fullscreen-loop-inline.html (268864 => 268865)
--- trunk/LayoutTests/media/media-fullscreen-loop-inline.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/media-fullscreen-loop-inline.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -35,7 +35,8 @@
async function beginfullscreen()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', true);
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ testExpected('video.webkitDisplayingFullscreen', true);
consoleWrite("Entered fullscreen");
run('video.currentTime = 5');
run('video.webkitExitFullscreen()');
@@ -45,7 +46,8 @@
async function endfullscreen()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', false);
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ testExpected('video.webkitDisplayingFullscreen', false);
consoleWrite("Exited fullscreen");
testExpected('video.paused', false);
run('video._ontimeupdate_ = timeupdate');
Modified: trunk/LayoutTests/media/media-fullscreen-pause-inline-expected.txt (268864 => 268865)
--- trunk/LayoutTests/media/media-fullscreen-pause-inline-expected.txt 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/media-fullscreen-pause-inline-expected.txt 2020-10-22 15:22:39 UTC (rev 268865)
@@ -4,9 +4,11 @@
RUN(video.src = "" "content/test"))
EVENT(canplaythrough)
RUN(video.play().then(playing);)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
RUN(video.webkitExitFullscreen())
EVENT(webkitpresentationmodechanged)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
EXPECTED (video.paused == 'false') OK
RUN(video.pause())
@@ -13,6 +15,7 @@
EVENT(pause)
EXPECTED (video.paused == 'true') OK
RUN(video.play().then(playingAgain))
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
END OF TEST
Modified: trunk/LayoutTests/media/media-fullscreen-pause-inline.html (268864 => 268865)
--- trunk/LayoutTests/media/media-fullscreen-pause-inline.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/media-fullscreen-pause-inline.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -33,7 +33,8 @@
async function playing()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', true);
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ testExpected('video.webkitDisplayingFullscreen', true);
waitForEventOnce('webkitpresentationmodechanged', endfullscreen);
run('video.webkitExitFullscreen()');
}
@@ -40,7 +41,8 @@
async function endfullscreen()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', false);
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ testExpected('video.webkitDisplayingFullscreen', false);
testExpected('video.paused', false);
waitForEventOnce('pause', paused);
run('video.pause()');
@@ -54,7 +56,8 @@
async function playingAgain()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', true);
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ testExpected('video.webkitDisplayingFullscreen', true);
endTest();
}
</script>
Modified: trunk/LayoutTests/media/media-fullscreen-return-to-inline-expected.txt (268864 => 268865)
--- trunk/LayoutTests/media/media-fullscreen-return-to-inline-expected.txt 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/media-fullscreen-return-to-inline-expected.txt 2020-10-22 15:22:39 UTC (rev 268865)
@@ -5,16 +5,20 @@
EVENT(canplaythrough)
RUN(video.play())
EVENT(webkitpresentationmodechanged)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
RUN(video.webkitExitFullscreen())
-EVENT(pause)
+EVENT(webkitpresentationmodechanged)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
EXPECTED (video.paused == 'true') OK
RUN(video.play())
EVENT(webkitpresentationmodechanged)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
RUN(video.webkitExitFullscreen())
EVENT(webkitpresentationmodechanged)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
EXPECTED (video.paused == 'false') OK
END OF TEST
Modified: trunk/LayoutTests/media/media-fullscreen-return-to-inline.html (268864 => 268865)
--- trunk/LayoutTests/media/media-fullscreen-return-to-inline.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/media-fullscreen-return-to-inline.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -34,14 +34,16 @@
async function beginfullscreen1()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', true);
- waitForEventOnce('pause', pause);
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ testExpected('video.webkitDisplayingFullscreen', true);
+ waitForEventOnce('webkitpresentationmodechanged', endfullscreen1);
run('video.webkitExitFullscreen()');
}
- async function pause()
+ async function endfullscreen1()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', false);
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ testExpected('video.webkitDisplayingFullscreen', false);
testExpected('video.paused', true);
internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true);
@@ -52,14 +54,16 @@
async function beginfullscreen2()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', true);
- waitForEventOnce('webkitpresentationmodechanged', endfullscreen);
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ testExpected('video.webkitDisplayingFullscreen', true);
+ waitForEventOnce('webkitpresentationmodechanged', endfullscreen2);
run('video.webkitExitFullscreen()');
}
- async function endfullscreen()
+ async function endfullscreen2()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', false);
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ testExpected('video.webkitDisplayingFullscreen', false);
testExpected('video.paused', false);
endTest();
}
Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline-expected.txt (268864 => 268865)
--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline-expected.txt 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline-expected.txt 2020-10-22 15:22:39 UTC (rev 268865)
@@ -8,18 +8,18 @@
Media started playing, we pause it and enter fullscreen by clicking on the matching button.
Media received a webkitpresentationmodechanged event, media.webkitPresentationMode = fullscreen.
-PASS media.webkitDisplayingFullscreen became true
+PASS internals.isChangingPresentationMode(media) became false
PASS shadowRoot.querySelector('.media-controls').classList.contains('fullscreen') is true
We enter picture-in-picture by clicking on the matching button.
Media received a webkitpresentationmodechanged event, media.webkitPresentationMode = picture-in-picture.
-PASS media.webkitDisplayingFullscreen became true
+PASS internals.isChangingPresentationMode(media) became false
We exit picture-in-picture.
Media received a webkitpresentationmodechanged event, media.webkitPresentationMode = inline.
-PASS media.webkitDisplayingFullscreen became false
+PASS internals.isChangingPresentationMode(media) became false
PASS shadowRoot.querySelector('.media-controls').classList.contains('inline') is true
PASS successfullyParsed is true
Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html (268864 => 268865)
--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -26,46 +26,42 @@
window.requestAnimationFrame(() => clickOnElement(shadowRoot.querySelector("button.fullscreen")));
});
-let previousPresentationMode = media.webkitPresentationMode;
-media.addEventListener("webkitpresentationmodechanged", () => {
- if (previousPresentationMode === media.webkitPresentationMode)
- return;
-
+media.addEventListener("webkitpresentationmodechanged", async () => {
debug("");
debug(`Media received a webkitpresentationmodechanged event, media.webkitPresentationMode = ${media.webkitPresentationMode}.`);
- let displayingFullscreen = "true";
- if (media.webkitPresentationMode == "inline")
- displayingFullscreen = "false";
+ if (window.internals) {
+ await new Promise((resolve, reject) => {
+ setTimeout(reject, 2000);
+ shouldBecomeEqual("internals.isChangingPresentationMode(media)", "false", resolve);
+ });
+ }
- shouldBecomeEqual("media.webkitDisplayingFullscreen", displayingFullscreen, () => {
- previousPresentationMode = media.webkitPresentationMode;
- switch (media.webkitPresentationMode) {
- case "fullscreen":
- window.requestAnimationFrame(() => {
- shouldBeTrue("shadowRoot.querySelector('.media-controls').classList.contains('fullscreen')");
+ switch (media.webkitPresentationMode) {
+ case "fullscreen":
+ window.requestAnimationFrame(() => {
+ shouldBeTrue("shadowRoot.querySelector('.media-controls').classList.contains('fullscreen')");
- debug("");
- debug("We enter picture-in-picture by clicking on the matching button.");
- clickOnElement(shadowRoot.querySelector("button.pip"));
- });
- break;
- case "picture-in-picture":
debug("");
- debug("We exit picture-in-picture.");
- window.setTimeout(() => media.webkitSetPresentationMode("inline"));
- break;
- case "inline":
- window.requestAnimationFrame(() => {
- shouldBeTrue("shadowRoot.querySelector('.media-controls').classList.contains('inline')");
+ debug("We enter picture-in-picture by clicking on the matching button.");
+ clickOnElement(shadowRoot.querySelector("button.pip"));
+ });
+ break;
+ case "picture-in-picture":
+ debug("");
+ debug("We exit picture-in-picture.");
+ window.setTimeout(() => media.webkitSetPresentationMode("inline"));
+ break;
+ case "inline":
+ window.requestAnimationFrame(() => {
+ shouldBeTrue("shadowRoot.querySelector('.media-controls').classList.contains('inline')");
- debug("");
- media.remove();
- finishJSTest();
- });
- break;
- }
- });
+ debug("");
+ media.remove();
+ finishJSTest();
+ });
+ break;
+ }
});
function clickOnElement(element)
Modified: trunk/LayoutTests/media/presentationmodechanged-fired-once-expected.txt (268864 => 268865)
--- trunk/LayoutTests/media/presentationmodechanged-fired-once-expected.txt 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/presentationmodechanged-fired-once-expected.txt 2020-10-22 15:22:39 UTC (rev 268865)
@@ -5,7 +5,7 @@
RUN(video.play())
RUN(video.webkitSetPresentationMode("picture-in-picture"))
EVENT(webkitpresentationmodechanged)
-EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitPresentationMode == 'picture-in-picture') OK
RUN(video.webkitSetPresentationMode("inline"))
EVENT(webkitpresentationmodechanged)
Modified: trunk/LayoutTests/media/presentationmodechanged-fired-once.html (268864 => 268865)
--- trunk/LayoutTests/media/presentationmodechanged-fired-once.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/presentationmodechanged-fired-once.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -27,7 +27,7 @@
async function presentationModeChanged1()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', true);
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
testExpected("video.webkitPresentationMode", "picture-in-picture");
runWithKeyDown('video.webkitSetPresentationMode("inline")');
waitForEvent("webkitpresentationmodechanged", presentationModeChanged2);
Modified: trunk/LayoutTests/media/video-fullscreen-only-playback-expected.txt (268864 => 268865)
--- trunk/LayoutTests/media/video-fullscreen-only-playback-expected.txt 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/video-fullscreen-only-playback-expected.txt 2020-10-22 15:22:39 UTC (rev 268865)
@@ -7,13 +7,16 @@
EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
RUN(video.play())
EVENT(playing)
+
+** Started playing
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
-
-** Entered fullscreen
RUN(video.webkitExitFullScreen())
EVENT(webkitpresentationmodechanged)
+
+** Received webkitpresentationmodechanged event
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
+Exited fullscreen
EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
-
-** Exited fullscreen
END OF TEST
Modified: trunk/LayoutTests/media/video-fullscreen-only-playback.html (268864 => 268865)
--- trunk/LayoutTests/media/video-fullscreen-only-playback.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/video-fullscreen-only-playback.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -40,8 +40,9 @@
async function playing()
{
- await testExpectedEventually("video.webkitDisplayingFullscreen", true);
- consoleWrite("<br>** Entered fullscreen");
+ consoleWrite("<br>** Started playing");
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ testExpected("video.webkitDisplayingFullscreen", true);
waitForEventOnce('webkitpresentationmodechanged', endfullscreen);
run("video.webkitExitFullScreen()");
}
@@ -48,8 +49,10 @@
async function endfullscreen()
{
- await testExpectedEventually("video.webkitDisplayingFullscreen", false);
- consoleWrite("<br>** Exited fullscreen");
+ consoleWrite("<br>** Received webkitpresentationmodechanged event");
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
+ consoleWrite("Exited fullscreen");
+ testExpected("video.webkitDisplayingFullscreen", false);
endTest();
}
</script>
Modified: trunk/LayoutTests/media/video-playsinline-expected.txt (268864 => 268865)
--- trunk/LayoutTests/media/video-playsinline-expected.txt 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/video-playsinline-expected.txt 2020-10-22 15:22:39 UTC (rev 268865)
@@ -3,6 +3,7 @@
EVENT(canplaythrough)
RUN(video.play())
EVENT(playing)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
RUN(internals.settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(true))
RUN(video.playsInline = true)
Modified: trunk/LayoutTests/media/video-playsinline.html (268864 => 268865)
--- trunk/LayoutTests/media/video-playsinline.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/video-playsinline.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -30,7 +30,10 @@
run('video.play()');
});
})
- waitForEventOnce('playing', () => {
+ waitForEventOnce('playing', async () => {
+ if (expectedDisplayingFullscreen)
+ await testExpectedEventually('internals.isChangingPresentationMode(video)', false);
+
testExpected('video.webkitDisplayingFullscreen', expectedDisplayingFullscreen);
document.body.removeChild(video);
runNextTest();
Modified: trunk/LayoutTests/media/video-presentation-mode-expected.txt (268864 => 268865)
--- trunk/LayoutTests/media/video-presentation-mode-expected.txt 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/video-presentation-mode-expected.txt 2020-10-22 15:22:39 UTC (rev 268865)
@@ -4,30 +4,30 @@
EVENT(canplaythrough)
EXPECTED (video.webkitSupportsFullscreen == 'true') OK
-EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
+EXPECTED (video.webkitPresentationMode == 'inline') OK
** Try to enter fullscreen
RUN(video.webkitSetPresentationMode('fullscreen'))
EVENT(webkitpresentationmodechanged)
-EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
-** Entered fullscreen
+** Received webkitpresentationmodechanged event
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
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
+** Received webkitpresentationmodechanged event
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
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
+** Received webkitpresentationmodechanged event
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitPresentationMode == 'inline') OK
** Test Completed
Modified: trunk/LayoutTests/media/video-presentation-mode.html (268864 => 268865)
--- trunk/LayoutTests/media/video-presentation-mode.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/video-presentation-mode.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -21,7 +21,7 @@
async function canplaythrough()
{
testExpected("video.webkitSupportsFullscreen", true);
- await testExpectedEventually('video.webkitDisplayingFullscreen', false);
+ testExpected("video.webkitPresentationMode", "inline");
consoleWrite("<br>** Try to enter fullscreen");
runWithKeyDown("video.webkitSetPresentationMode('fullscreen')");
@@ -30,8 +30,8 @@
async function presentationModeChanged1()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', true);
- consoleWrite("<br>** Entered fullscreen");
+ consoleWrite("<br>** Received webkitpresentationmodechanged event");
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
testExpected("video.webkitPresentationMode", "fullscreen");
consoleWrite("<br>** Try to enter picture-in-picture");
waitForEventOnce('webkitpresentationmodechanged', presentationModeChanged2);
@@ -40,8 +40,8 @@
async function presentationModeChanged2()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', true);
- consoleWrite("<br>** Entered picture-in-picture");
+ consoleWrite("<br>** Received webkitpresentationmodechanged event");
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
testExpected("video.webkitPresentationMode", "picture-in-picture");
consoleWrite("<br>** Try to return to inline");
waitForEventOnce('webkitpresentationmodechanged', testCompleted);
@@ -50,8 +50,8 @@
async function testCompleted()
{
- await testExpectedEventually('video.webkitDisplayingFullscreen', false);
- consoleWrite("<br>** Returned to inline");
+ consoleWrite("<br>** Received webkitpresentationmodechanged event");
+ await testExpectedEventually("internals.isChangingPresentationMode(video)", false);
testExpected("video.webkitPresentationMode", "inline");
consoleWrite("<br>** Test Completed");
endTest();
Modified: trunk/LayoutTests/media/video-webkit-playsinline-expected.txt (268864 => 268865)
--- trunk/LayoutTests/media/video-webkit-playsinline-expected.txt 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/video-webkit-playsinline-expected.txt 2020-10-22 15:22:39 UTC (rev 268865)
@@ -3,6 +3,7 @@
EVENT(canplaythrough)
RUN(video.play())
EVENT(playing)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
RUN(internals.settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(true))
RUN(video.setAttribute("webkit-playsinline", ""))
@@ -9,6 +10,7 @@
EVENT(canplaythrough)
RUN(video.play())
EVENT(playing)
+EXPECTED (internals.isChangingPresentationMode(video) == 'false') OK
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
RUN(internals.settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(false))
RUN(video.removeAttribute("webkit-playsinline", ""))
Modified: trunk/LayoutTests/media/video-webkit-playsinline.html (268864 => 268865)
--- trunk/LayoutTests/media/video-webkit-playsinline.html 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/media/video-webkit-playsinline.html 2020-10-22 15:22:39 UTC (rev 268865)
@@ -30,7 +30,10 @@
run('video.play()');
});
})
- waitForEventOnce('playing', () => {
+ waitForEventOnce('playing', async () => {
+ if (expectedDisplayingFullscreen)
+ await testExpectedEventually('internals.isChangingPresentationMode(video)', false);
+
testExpected('video.webkitDisplayingFullscreen', expectedDisplayingFullscreen);
document.body.removeChild(video);
runNextTest();
Modified: trunk/LayoutTests/platform/mac/TestExpectations (268864 => 268865)
--- trunk/LayoutTests/platform/mac/TestExpectations 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2020-10-22 15:22:39 UTC (rev 268865)
@@ -1458,8 +1458,6 @@
webkit.org/b/183490 media/modern-media-controls/media-controller/media-controller-fullscreen-change.html [ Failure ]
webkit.org/b/183490 media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html [ Failure ]
webkit.org/b/183490 media/modern-media-controls/start-support/start-support-fullscreen.html [ Failure ]
-webkit.org/b/183490 media/video-playsinline.html [ Failure ]
-webkit.org/b/183490 media/video-webkit-playsinline.html [ Failure ]
webkit.org/b/183764 fast/css/apple-system-control-colors.html [ Pass ]
Modified: trunk/Source/WebCore/ChangeLog (268864 => 268865)
--- trunk/Source/WebCore/ChangeLog 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/Source/WebCore/ChangeLog 2020-10-22 15:22:39 UTC (rev 268865)
@@ -1,3 +1,62 @@
+2020-10-22 Peng Liu <[email protected]>
+
+ Let webkitDisplayingFullscreen() return true when a video element’s fullscreen mode is not VideoFullscreenModeNone
+ https://bugs.webkit.org/show_bug.cgi?id=216426
+
+ Reviewed by Jer Noble.
+
+ This patch moves m_changingVideoFullscreenMode of HTMLVideoElement to HTMLMediaElement.
+ The flag is used to protect interfaces regarding video presentation mode changes.
+ It also guards the code path when we use element fullscreen to implement video
+ fullscreen (VIDEO_USES_ELEMENT_FULLSCREEN). It is better to store the flag in
+ HTMLMediaElement to have fine control.
+
+ This patch reverts the changing regarding HTMLVideoElement::webkitDisplayingFullscreen
+ in r262456. This function will return true in the same run loop as a
+ webkitpresentationmodechanged event is fired when a video element is entering
+ fullscreen or picture-in-picture.
+
+ Also, this patch adds Internals::isChangingPresentationMode which can be used by
+ layout tests to check whether a video presentation mode change is completed.
+
+ Covered by existing tests.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::isFullscreen const): Align the implementation
+ with isStandardFullscreen().
+ (WebCore::HTMLMediaElement::enterFullscreen): Set m_changingVideoFullscreenMode to true
+ if the video element is changing presentation mode. Also fix a bug about the
+ flag m_waitingToEnterFullscreen.
+ (WebCore::HTMLMediaElement::exitFullscreen): Ditto.
+ (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto.
+ (WebCore::HTMLMediaElement::didStopBeingFullscreenElement): Ditto.
+
+ * html/HTMLMediaElement.h:
+ (WebCore::HTMLMediaElement::setChangingVideoFullscreenMode):
+ (WebCore::HTMLMediaElement::isChangingVideoFullscreenMode const):
+ (WebCore::HTMLMediaElement::waitingToEnterFullscreen): Deleted.
+
+ * html/HTMLVideoElement.cpp:
+ (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Revert the change
+ in r262456. Some web sites expect this function to return true if the video element
+ is entering fullscreen and the event webkitpresentationmodechanged is fired.
+ (WebCore::HTMLVideoElement::setPresentationMode): Remove code regarding m_isChangingVideoFullscreenMode.
+ (WebCore::HTMLVideoElement::didEnterFullscreenOrPictureInPicture): Fix an event firing issue when
+ a video element is entering fullscreen while exiting picture-in-picture.
+ (WebCore::HTMLVideoElement::didExitFullscreenOrPictureInPicture): Fix an event firing issue when
+ a video element is exiting picture-in-picture.
+ (WebCore::HTMLVideoElement::isChangingPresentationMode const): This interface
+ is used by layout tests (through Internals) to check whether a video presentation
+ mode change is completed.
+ (WebCore::HTMLVideoElement::didBecomeFullscreenElement): Deleted.
+ * html/HTMLVideoElement.h:
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::isChangingPresentationMode const): This interface is used
+ by layout tests to check whether a video presentation mode change is completed.
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2020-10-22 Zalan Bujtas <[email protected]>
[LFC][IFC] Handle line box sizing quirks at the line box level
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (268864 => 268865)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2020-10-22 15:22:39 UTC (rev 268865)
@@ -5870,15 +5870,12 @@
bool HTMLMediaElement::isFullscreen() const
{
- if (m_videoFullscreenMode != VideoFullscreenModeNone)
- return true;
-
#if ENABLE(FULLSCREEN_API)
if (document().fullscreenManager().isFullscreen() && document().fullscreenManager().currentFullscreenElement() == this)
return true;
#endif
- return false;
+ return m_videoFullscreenMode != VideoFullscreenModeNone;
}
bool HTMLMediaElement::isStandardFullscreen() const
@@ -5910,6 +5907,8 @@
if (m_waitingToEnterFullscreen)
return;
+ m_changingVideoFullscreenMode = true;
+
#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_USES_ELEMENT_FULLSCREEN)
if (document().settings().fullScreenEnabled() && mode == VideoFullscreenModeStandard) {
m_temporarilyAllowingInlinePlaybackAfterFullscreen = false;
@@ -5922,6 +5921,7 @@
m_fullscreenTaskQueue.enqueueTask([this, mode] {
if (document().hidden()) {
ALWAYS_LOG(LOGIDENTIFIER, " returning because document is hidden");
+ m_changingVideoFullscreenMode = false;
return;
}
@@ -5931,7 +5931,9 @@
ALWAYS_LOG(LOGIDENTIFIER, "Entering fullscreen mode ", mode, ", m_videoFullscreenStandby = ", m_videoFullscreenStandby);
m_temporarilyAllowingInlinePlaybackAfterFullscreen = false;
- m_waitingToEnterFullscreen = true;
+ if (mode == VideoFullscreenModeStandard)
+ m_waitingToEnterFullscreen = true;
+
auto oldMode = m_videoFullscreenMode;
setFullscreenMode(mode);
configureMediaControls();
@@ -5944,8 +5946,12 @@
scheduleEvent(eventNames().webkitbeginfullscreenEvent);
else if (oldMode == VideoFullscreenModeStandard)
scheduleEvent(eventNames().webkitendfullscreenEvent);
+
+ return;
}
}
+
+ m_changingVideoFullscreenMode = false;
});
}
@@ -5962,8 +5968,10 @@
#if ENABLE(FULLSCREEN_API)
if (document().settings().fullScreenEnabled() && document().fullscreenManager().currentFullscreenElement() == this) {
- if (document().fullscreenManager().isFullscreen())
+ if (document().fullscreenManager().isFullscreen()) {
+ m_changingVideoFullscreenMode = true;
document().fullscreenManager().cancelFullscreen();
+ }
if (m_videoFullscreenMode == VideoFullscreenModeStandard)
return;
@@ -5991,14 +5999,18 @@
if (document().activeDOMObjectsAreSuspended() || document().activeDOMObjectsAreStopped()) {
setFullscreenMode(VideoFullscreenModeNone);
+ m_changingVideoFullscreenMode = true;
document().page()->chrome().client().exitVideoFullscreenToModeWithoutAnimation(downcast<HTMLVideoElement>(*this), VideoFullscreenModeNone);
} else if (document().page()->chrome().client().supportsVideoFullscreen(oldVideoFullscreenMode)) {
if (m_videoFullscreenStandby) {
setFullscreenMode(VideoFullscreenModeNone);
+ m_changingVideoFullscreenMode = true;
document().page()->chrome().client().enterVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this), m_videoFullscreenMode, m_videoFullscreenStandby);
return;
}
+ m_changingVideoFullscreenMode = true;
+
if (oldVideoFullscreenMode == VideoFullscreenModeStandard) {
setFullscreenMode(VideoFullscreenModeNone);
// The exit fullscreen request will be sent in dispatchEvent().
@@ -6070,6 +6082,7 @@
{
ALWAYS_LOG(LOGIDENTIFIER, ", fullscreen mode = ", fullscreenMode());
m_waitingToEnterFullscreen = false;
+ m_changingVideoFullscreenMode = false;
scheduleUpdatePlayState();
}
@@ -6079,6 +6092,11 @@
setFullscreenMode(VideoFullscreenModeNone);
}
+void HTMLMediaElement::didStopBeingFullscreenElement()
+{
+ m_changingVideoFullscreenMode = false;
+}
+
PlatformLayer* HTMLMediaElement::platformLayer() const
{
return m_player ? m_player->platformLayer() : nullptr;
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (268864 => 268865)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2020-10-22 15:22:39 UTC (rev 268865)
@@ -544,8 +544,9 @@
bool isSuspended() const final;
- WEBCORE_EXPORT void didBecomeFullscreenElement() override;
+ WEBCORE_EXPORT void didBecomeFullscreenElement() final;
WEBCORE_EXPORT void willExitFullscreen();
+ WEBCORE_EXPORT void didStopBeingFullscreenElement() final;
#if ENABLE(PICTURE_IN_PICTURE_API)
void scheduleEvent(Ref<Event>&&);
@@ -603,8 +604,10 @@
void updateMediaControlsAfterPresentationModeChange();
void scheduleEvent(const AtomString&);
- bool waitingToEnterFullscreen() { return m_waitingToEnterFullscreen; }
+ void setChangingVideoFullscreenMode(bool value) { m_changingVideoFullscreenMode = value; }
+ bool isChangingVideoFullscreenMode() const { return m_changingVideoFullscreenMode; }
+
private:
void createMediaPlayer();
@@ -1091,6 +1094,7 @@
bool m_isScrubbingRemotely : 1;
bool m_waitingToEnterFullscreen : 1;
+ bool m_changingVideoFullscreenMode : 1;
bool m_tracksAreReady : 1;
bool m_haveVisibleTextTrack : 1;
Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (268864 => 268865)
--- trunk/Source/WebCore/html/HTMLVideoElement.cpp 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp 2020-10-22 15:22:39 UTC (rev 268865)
@@ -361,11 +361,9 @@
bool HTMLVideoElement::webkitDisplayingFullscreen()
{
if (document().quirks().needsAkamaiMediaPlayerQuirk(*this))
- return isFullscreen() || m_isChangingVideoFullscreenMode;
+ return isFullscreen() || isChangingVideoFullscreenMode();
- // 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_isChangingVideoFullscreenMode);
+ return isFullscreen();
}
void HTMLVideoElement::ancestorWillEnterFullscreen()
@@ -482,7 +480,7 @@
void HTMLVideoElement::setPresentationMode(VideoPresentationMode mode)
{
- if (m_isChangingVideoFullscreenMode || toPresentationMode(fullscreenMode()) == mode)
+ if (isChangingVideoFullscreenMode() || toPresentationMode(fullscreenMode()) == mode)
return;
auto videoFullscreenMode = toFullscreenMode(mode);
@@ -493,7 +491,6 @@
if (toPresentationMode(fullscreenMode()) == VideoPresentationMode::PictureInPicture)
m_isExitingPictureInPicture = true;
- m_isChangingVideoFullscreenMode = true;
exitFullscreen();
}
@@ -508,7 +505,6 @@
else if (fullscreenMode() == VideoFullscreenModePictureInPicture)
m_isExitingPictureInPicture = true;
- m_isChangingVideoFullscreenMode = true;
enterFullscreen(videoFullscreenMode);
}
@@ -519,20 +515,25 @@
void HTMLVideoElement::didEnterFullscreenOrPictureInPicture(const FloatSize& size)
{
- m_isChangingVideoFullscreenMode = false;
- if (m_isEnteringPictureInPicture || m_isExitingPictureInPicture) {
+ if (m_isEnteringPictureInPicture) {
+ m_isEnteringPictureInPicture = false;
+ setChangingVideoFullscreenMode(false);
+
#if ENABLE(PICTURE_IN_PICTURE_API)
- if (m_pictureInPictureObserver) {
- if (m_isEnteringPictureInPicture)
- m_pictureInPictureObserver->didEnterPictureInPicture(flooredIntSize(size));
- else
- m_pictureInPictureObserver->didExitPictureInPicture();
- }
+ if (m_pictureInPictureObserver)
+ m_pictureInPictureObserver->didEnterPictureInPicture(flooredIntSize(size));
#else
UNUSED_PARAM(size);
#endif
- m_isEnteringPictureInPicture = false;
+ return;
+ }
+
+ if (m_isExitingPictureInPicture) {
m_isExitingPictureInPicture = false;
+#if ENABLE(PICTURE_IN_PICTURE_API)
+ if (m_pictureInPictureObserver)
+ m_pictureInPictureObserver->didExitPictureInPicture();
+#endif
}
HTMLMediaElement::didBecomeFullscreenElement();
@@ -540,23 +541,24 @@
void HTMLVideoElement::didExitFullscreenOrPictureInPicture()
{
- m_isChangingVideoFullscreenMode = false;
if (m_isExitingPictureInPicture) {
m_isExitingPictureInPicture = false;
+ setChangingVideoFullscreenMode(false);
+
#if ENABLE(PICTURE_IN_PICTURE_API)
if (m_pictureInPictureObserver)
m_pictureInPictureObserver->didExitPictureInPicture();
#endif
+ return;
}
+
+ HTMLMediaElement::didStopBeingFullscreenElement();
}
-#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_USES_ELEMENT_FULLSCREEN)
-void HTMLVideoElement::didBecomeFullscreenElement()
+bool HTMLVideoElement::isChangingPresentationMode() const
{
- m_isChangingVideoFullscreenMode = false;
- HTMLMediaElement::didBecomeFullscreenElement();
+ return isChangingVideoFullscreenMode();
}
-#endif
void HTMLVideoElement::setVideoFullscreenFrame(const FloatRect& frame)
{
Modified: trunk/Source/WebCore/html/HTMLVideoElement.h (268864 => 268865)
--- trunk/Source/WebCore/html/HTMLVideoElement.h 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/Source/WebCore/html/HTMLVideoElement.h 2020-10-22 15:22:39 UTC (rev 268865)
@@ -96,11 +96,8 @@
WEBCORE_EXPORT void setPresentationMode(VideoPresentationMode);
WEBCORE_EXPORT void didEnterFullscreenOrPictureInPicture(const FloatSize&);
WEBCORE_EXPORT void didExitFullscreenOrPictureInPicture();
+ WEBCORE_EXPORT bool isChangingPresentationMode() const;
-#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_USES_ELEMENT_FULLSCREEN)
- WEBCORE_EXPORT void didBecomeFullscreenElement() final;
-#endif
-
void setVideoFullscreenFrame(const FloatRect&) final;
#if ENABLE(PICTURE_IN_PICTURE_API)
@@ -143,7 +140,6 @@
unsigned m_lastReportedVideoWidth { 0 };
unsigned m_lastReportedVideoHeight { 0 };
- bool m_isChangingVideoFullscreenMode { false };
#if ENABLE(VIDEO_PRESENTATION_MODE)
bool m_isEnteringPictureInPicture { false };
Modified: trunk/Source/WebCore/testing/Internals.cpp (268864 => 268865)
--- trunk/Source/WebCore/testing/Internals.cpp 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/Source/WebCore/testing/Internals.cpp 2020-10-22 15:22:39 UTC (rev 268865)
@@ -3365,6 +3365,11 @@
}
#if ENABLE(VIDEO_PRESENTATION_MODE)
+bool Internals::isChangingPresentationMode(HTMLVideoElement& element) const
+{
+ return element.isChangingPresentationMode();
+}
+
void Internals::setMockVideoPresentationModeEnabled(bool enabled)
{
Document* document = contextDocument();
Modified: trunk/Source/WebCore/testing/Internals.h (268864 => 268865)
--- trunk/Source/WebCore/testing/Internals.h 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/Source/WebCore/testing/Internals.h 2020-10-22 15:22:39 UTC (rev 268865)
@@ -512,6 +512,7 @@
void setFullscreenControlsHidden(bool);
#if ENABLE(VIDEO_PRESENTATION_MODE)
+ bool isChangingPresentationMode(HTMLVideoElement&) const;
void setMockVideoPresentationModeEnabled(bool);
#endif
Modified: trunk/Source/WebCore/testing/Internals.idl (268864 => 268865)
--- trunk/Source/WebCore/testing/Internals.idl 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/Source/WebCore/testing/Internals.idl 2020-10-22 15:22:39 UTC (rev 268865)
@@ -553,6 +553,7 @@
undefined setFullscreenAutoHideDuration(double duration);
undefined setFullscreenControlsHidden(boolean hidden);
+ [Conditional=VIDEO_PRESENTATION_MODE] boolean isChangingPresentationMode(HTMLVideoElement element);
[Conditional=VIDEO_PRESENTATION_MODE] undefined setMockVideoPresentationModeEnabled(boolean enabled);
undefined setApplicationCacheOriginQuota(unsigned long long quota);
Modified: trunk/Tools/ChangeLog (268864 => 268865)
--- trunk/Tools/ChangeLog 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/Tools/ChangeLog 2020-10-22 15:22:39 UTC (rev 268865)
@@ -1,3 +1,16 @@
+2020-10-22 Peng Liu <[email protected]>
+
+ Let webkitDisplayingFullscreen() return true when a video element’s fullscreen mode is not VideoFullscreenModeNone
+ https://bugs.webkit.org/show_bug.cgi?id=216426
+
+ Reviewed by Jer Noble.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm:
+ (TEST):
+ Use internals.isChangingPresentationMode() to make sure a video presentation mode
+ change (from inline to picture-in-picture) is completed before moving to the next
+ step of the test.
+
2020-10-22 Philippe Normand <[email protected]>
[Flatpak SDK] Backport GStreamer device monitor patch
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm (268864 => 268865)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm 2020-10-22 14:43:57 UTC (rev 268864)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm 2020-10-22 15:22:39 UTC (rev 268865)
@@ -27,6 +27,7 @@
#import "PlatformUtilities.h"
#import "TestWKWebView.h"
+#import "WKWebViewConfigurationExtras.h"
#import <WebCore/PictureInPictureSupport.h>
#import <WebKit/WKPreferencesPrivate.h>
#import <WebKit/WKWebViewPrivate.h>
@@ -40,25 +41,26 @@
if (!WebCore::supportsPictureInPicture())
return;
- auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
- configuration.get().preferences._allowsPictureInPictureMediaPlayback = YES;
- auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]);
+ auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
+ [[configuration preferences] _setAllowsPictureInPictureMediaPlayback:YES];
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration addToWindow:YES]);
[webView synchronouslyLoadHTMLString:@"<video src="" webkit-playsinline playsinline loop></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])
+ if (![webView stringByEvaluatingJavaScript:@"window.internals.isChangingPresentationMode(document.querySelector('video'))"].boolValue)
break;
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;
+ presentationModeChanged = false;
[webView performAfterReceivingMessage:@"presentationmodechanged" action:^{ presentationModeChanged = true; }];
[webView _closeAllMediaPresentations];
@@ -74,9 +76,9 @@
TEST(WKWebViewCloseAllMediaPresentations, VideoFullscreen)
{
- auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
- configuration.get().preferences._fullScreenEnabled = YES;
- auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]);
+ auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
+ [[configuration preferences] _setFullScreenEnabled:YES];
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration addToWindow:YES]);
[webView synchronouslyLoadHTMLString:@"<video src="" webkit-playsinline playsinline loop></video>"];
[webView objectByEvaluatingJavaScript:@"document.querySelector('video').addEventListener('webkitpresentationmodechanged', event => { window.webkit.messageHandlers.testHandler.postMessage('presentationmodechanged'); });"];
@@ -85,9 +87,16 @@
[webView performAfterReceivingMessage:@"presentationmodechanged" action:^{ presentationModeChanged = true; }];
[webView objectByEvaluatingJavaScriptWithUserGesture:@"document.querySelector('video').webkitEnterFullscreen()"];
+ [webView objectByEvaluatingJavaScript:@"window.internals.setMockVideoPresentationModeEnabled(true)"];
TestWebKitAPI::Util::run(&presentationModeChanged);
+ do {
+ if (![webView stringByEvaluatingJavaScript:@"window.internals.isChangingPresentationMode(document.querySelector('video'))"].boolValue)
+ break;
+ TestWebKitAPI::Util::sleep(0.5);
+ } while (true);
+
presentationModeChanged = false;
[webView performAfterReceivingMessage:@"presentationmodechanged" action:^{ presentationModeChanged = true; }];
@@ -100,9 +109,9 @@
TEST(WKWebViewCloseAllMediaPresentations, ElementFullscreen)
{
- auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
- configuration.get().preferences._fullScreenEnabled = YES;
- auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]);
+ auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
+ [[configuration preferences] _setFullScreenEnabled:YES];
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration addToWindow:YES]);
[webView synchronouslyLoadHTMLString:@"<div id=\"target\" style=\"width:100px;height:100px;background-color:red\"></div>"];
[webView objectByEvaluatingJavaScript:@"document.querySelector('#target').addEventListener('webkitfullscreenchange', event => { window.webkit.messageHandlers.testHandler.postMessage('fullscreenchange'); });"];