[Modern Media Controls] Controls are not visible in fullscreen without the controls...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Mar 2017 15:59:58 +0000 (15:59 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Mar 2017 15:59:58 +0000 (15:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=169411
<rdar://problem/30931724>

Patch by Antoine Quint <graouts@apple.com> on 2017-03-09
Reviewed by Eric Carlson.

Source/WebCore:

Ensure we show controls in fullscreen in the absence of the controls attribute.

Tests: media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html
       media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html

* Modules/modern-media-controls/media/controls-visibility-support.js:
(ControlsVisibilitySupport.prototype.get mediaEvents):
(ControlsVisibilitySupport.prototype._updateControls):
(ControlsVisibilitySupport):

LayoutTests:

Add two new tests to check that controls are visible in fullscreen in the absence of the controls attribute,
except if the fullscreen element is a parent element.

* media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html: Added.
* media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html: Added.
* platform/ios-simulator/TestExpectations: Skip new tests on iOS since it uses platform controls.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213640 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/media/controls-visibility-support.js

index ceca097..c2c60d3 100644 (file)
@@ -1,3 +1,18 @@
+2017-03-09  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] Controls are not visible in fullscreen without the controls attribute
+        https://bugs.webkit.org/show_bug.cgi?id=169411
+        <rdar://problem/30931724>
+
+        Reviewed by Eric Carlson.
+
+        Add two new tests to check that controls are visible in fullscreen in the absence of the controls attribute,
+        except if the fullscreen element is a parent element.
+
+        * media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html: Added.
+        * media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html: Added.
+        * platform/ios-simulator/TestExpectations: Skip new tests on iOS since it uses platform controls.
+
 2017-03-09  Zalan Bujtas  <zalan@apple.com>
 
         Simple line layout: Add top level pagination support.
diff --git a/LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element-expected.txt b/LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element-expected.txt
new file mode 100644 (file)
index 0000000..dbcbe66
--- /dev/null
@@ -0,0 +1,12 @@
+Testing that control are not shown when a parent element is fullscreen and the controls attribute is not present.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.webkitFullscreenElement is document.documentElement
+PASS media.webkitDisplayingFullscreen is false
+PASS mediaController.controls.controlsBar.visible is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html b/LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html
new file mode 100644 (file)
index 0000000..ef02148
--- /dev/null
@@ -0,0 +1,35 @@
+<script src="../../../resources/js-test-pre.js"></script>
+<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
+<script src="../resources/media-controls-utils.js" type="text/javascript"></script>
+<body>
+<video src="../../content/test.mp4" autoplay></video>
+<div id="host"></div>
+<script type="text/javascript">
+
+window.jsTestIsAsync = true;
+
+description("Testing that control are not shown when a parent element is fullscreen and the controls attribute is not present.");
+
+const container = document.querySelector("div#host");
+const media = document.querySelector("video");
+const mediaController = createControls(container, media, null);
+
+media.addEventListener("play", () => {
+    document.documentElement.addEventListener("webkitfullscreenchange", () => {
+        shouldBe("document.webkitFullscreenElement", "document.documentElement");
+        shouldBeFalse("media.webkitDisplayingFullscreen");
+        shouldBeFalse("mediaController.controls.controlsBar.visible");
+        button.remove();
+        container.remove();
+        media.remove();
+        finishJSTest();
+    });
+
+    const button = document.body.appendChild(document.createElement("button"));
+    button.addEventListener("click", () => document.documentElement.webkitRequestFullscreen());
+    pressOnElement(button);
+});
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
diff --git a/LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video-expected.txt b/LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video-expected.txt
new file mode 100644 (file)
index 0000000..2964fdc
--- /dev/null
@@ -0,0 +1,11 @@
+Testing that control are shown in fullscreen when the controls attribute is not present.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS media.webkitDisplayingFullscreen is true
+PASS mediaController.controls.controlsBar.visible is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html b/LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html
new file mode 100644 (file)
index 0000000..9d4ba48
--- /dev/null
@@ -0,0 +1,34 @@
+<script src="../../../resources/js-test-pre.js"></script>
+<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
+<script src="../resources/media-controls-utils.js" type="text/javascript"></script>
+<body>
+<video src="../../content/test.mp4" autoplay></video>
+<div id="host"></div>
+<script type="text/javascript">
+
+window.jsTestIsAsync = true;
+
+description("Testing that control are shown in fullscreen when the controls attribute is not present.");
+
+const container = document.querySelector("div#host");
+const media = document.querySelector("video");
+const mediaController = createControls(container, media, null);
+
+media.addEventListener("play", () => {
+    media.addEventListener("webkitfullscreenchange", () => {
+        shouldBeTrue("media.webkitDisplayingFullscreen");
+        shouldBeTrue("mediaController.controls.controlsBar.visible");
+        button.remove();
+        container.remove();
+        media.remove();
+        finishJSTest();
+    });
+
+    const button = document.body.appendChild(document.createElement("button"));
+    button.addEventListener("click", () => media.webkitEnterFullscreen());
+    pressOnElement(button);
+});
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
index e9707ec..0c3d8d9 100644 (file)
@@ -2800,6 +2800,9 @@ media/modern-media-controls/seek-forward-support [ Skip ]
 media/modern-media-controls/start-support/start-support-fullscreen.html [ Skip ]
 media/modern-media-controls/volume-down-support [ Skip ]
 media/modern-media-controls/volume-up-support [ Skip ]
+media/modern-media-controls/volume-up-support [ Skip ]
+media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html [ Skip ]
+media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html [ Skip ]
 
 # These tests are macOS-specific or mouse-specific
 media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html [ Skip ]
index af7778d..5dc9bd7 100644 (file)
@@ -1,3 +1,21 @@
+2017-03-09  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] Controls are not visible in fullscreen without the controls attribute
+        https://bugs.webkit.org/show_bug.cgi?id=169411
+        <rdar://problem/30931724>
+
+        Reviewed by Eric Carlson.
+
+        Ensure we show controls in fullscreen in the absence of the controls attribute.
+
+        Tests: media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html
+               media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html
+
+        * Modules/modern-media-controls/media/controls-visibility-support.js:
+        (ControlsVisibilitySupport.prototype.get mediaEvents):
+        (ControlsVisibilitySupport.prototype._updateControls):
+        (ControlsVisibilitySupport):
+
 2017-03-09  Zalan Bujtas  <zalan@apple.com>
 
         Simple line layout: Add top level pagination support.
index a0de056..e0d25e0 100644 (file)
@@ -45,7 +45,7 @@ class ControlsVisibilitySupport extends MediaControllerSupport
 
     get mediaEvents()
     {
-        return ["loadedmetadata", "play", "pause"];
+        return ["loadedmetadata", "play", "pause", "webkitfullscreenchange"];
     }
 
     get tracksToMonitor()
@@ -64,7 +64,7 @@ class ControlsVisibilitySupport extends MediaControllerSupport
     {
         const media = this.mediaController.media;
         const host = this.mediaController.host;
-        const shouldShowControls = !!(media.controls || (host && host.shouldForceControlsDisplay));
+        const shouldShowControls = !!(media.controls || (host && host.shouldForceControlsDisplay) || media.webkitDisplayingFullscreen);
         const isVideo = media instanceof HTMLVideoElement && media.videoTracks.length > 0;
 
         const controls = this.mediaController.controls;