Title: [209484] trunk
Revision
209484
Author
commit-qu...@webkit.org
Date
2016-12-07 14:47:06 -0800 (Wed, 07 Dec 2016)

Log Message

[Modern Media Controls] Entering fullscreen and returning to inline shows fullscreen controls
https://bugs.webkit.org/show_bug.cgi?id=165536

Patch by Antoine Quint <grao...@apple.com> on 2016-12-07
Reviewed by Tim Horton.

Source/WebCore:

We regressed when we implemented the fix for webkit.org/b/165494 and we started to rely solely
on the "webkitpresentationmodechanged" event to identify presention mode changes. As it turns out,
when the "webkitpresentationmodechanged" event is dispatched when exiting fullscreen and returning
to the inline presentation mode, querying the "webkitPresentationMode" property says "inline" while
"webkitDisplayingFullscreen" still returns true (raised as webkit.org/b/165538).

We now use the "webkitPresentationMode" property when that property is supported and we're using the
"webkitpresentationmodechanged" event, and we use the "webkitDisplayingFullscreen" property otherwise.

Test: media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html

* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype.get layoutTraits):

LayoutTests:

Add a new test that checks we're using the right media controls presentation as we enter and exit fullscreen.

* media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline-expected.txt: Added.
* media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (209483 => 209484)


--- trunk/LayoutTests/ChangeLog	2016-12-07 22:44:19 UTC (rev 209483)
+++ trunk/LayoutTests/ChangeLog	2016-12-07 22:47:06 UTC (rev 209484)
@@ -1,3 +1,15 @@
+2016-12-07  Antoine Quint  <grao...@apple.com>
+
+        [Modern Media Controls] Entering fullscreen and returning to inline shows fullscreen controls
+        https://bugs.webkit.org/show_bug.cgi?id=165536
+
+        Reviewed by Tim Horton.
+
+        Add a new test that checks we're using the right media controls presentation as we enter and exit fullscreen.
+
+        * media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline-expected.txt: Added.
+        * media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html: Added.
+
 2016-12-07  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Scroll position jumps to the origin when scrolling without momentum at the end of a scroll snapping container

Added: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline-expected.txt (0 => 209484)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline-expected.txt	2016-12-07 22:47:06 UTC (rev 209484)
@@ -0,0 +1,21 @@
+Testing that entering fullscreen then going back into inline presents inline controls.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Media started playing, we pause it and enter fullscreen by clicking on the matching button.
+PASS shadowRoot.querySelector('.media-controls').classList.contains('inline') is true
+
+Media entered fullscreen.
+PASS shadowRoot.querySelector('.media-controls').classList.contains('fullscreen') is true
+
+We exit fullscreen by clicking on the matching button.
+
+Media exited fullscreen.
+PASS shadowRoot.querySelector('.media-controls').classList.contains('inline') is true
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html (0 => 209484)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html	2016-12-07 22:47:06 UTC (rev 209484)
@@ -0,0 +1,59 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=true ] -->
+<script src=""
+<body>
+<video src="" style="position: absolute; top: 0; left: 0; width: 320px; height: 240px;" controls autoplay></video>
+<div id="shadow"></div>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Testing that entering fullscreen then going back into inline presents inline controls.");
+
+const media = document.querySelector("video");
+const shadowRoot = window.internals.shadowRoot(media);
+
+media.addEventListener("play", () => {
+    debug("");
+    debug("Media started playing, we pause it and enter fullscreen by clicking on the matching button.");
+    shouldBeTrue("shadowRoot.querySelector('.media-controls').classList.contains('inline')");
+
+    media.pause();
+    window.requestAnimationFrame(() => toggleFullscreen());
+});
+
+media.addEventListener("webkitfullscreenchange", () => {
+    debug("");
+
+    if (media.webkitDisplayingFullscreen) {
+        debug("Media entered fullscreen.");
+        window.requestAnimationFrame(() => {
+            shouldBeTrue("shadowRoot.querySelector('.media-controls').classList.contains('fullscreen')");
+
+            debug("");
+            debug("We exit fullscreen by clicking on the matching button.");
+            toggleFullscreen();
+        });
+    } else {
+        debug("Media exited fullscreen.");
+        window.requestAnimationFrame(() => {
+            shouldBeTrue("shadowRoot.querySelector('.media-controls').classList.contains('inline')");
+
+            debug("");
+            media.remove();
+            finishJSTest();
+        });
+    }
+});
+
+function toggleFullscreen()
+{
+    const element = shadowRoot.querySelector("button.fullscreen");
+    const bounds = element.getBoundingClientRect();
+    eventSender.mouseMoveTo(bounds.left + 1, bounds.top + 1);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+
+</script>
+<script src=""
+</body>

Modified: trunk/Source/WebCore/ChangeLog (209483 => 209484)


--- trunk/Source/WebCore/ChangeLog	2016-12-07 22:44:19 UTC (rev 209483)
+++ trunk/Source/WebCore/ChangeLog	2016-12-07 22:47:06 UTC (rev 209484)
@@ -1,3 +1,24 @@
+2016-12-07  Antoine Quint  <grao...@apple.com>
+
+        [Modern Media Controls] Entering fullscreen and returning to inline shows fullscreen controls
+        https://bugs.webkit.org/show_bug.cgi?id=165536
+
+        Reviewed by Tim Horton.
+
+        We regressed when we implemented the fix for webkit.org/b/165494 and we started to rely solely
+        on the "webkitpresentationmodechanged" event to identify presention mode changes. As it turns out,
+        when the "webkitpresentationmodechanged" event is dispatched when exiting fullscreen and returning
+        to the inline presentation mode, querying the "webkitPresentationMode" property says "inline" while
+        "webkitDisplayingFullscreen" still returns true (raised as webkit.org/b/165538).
+        
+        We now use the "webkitPresentationMode" property when that property is supported and we're using the
+        "webkitpresentationmodechanged" event, and we use the "webkitDisplayingFullscreen" property otherwise.
+
+        Test: media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html
+
+        * Modules/modern-media-controls/media/media-controller.js:
+        (MediaController.prototype.get layoutTraits):
+
 2016-12-07  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Scroll position jumps to the origin when scrolling without momentum at the end of a scroll snapping container

Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (209483 => 209484)


--- trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js	2016-12-07 22:44:19 UTC (rev 209483)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js	2016-12-07 22:47:06 UTC (rev 209484)
@@ -51,8 +51,11 @@
     get layoutTraits()
     {
         let traits = window.navigator.platform === "MacIntel" ? LayoutTraits.macOS : LayoutTraits.iOS;
-        if (this.media.webkitDisplayingFullscreen)
-            traits = traits | LayoutTraits.Fullscreen;
+        if (this.media.webkitSupportsPresentationMode) {
+            if (this.media.webkitPresentationMode === "fullscreen")
+                return traits | LayoutTraits.Fullscreen;
+        } else if (this.media.webkitDisplayingFullscreen)
+            return traits | LayoutTraits.Fullscreen;
         return traits;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to