Don't claim to support fullscreen mode unless fullScreenEnabled setting is enabled
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2020 15:54:58 +0000 (15:54 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2020 15:54:58 +0000 (15:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=213142
<rdar://63753327>

Reviewed by Jer Noble.

Source/WebCore:

Test: media/video-supports-fullscreen.html

* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::supportsFullscreen const): Check settings.fullScreenEnabled.

LayoutTests:

* media/video-supports-fullscreen-expected.txt: Added.
* media/video-supports-fullscreen.html: Added.
* media/video-fullscreen-only-playback.html: Don't set fullScreenEnabled to false.

* TestExpectations: Skip the test, it is WK2-only.
* platform/wk2/TestExpectations: Expect the test to pass.

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

LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/media/video-fullscreen-only-playback.html
LayoutTests/media/video-supports-fullscreen-expected.txt [new file with mode: 0644]
LayoutTests/media/video-supports-fullscreen.html [new file with mode: 0644]
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLVideoElement.cpp

index 848460c..bffc24c 100644 (file)
@@ -1,3 +1,18 @@
+2020-06-24  Eric Carlson  <eric.carlson@apple.com>
+
+        Don't claim to support fullscreen mode unless fullScreenEnabled setting is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=213142
+        <rdar://63753327>
+
+        Reviewed by Jer Noble.
+
+        * media/video-supports-fullscreen-expected.txt: Added.
+        * media/video-supports-fullscreen.html: Added.
+        * media/video-fullscreen-only-playback.html: Don't set fullScreenEnabled to false.
+
+        * TestExpectations: Skip the test, it is WK2-only.
+        * platform/wk2/TestExpectations: Expect the test to pass.
+
 2020-06-24  Philippe Normand  <pnormand@igalia.com>
 
         [GStreamer] webrtc/disable-encryption.html is a crashing flaky
index 54dca08..502678c 100644 (file)
@@ -906,6 +906,9 @@ webkit.org/b/203146 fast/canvas/offscreen-enabled.html [ Skip ]
 webkit.org/b/203146 http/wpt/offscreen-canvas [ Skip ]
 webkit.org/b/203146 imported/w3c/web-platform-tests/html/canvas/offscreen [ Skip ]
 
+# Tests a setting behind the ENABLE_FULLSCREEN_API flag, which is WK2-only
+media/video-supports-fullscreen.html [ Skip ]
+
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific tests.
 #//////////////////////////////////////////////////////////////////////////////////////////
index ffeca99..c3aca3a 100644 (file)
@@ -18,8 +18,7 @@
                 video.loop = true;
 
                 internals.settings.setAllowsInlineMediaPlayback(false);
-                // Disable the Fullscreen API (element fullscreen) support
-                internals.settings.setFullScreenEnabled(false);
+
                 internals.setMockVideoPresentationModeEnabled(true);
 
                 consoleWrite("");
diff --git a/LayoutTests/media/video-supports-fullscreen-expected.txt b/LayoutTests/media/video-supports-fullscreen-expected.txt
new file mode 100644 (file)
index 0000000..629fa0e
--- /dev/null
@@ -0,0 +1,10 @@
+
+Test that video.webkitSupportsFullscreen returns false unless the setting is enbled.
+
+EVENT(loadedmetadata)
+RUN(internals.settings.setFullScreenEnabled(false))
+EXPECTED (video.webkitSupportsFullscreen == 'false') OK
+RUN(internals.settings.setFullScreenEnabled(true))
+EXPECTED (video.webkitSupportsFullscreen == 'true') OK
+END OF TEST
+
diff --git a/LayoutTests/media/video-supports-fullscreen.html b/LayoutTests/media/video-supports-fullscreen.html
new file mode 100644 (file)
index 0000000..4d0ff1e
--- /dev/null
@@ -0,0 +1,37 @@
+<!doctype html>
+<html>
+<head>
+    <script src=media-file.js></script>
+    <script src=video-test.js></script>
+    <script>
+        window.addEventListener('load', async evt => {
+
+            if (!window.internals) {
+                failTest("This test requires internals.")
+                return;
+            }
+
+let hack = internals.nowPlayingState;
+
+            findMediaElement();
+
+            video.src = findMediaFile("video", "content/test");
+
+            await waitFor(video, 'loadedmetadata');
+
+            run("internals.settings.setFullScreenEnabled(false)");
+            testExpected("video.webkitSupportsFullscreen", false);
+
+            run("internals.settings.setFullScreenEnabled(true)");
+            testExpected("video.webkitSupportsFullscreen", true);
+
+            endTest();
+        }, { once: true });
+
+    </script>
+</head>
+<body>
+    <video controls playsinline></video>
+    <p>Test that video.webkitSupportsFullscreen returns false unless the setting is enbled.</p>
+</body>
+</html>
index 65911fe..491d0e9 100644 (file)
@@ -50,6 +50,8 @@ http/tests/fullscreen
 compositing/no-compositing-when-fulll-screen-is-present.html
 webkit.org/b/200308 fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html [ Skip ]
 
+media/video-supports-fullscreen.html [ Skip ]
+
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
 inspector/canvas/requestShaderSource-webgpu.html [ Skip ]
index f72bedb..57871f7 100644 (file)
@@ -775,6 +775,9 @@ inspector/page/overrideSetting-ITPDebugModeEnabled.html [ Pass ]
 # Highlighting marked text ranges from layout tests is only supported in WebKit2.
 editing/input/composition-highlights.html [ Pass ]
 
+# Tests a setting behind the ENABLE_FULLSCREEN_API flag, which is WK2-only
+media/video-supports-fullscreen.html [ Pass ]
+
 ### END OF (5) Progressions, expected successes that are expected failures in WebKit1.
 ########################################
 
index 6eebf9e..4925318 100644 (file)
@@ -1,3 +1,16 @@
+2020-06-24  Eric Carlson  <eric.carlson@apple.com>
+
+        Don't claim to support fullscreen mode unless fullScreenEnabled setting is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=213142
+        <rdar://63753327>
+
+        Reviewed by Jer Noble.
+
+        Test: media/video-supports-fullscreen.html
+
+        * html/HTMLVideoElement.cpp:
+        (WebCore::HTMLVideoElement::supportsFullscreen const): Check settings.fullScreenEnabled.
+
 2020-06-24  Philippe Normand  <pnormand@igalia.com>
 
         [GStreamer] webrtc/disable-encryption.html is a crashing flaky
index b894c5f..465dabc 100644 (file)
@@ -190,7 +190,11 @@ bool HTMLVideoElement::supportsFullscreen(HTMLMediaElementEnums::VideoFullscreen
     // Fullscreen implemented by player.
     return true;
 #else
+
 #if ENABLE(FULLSCREEN_API)
+    if (videoFullscreenMode == HTMLMediaElementEnums::VideoFullscreenModeStandard && !document().settings().fullScreenEnabled())
+        return false;
+
     // If the full screen API is enabled and is supported for the current element
     // do not require that the player has a video track to enter full screen.
     if (videoFullscreenMode == HTMLMediaElementEnums::VideoFullscreenModeStandard && page->chrome().client().supportsFullScreenForElement(*this, false))