Title: [212868] trunk
Revision
212868
Author
[email protected]
Date
2017-02-22 17:48:40 -0800 (Wed, 22 Feb 2017)

Log Message

[Modern Media Controls] Controls bar may disappear while captions menu is visible
https://bugs.webkit.org/show_bug.cgi?id=168751
<rdar://problem/30663411>

Patch by Antoine Quint <[email protected]> on 2017-02-22
Reviewed by Dean Jackson.

Source/WebCore:

We now prevent the controls bar from fading out due to the auto-hide timer firing
when the tracks panel is up, and wait until the track panel is hidden before fading
the controls bar.

Test: media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html

* Modules/modern-media-controls/controls/controls-bar.js:
(ControlsBar.prototype.set userInteractionEnabled):
(ControlsBar.prototype._autoHideTimerFired):

LayoutTests:

Add a new test to check that we correctly prevent the controls bar from fading out
due to the auto-hide timer firing when the tracks panel is up, and that it fades
once the track panel disappears after the auto-hide timer has fired.

* media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading-expected.txt: Added.
* media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (212867 => 212868)


--- trunk/LayoutTests/ChangeLog	2017-02-23 01:37:32 UTC (rev 212867)
+++ trunk/LayoutTests/ChangeLog	2017-02-23 01:48:40 UTC (rev 212868)
@@ -1,5 +1,20 @@
 2017-02-22  Antoine Quint  <[email protected]>
 
+        [Modern Media Controls] Controls bar may disappear while captions menu is visible
+        https://bugs.webkit.org/show_bug.cgi?id=168751
+        <rdar://problem/30663411>
+
+        Reviewed by Dean Jackson.
+
+        Add a new test to check that we correctly prevent the controls bar from fading out
+        due to the auto-hide timer firing when the tracks panel is up, and that it fades
+        once the track panel disappears after the auto-hide timer has fired.
+
+        * media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading-expected.txt: Added.
+        * media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html: Added.
+
+2017-02-22  Antoine Quint  <[email protected]>
+
         [Modern Media Controls] Can't set the volume slider with macOS inline controls
         https://bugs.webkit.org/show_bug.cgi?id=168747
         <rdar://problem/30605528>

Added: trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading-expected.txt (0 => 212868)


--- trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading-expected.txt	2017-02-23 01:48:40 UTC (rev 212868)
@@ -0,0 +1,18 @@
+Showing the tracks panel should suspend the auto-hide behavior until it's hidden.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+mediaControls.showTracksPanel()
+PASS mediaControls.tracksPanel.element.parentNode became mediaControls.element
+
+We've waited long enough so that the controls bar should be faded should the tracks panel not be visible
+PASS mediaControls.controlsBar.faded is false
+
+mediaControls.hideTracksPanel()
+PASS mediaControls.controlsBar.faded is true
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html (0 => 212868)


--- trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html	2017-02-23 01:48:40 UTC (rev 212868)
@@ -0,0 +1,53 @@
+<script src=""
+<script src="" type="text/_javascript_"></script>
+<body>
+<style type="text/css" media="screen">
+    
+    .media-controls {
+        position: absolute;
+        top: 0;
+        left: 0;
+    }
+    
+</style>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Showing the tracks panel should suspend the auto-hide behavior until it's hidden.");
+
+const mediaControls = new MacOSInlineMediaControls({ width: 680, height: 300 });
+
+document.body.appendChild(mediaControls.element);
+
+let trackElement;
+
+mediaControls.controlsBar.autoHideDelay = 250;
+mediaControls.controlsBar.fadesWhileIdle = true;
+
+debug("mediaControls.showTracksPanel()");
+mediaControls.showTracksPanel();
+
+shouldBecomeEqual("mediaControls.tracksPanel.element.parentNode", "mediaControls.element", () => {
+    // Let's wait a while to see that the controls bar is still visible.
+    setTimeout(() => {
+        debug("");
+        debug("We've waited long enough so that the controls bar should be faded should the tracks panel not be visible");
+        shouldBeFalse("mediaControls.controlsBar.faded");
+
+        // And now dismiss the tracks panel and check that the controls bar
+        // fades out as well.
+        debug("");
+        debug("mediaControls.hideTracksPanel()");
+        mediaControls.hideTracksPanel();
+        shouldBeTrue("mediaControls.controlsBar.faded");
+
+        debug("");
+        mediaControls.element.remove();
+        finishJSTest();
+    }, mediaControls.controlsBar.autoHideDelay);
+});
+
+</script>
+<script src=""
+</body>

Modified: trunk/Source/WebCore/ChangeLog (212867 => 212868)


--- trunk/Source/WebCore/ChangeLog	2017-02-23 01:37:32 UTC (rev 212867)
+++ trunk/Source/WebCore/ChangeLog	2017-02-23 01:48:40 UTC (rev 212868)
@@ -1,5 +1,23 @@
 2017-02-22  Antoine Quint  <[email protected]>
 
+        [Modern Media Controls] Controls bar may disappear while captions menu is visible
+        https://bugs.webkit.org/show_bug.cgi?id=168751
+        <rdar://problem/30663411>
+
+        Reviewed by Dean Jackson.
+
+        We now prevent the controls bar from fading out due to the auto-hide timer firing
+        when the tracks panel is up, and wait until the track panel is hidden before fading
+        the controls bar.
+
+        Test: media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html
+
+        * Modules/modern-media-controls/controls/controls-bar.js:
+        (ControlsBar.prototype.set userInteractionEnabled):
+        (ControlsBar.prototype._autoHideTimerFired):
+
+2017-02-22  Antoine Quint  <[email protected]>
+
         [Modern Media Controls] Can't set the volume slider with macOS inline controls
         https://bugs.webkit.org/show_bug.cgi?id=168747
         <rdar://problem/30605528>

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/controls-bar.js (212867 => 212868)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/controls-bar.js	2017-02-23 01:37:32 UTC (rev 212867)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/controls-bar.js	2017-02-23 01:48:40 UTC (rev 212868)
@@ -70,6 +70,10 @@
 
         this._userInteractionEnabled = flag;
         this.markDirtyProperty("userInteractionEnabled");
+
+        if (this._userInteractionEnabled && this._controlsShouldFadeWhenUserInteractionBecomesEnabled)
+            this.faded = true;
+        delete this._controlsShouldFadeWhenUserInteractionBecomesEnabled;
     }
 
     get fadesWhileIdle()
@@ -240,7 +244,16 @@
             return;
 
         this._cancelAutoHideTimer();
-        this.faded = this._fadesWhileIdle;
+        if (!this._fadesWhileIdle)
+            return;
+
+        // We don't want to fade the controls when user interaction becomes disabled
+        // because secondary UI attached to the controls is being shown and we want
+        // to wait until it no longer is to fade the controls out.
+        if (!this._userInteractionEnabled)
+            this._controlsShouldFadeWhenUserInteractionBecomesEnabled = true;
+        else
+            this.faded = true;
     }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to