video.attribute should not return true just because of fullscreen
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Feb 2015 18:16:06 +0000 (18:16 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Feb 2015 18:16:06 +0000 (18:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141219

Reviewed by Dean Jackson.

Source/WebCore:

No new tests, updated media/video-fullscreeen-only-controls.html

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.shouldHaveControls):
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.isFullScreen):

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::controls): Don't consider fullscreen status.
(WebCore::HTMLMediaElement::configureMediaControls): Create controls if a video element
    isn't allowed to play inline, or if it is in fullscreen.

LayoutTests:

* media/video-fullscreeen-only-controls-expected.txt: Update.
* media/video-fullscreeen-only-controls.html: Ditto.

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

LayoutTests/ChangeLog
LayoutTests/media/video-fullscreeen-only-controls-expected.txt
LayoutTests/media/video-fullscreeen-only-controls.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js
Source/WebCore/html/HTMLMediaElement.cpp

index fa55cc3..cb046ea 100644 (file)
@@ -1,3 +1,13 @@
+2015-02-04  Eric Carlson  <eric.carlson@apple.com>
+
+        video.attribute should not return true just because of fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=141219
+
+        Reviewed by Dean Jackson.
+
+        * media/video-fullscreeen-only-controls-expected.txt: Update.
+        * media/video-fullscreeen-only-controls.html: Ditto.
+
 2015-02-04  Alexey Proskuryakov  <ap@apple.com>
 
         inspector/css/selector-dynamic-specificity.html is very slow on Yosemite
index 8f862d7..6803433 100644 (file)
@@ -2,6 +2,8 @@ This tests that when inline-playback is restricted, the video element's "control
 
 
 RUN(internals.setMediaSessionRestrictions('video', 'InlineVideoPlaybackRestricted'))
+EXPECTED (video.hasAttribute('controls') == 'false') OK
+EXPECTED (video.controls == 'false') OK
 EXPECTED (shadowRoot = internals.shadowRoot(video) != 'null') OK
 EXPECTED (panel = mediaControlsElement(shadowRoot.firstChild, '-webkit-media-controls-panel') != 'null') OK
 EXPECTED (internals.shadowPseudoId(panel) == '-webkit-media-controls-panel') OK
index 7e753e3..a9c6a1a 100644 (file)
@@ -14,6 +14,9 @@
     var video = document.getElementById('video');
     video.src = findMediaFile("video", "content/test");
 
+    testExpected("video.hasAttribute('controls')", false);
+    testExpected("video.controls", false);
+
     if (window.internals) {
         testExpected("shadowRoot = internals.shadowRoot(video)", null, "!=");
         testExpected("panel = mediaControlsElement(shadowRoot.firstChild, '-webkit-media-controls-panel')", null, "!=");
index 8b120eb..022eac4 100644 (file)
@@ -1,3 +1,22 @@
+2015-02-04  Eric Carlson  <eric.carlson@apple.com>
+
+        video.attribute should not return true just because of fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=141219
+
+        Reviewed by Dean Jackson.
+
+        No new tests, updated media/video-fullscreeen-only-controls.html
+
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.shouldHaveControls):
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.isFullScreen):
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::controls): Don't consider fullscreen status.
+        (WebCore::HTMLMediaElement::configureMediaControls): Create controls if a video element
+            isn't allowed to play inline, or if it is in fullscreen.
+
 2015-02-04  Mark Lam  <mark.lam@apple.com>
 
         Remove concept of makeUsableFromMultipleThreads().
index b0a2694..96fd18e 100644 (file)
@@ -250,6 +250,9 @@ Controller.prototype = {
 
     shouldHaveControls: function()
     {
+        if (!this.isAudio() && !this.host.mediaPlaybackAllowsInline)
+            return true;
+
         return this.video.controls || this.isFullScreen();
     },
 
index 5ca71eb..19c29c6 100644 (file)
@@ -413,7 +413,7 @@ ControllerIOS.prototype = {
 
     isFullScreen: function()
     {
-        return this.video.webkitDisplayingFullscreen;
+        return this.video.webkitDisplayingFullscreen && this.presentationMode() != 'optimized';
     },
 
     handleFullscreenButtonClicked: function(event) {
index d79cf75..a7c495a 100644 (file)
@@ -2966,14 +2966,6 @@ bool HTMLMediaElement::controls() const
     if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript))
         return true;
 
-    // always show controls for video when fullscreen playback is required.
-    if (isVideo() && m_mediaSession->requiresFullscreenForVideoPlayback(*this))
-        return true;
-
-    // Always show controls when in full screen mode.
-    if (isFullscreen())
-        return true;
-
     return fastHasAttribute(controlsAttr);
 }
 
@@ -5256,13 +5248,23 @@ bool HTMLMediaElement::createMediaControls()
 
 void HTMLMediaElement::configureMediaControls()
 {
+    bool requireControls = controls();
+
+    // Always create controls for video when fullscreen playback is required.
+    if (isVideo() && m_mediaSession->requiresFullscreenForVideoPlayback(*this))
+        requireControls = true;
+
+    // Always create controls when in full screen mode.
+    if (isFullscreen())
+        requireControls = true;
+
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    if (!controls() || !inDocument())
+    if (!requireControls || !inDocument())
         return;
 
     ensureUserAgentShadowRoot();
 #else
-    if (!controls() || !inDocument()) {
+    if (!requireControls || !inDocument()) {
         if (hasMediaControls())
             mediaControls()->hide();
         return;