[Modern Media Controls] No controls are shown for <audio preload="none">
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2017 07:38:41 +0000 (07:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2017 07:38:41 +0000 (07:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=168800
<rdar://problem/30652142>

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

Source/WebCore:

A media element's currentSrc property will only be set when data has started
to load. In the case where preload="none" is used, regardless of whether a
source is specified, currentSrc would be the empty string and we wouldn't
show controls at all. Identifying whether a source is specified is a little
tricky because it could be specified in a variety of ways and dynamically
as well.

So instead we optimistically show controls always provided the "controls"
attribute is set.

* Modules/modern-media-controls/media/controls-visibility-support.js:
(ControlsVisibilitySupport.prototype._updateControls):
(ControlsVisibilitySupport):
* Modules/modern-media-controls/media/start-support.js:
(StartSupport.prototype._shouldShowStartButton):
(StartSupport):

LayoutTests:

Update tests to account for the new rules for controls visibility and force an older test
not to use modern media controls since we now show the play button and there is a bug
that prevents the play button from being positioned correctly when inside a region
(see https://bugs.webkit.org/show_bug.cgi?id=168823).

* fast/regions/inline-block-inside-anonymous-overflow-with-covered-controls-expected.html
* fast/regions/inline-block-inside-anonymous-overflow-with-covered-controls.html
* media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-on-audio-expected.txt:
* media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-on-audio.html:
* media/modern-media-controls/start-support/start-support-no-source-expected.txt:
* media/modern-media-controls/start-support/start-support-no-source.html:

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

LayoutTests/ChangeLog
LayoutTests/fast/regions/inline-block-inside-anonymous-overflow-with-covered-controls-expected.html
LayoutTests/fast/regions/inline-block-inside-anonymous-overflow-with-covered-controls.html
LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-on-audio-expected.txt
LayoutTests/media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-on-audio.html
LayoutTests/media/modern-media-controls/start-support/start-support-no-source-expected.txt
LayoutTests/media/modern-media-controls/start-support/start-support-no-source.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/media/controls-visibility-support.js
Source/WebCore/Modules/modern-media-controls/media/start-support.js

index d66681e..1cee1dd 100644 (file)
@@ -1,3 +1,23 @@
+2017-02-23  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] No controls are shown for <audio preload="none">
+        https://bugs.webkit.org/show_bug.cgi?id=168800
+        <rdar://problem/30652142>
+
+        Reviewed by Eric Carlson.
+
+        Update tests to account for the new rules for controls visibility and force an older test
+        not to use modern media controls since we now show the play button and there is a bug
+        that prevents the play button from being positioned correctly when inside a region
+        (see https://bugs.webkit.org/show_bug.cgi?id=168823).
+
+        * fast/regions/inline-block-inside-anonymous-overflow-with-covered-controls-expected.html
+        * fast/regions/inline-block-inside-anonymous-overflow-with-covered-controls.html
+        * media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-on-audio-expected.txt:
+        * media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-on-audio.html:
+        * media/modern-media-controls/start-support/start-support-no-source-expected.txt:
+        * media/modern-media-controls/start-support/start-support-no-source.html:
+
 2017-02-23  Joseph Pecoraro  <pecoraro@apple.com>
 
         [Resource Timing] Gather timing information with reliable responseEnd time
index 006770b..88f4357 100644 (file)
@@ -3,9 +3,9 @@ Testing the ControlsVisibilitySupport behavior for audio without controls.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-Media has not begun loading yet, no UI is showing yet as we wait for enough information to tell if we'll be able to play
-PASS mediaController.controls.controlsBar.visible is false
-PASS mediaController.controls.startButton.visible is false
+Media has not begun loading yet
+PASS mediaController.controls.controlsBar.visible is true
+PASS mediaController.controls.startButton.visible is true
 
 Media has loaded metadata
 PASS mediaController.controls.controlsBar.visible is true
index 5307771..8945656 100644 (file)
@@ -13,9 +13,9 @@ const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "op
 const media = document.querySelector("audio");
 const mediaController = createControls(shadowRoot, media, null);
 
-debug("Media has not begun loading yet, no UI is showing yet as we wait for enough information to tell if we'll be able to play");
-shouldBeFalse("mediaController.controls.controlsBar.visible");
-shouldBeFalse("mediaController.controls.startButton.visible");
+debug("Media has not begun loading yet");
+shouldBeTrue("mediaController.controls.controlsBar.visible");
+shouldBeTrue("mediaController.controls.startButton.visible");
 
 media.addEventListener("loadedmetadata", function() {
     debug("");
index 3b0f2c7..80a5734 100644 (file)
@@ -3,7 +3,7 @@ Testing the StartSupport behavior with no source.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS mediaController.controls.showsStartButton is false
+PASS mediaController.controls.showsStartButton is true
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 3e6adfd..2ed4ef0 100644 (file)
@@ -11,7 +11,7 @@ const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "op
 const media = document.querySelector("video");
 const mediaController = createControls(shadowRoot, media, null);
 
-shouldBeFalse("mediaController.controls.showsStartButton");
+shouldBeTrue("mediaController.controls.showsStartButton");
 
 shadowRoot.host.remove();
 media.remove();
index c273361..5250a74 100644 (file)
@@ -1,3 +1,28 @@
+2017-02-23  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] No controls are shown for <audio preload="none">
+        https://bugs.webkit.org/show_bug.cgi?id=168800
+        <rdar://problem/30652142>
+
+        Reviewed by Eric Carlson.
+
+        A media element's currentSrc property will only be set when data has started
+        to load. In the case where preload="none" is used, regardless of whether a
+        source is specified, currentSrc would be the empty string and we wouldn't
+        show controls at all. Identifying whether a source is specified is a little
+        tricky because it could be specified in a variety of ways and dynamically
+        as well.
+
+        So instead we optimistically show controls always provided the "controls"
+        attribute is set.
+
+        * Modules/modern-media-controls/media/controls-visibility-support.js:
+        (ControlsVisibilitySupport.prototype._updateControls):
+        (ControlsVisibilitySupport):
+        * Modules/modern-media-controls/media/start-support.js:
+        (StartSupport.prototype._shouldShowStartButton):
+        (StartSupport):
+
 2017-02-23  Joseph Pecoraro  <pecoraro@apple.com>
 
         [Resource Timing] Gather timing information with reliable responseEnd time
index 498fa54..e40f9ff 100644 (file)
@@ -63,10 +63,8 @@ class ControlsVisibilitySupport extends MediaControllerSupport
     _updateControls()
     {
         const media = this.mediaController.media;
+        const shouldShowControls = !!media.controls;
         const isVideo = media instanceof HTMLVideoElement && media.videoTracks.length > 0;
-        let shouldShowControls = media.controls && !!media.currentSrc;
-        if (isVideo)
-            shouldShowControls = shouldShowControls && media.readyState > HTMLMediaElement.HAVE_NOTHING;
 
         const controls = this.mediaController.controls;
         controls.startButton.visible = shouldShowControls;
index bd9d7a3..8340d2a 100644 (file)
@@ -77,9 +77,6 @@ class StartSupport extends MediaControllerSupport
         if (media.webkitDisplayingFullscreen)
             return false;
 
-        if (!media.currentSrc)
-            return false;
-
         if (media.error)
             return false;