Title: [199667] trunk
Revision
199667
Author
eric.carl...@apple.com
Date
2016-04-18 08:24:47 -0700 (Mon, 18 Apr 2016)

Log Message

Media element "user gesture for fullscreen" restriction is never lifted
https://bugs.webkit.org/show_bug.cgi?id=156547
<rdar://problem/25707814>

Reviewed by Jer Noble.

Source/WebCore:

Test: media/video-fullscreen-restriction-removed.html

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackPermitted): Check fullscreenPermitted rather than
  checking for a user gesture because the restriction can be removed.

LayoutTests:

* media/video-fullscreen-restriction-removed-expected.txt: Added.
* media/video-fullscreen-restriction-removed.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199666 => 199667)


--- trunk/LayoutTests/ChangeLog	2016-04-18 15:23:45 UTC (rev 199666)
+++ trunk/LayoutTests/ChangeLog	2016-04-18 15:24:47 UTC (rev 199667)
@@ -1,3 +1,14 @@
+2016-04-18  Eric Carlson  <eric.carl...@apple.com>
+
+        Media element "user gesture for fullscreen" restriction is never lifted
+        https://bugs.webkit.org/show_bug.cgi?id=156547
+        <rdar://problem/25707814>
+
+        Reviewed by Jer Noble.
+
+        * media/video-fullscreen-restriction-removed-expected.txt: Added.
+        * media/video-fullscreen-restriction-removed.html: Added.
+
 2016-04-18  Frederic Wang  <fred.w...@free.fr>
 
         Mark script-height reftest as ImageOnlyFailure on iOS

Added: trunk/LayoutTests/media/video-fullscreen-restriction-removed-expected.txt (0 => 199667)


--- trunk/LayoutTests/media/video-fullscreen-restriction-removed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/video-fullscreen-restriction-removed-expected.txt	2016-04-18 15:24:47 UTC (rev 199667)
@@ -0,0 +1,25 @@
+Test that "fullscreen requires user gesture restriction" is removed by a user gesture.
+
+Click me!
+RUN(internals.settings.setAllowsInlineMediaPlayback(false))
+RUN(internals.setMediaElementRestrictions(video, "RequireUserGestureForFullscreen"))
+* set video.src
+
+EVENT(loadedmetadata)
+
+* video.play() should fail 
+RUN(video.play())
+EXPECTED (video.paused == 'true') OK
+
+* clicking button
+
+EVENT(click)
+* video.play() should work from within a click handler
+EXPECTED (video.paused == 'true') OK
+RUN(video.play())
+
+EVENT(webkitfullscreenchange)
+EXPECTED (video.paused == 'false') OK
+
+END OF TEST
+

Added: trunk/LayoutTests/media/video-fullscreen-restriction-removed.html (0 => 199667)


--- trunk/LayoutTests/media/video-fullscreen-restriction-removed.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-fullscreen-restriction-removed.html	2016-04-18 15:24:47 UTC (rev 199667)
@@ -0,0 +1,70 @@
+<html>
+    <head>
+        <script src=""
+        <script src=""
+        <script>
+
+            function start()
+            {
+                if (!window.internals) {
+                    failTest('This test requires window.internals.');
+                    return;
+                }
+
+                findMediaElement();
+
+                run('internals.settings.setAllowsInlineMediaPlayback(false)');
+                run('internals.setMediaElementRestrictions(video, "RequireUserGestureForFullscreen")');
+
+                waitForEvent('loadedmetadata', loadedmetadata)
+                waitForEvent('webkitfullscreenchange', fullscreenChanged, false, true, document)
+                waitForEvent('click', clickHandler, false, true, document.getElementById('button'))
+
+                consoleWrite('* set video.src');
+                video.src = "" 'content/test');
+                consoleWrite('');
+            }
+
+            function loadedmetadata()
+            {
+                consoleWrite('');
+                if (window.eventSender) {
+                    consoleWrite('* video.play() should fail ');
+                    run('video.play()');
+                    testExpected('video.paused', true);
+                    consoleWrite('');
+
+                    consoleWrite('* clicking button<br>');
+                    var button = document.getElementById('button');
+                    eventSender.mouseMoveTo(button.offsetLeft + 20, button.offsetTop + 7);
+                    eventSender.mouseDown();
+                    eventSender.mouseUp();
+                } else {
+                    consoleWrite('* click on the "Click me!" button to proceed<br>');
+                }
+            }
+
+            function clickHandler()
+            {
+                consoleWrite('* video.play() should work from within a click handler');
+                testExpected('video.paused', true);
+                run('video.play()');
+                consoleWrite('');
+                failTestIn(2000);
+            }
+
+            function fullscreenChanged()
+            {
+                testExpected('video.paused', false);
+                consoleWrite('');
+                endTest();
+            }
+        </script>
+    </head>
+
+    <body _onload_="start()">
+        <p>Test that "fullscreen requires user gesture restriction" is removed by a user gesture.</p>
+        <video controls></video>
+        <button id="button" >Click me!</button><br>
+    </body>
+</html>

Modified: trunk/LayoutTests/platform/mac/TestExpectations (199666 => 199667)


--- trunk/LayoutTests/platform/mac/TestExpectations	2016-04-18 15:23:45 UTC (rev 199666)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2016-04-18 15:24:47 UTC (rev 199667)
@@ -1267,9 +1267,6 @@
 # WOFF2 is only supported on certain Operating Systems.
 webkit.org/b/150830 [ Yosemite ElCapitan ] fast/text/woff2.html [ ImageOnlyFailure ]
 
-# AppleTV not supported on Yosemite
-[ Yosemite ] media/controls/airplay-picker.html
-
 webkit.org/b/150956 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/event_loadeddata.html [ Pass Timeout ]
 
 webkit.org/b/140217 http/tests/navigation/forward-and-cancel.html [ Pass Failure ]
@@ -1289,9 +1286,12 @@
 
 # WIRELESS_PLAYBACK_TARGET not enabled on Yosemite.
 [ Yosemite ] media/airplay-target-availability.html
+[ Yosemite ] media/controls/airplay-picker.html
 
 webkit.org/b/153086 sputnik/Conformance/15_Native_Objects/15.1_The_Global_Object/15.1.3/15.1.3.3_encodeURI/S15.1.3.3_A2.4_T2.html [ Pass Crash ]
 
+[ Yosemite ] media/video-fullscreen-restriction-removed.html [ Skip ]
+
 webkit.org/b/153752 [ Yosemite ] http/tests/plugins/visible_plugins.html [ Skip ]
 
 webkit.org/b/153809 transitions/clip-path-transitions.html [ Pass Failure ]

Modified: trunk/Source/WebCore/ChangeLog (199666 => 199667)


--- trunk/Source/WebCore/ChangeLog	2016-04-18 15:23:45 UTC (rev 199666)
+++ trunk/Source/WebCore/ChangeLog	2016-04-18 15:24:47 UTC (rev 199667)
@@ -1,3 +1,17 @@
+2016-04-18  Eric Carlson  <eric.carl...@apple.com>
+
+        Media element "user gesture for fullscreen" restriction is never lifted
+        https://bugs.webkit.org/show_bug.cgi?id=156547
+        <rdar://problem/25707814>
+
+        Reviewed by Jer Noble.
+
+        Test: media/video-fullscreen-restriction-removed.html
+
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::playbackPermitted): Check fullscreenPermitted rather than
+          checking for a user gesture because the restriction can be removed.
+
 2016-04-18  Frederic Wang  <fw...@igalia.com>
 
         Refactor RenderMathMLScripts layout to avoid using flexbox

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (199666 => 199667)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2016-04-18 15:23:45 UTC (rev 199666)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2016-04-18 15:24:47 UTC (rev 199667)
@@ -146,8 +146,8 @@
     if (pageExplicitlyAllowsElementToAutoplayInline(element))
         return true;
 
-    if (requiresFullscreenForVideoPlayback(element) && !ScriptController::processingUserGestureForMedia()) {
-        LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE");
+    if (requiresFullscreenForVideoPlayback(element) && !fullscreenPermitted(element)) {
+        LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE because of fullscreen restriction");
         return false;
     }
 
@@ -155,12 +155,12 @@
         return true;
 
     if (m_restrictions & RequireUserGestureForVideoRateChange && element.isVideo() && !ScriptController::processingUserGestureForMedia()) {
-        LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE");
+        LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE because of video rate change restriction");
         return false;
     }
 
     if (m_restrictions & RequireUserGestureForAudioRateChange && (!element.isVideo() || element.hasAudio()) && !ScriptController::processingUserGestureForMedia()) {
-        LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE");
+        LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE because of audio rate change restriction");
         return false;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to