Title: [228462] branches/safari-605-branch
Revision
228462
Author
jmarc...@apple.com
Date
2018-02-13 22:57:41 -0800 (Tue, 13 Feb 2018)

Log Message

Cherry-pick r228445. rdar://problem/37523940

Modified Paths

Diff

Modified: branches/safari-605-branch/LayoutTests/ChangeLog (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/ChangeLog	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/ChangeLog	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,5 +1,40 @@
 2018-02-13  Jason Marcell  <jmarc...@apple.com>
 
+        Cherry-pick r228445. rdar://problem/37523940
+
+    2018-02-13  Antoine Quint  <grao...@apple.com>
+
+            Removing the controls attribute from a <video> element does not tear down the controls shadow DOM nor cancel event listeners.
+            https://bugs.webkit.org/show_bug.cgi?id=182668
+
+            Reviewed by Jer Noble.
+
+            Ensure controls are turned on for a number of tests that would fail otherwise since media events would not be handled by media
+            controls without it.
+
+            * http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html:
+            * http/tests/media/modern-media-controls/pip-support/pip-support-live-broadcast.html:
+            * http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html:
+            * http/tests/media/modern-media-controls/skip-back-support/skip-back-support-live-broadcast.html:
+            * http/tests/media/modern-media-controls/status-support/status-support-live-broadcast.html:
+            * http/tests/media/modern-media-controls/status-support/status-support-loading.html:
+            * media/modern-media-controls/airplay-support/airplay-support.html:
+            * media/modern-media-controls/mute-support/mute-support-media-api.html:
+            * media/modern-media-controls/playback-support/playback-support-autoplay.html:
+            * media/modern-media-controls/playback-support/playback-support-media-api.html:
+            * media/modern-media-controls/start-support/start-support-error.html:
+            * media/modern-media-controls/start-support/start-support-lowPowerMode.html:
+            * media/modern-media-controls/start-support/start-support-manual-play.html:
+            * media/modern-media-controls/status-support/status-support-error.html:
+            * media/modern-media-controls/time-labels-support/elapsed-time.html:
+            * media/modern-media-controls/time-labels-support/remaining-time.html:
+            * media/modern-media-controls/tracks-support/tracks-support-audio-tracks.html:
+            * media/modern-media-controls/tracks-support/tracks-support-text-tracks.html:
+            * media/modern-media-controls/volume-support/volume-support-media-api-mute.html:
+            * media/modern-media-controls/volume-support/volume-support-media-api.html:
+
+2018-02-13  Jason Marcell  <jmarc...@apple.com>
+
         Cherry-pick r228435. rdar://problem/37518843
 
     2018-02-13  Antti Koivisto  <an...@apple.com>

Modified: branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -2,7 +2,7 @@
 <script src=""
 <script src=""
 <body>
-<video src="" style="width: 800px;" autoplay></video>
+<video src="" style="width: 800px;" autoplay controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/pip-support/pip-support-live-broadcast.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/pip-support/pip-support-live-broadcast.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/pip-support/pip-support-live-broadcast.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src=""
 <body>
-<video src="" style="width: 800px;" autoplay></video>
+<video src="" style="width: 800px;" autoplay controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src=""
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-live-broadcast.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-live-broadcast.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-live-broadcast.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src=""
 <body>
-<video src="" style="width: 800px;" autoplay></video>
+<video src="" style="width: 800px;" autoplay controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/status-support/status-support-live-broadcast.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/status-support/status-support-live-broadcast.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/status-support/status-support-live-broadcast.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src=""
 <body>
-<video src="" style="width: 320px; height: 240px;" autoplay></video>
+<video src="" style="width: 320px; height: 240px;" autoplay controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/status-support/status-support-loading.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/status-support/status-support-loading.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/http/tests/media/modern-media-controls/status-support/status-support-loading.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src=""
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/airplay-support/airplay-support.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/airplay-support/airplay-support.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/airplay-support/airplay-support.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;" autoplay></video>
+<video src="" style="width: 320px; height: 240px;" autoplay controls></video>
 <div id="host"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/mute-support/mute-support-media-api.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/mute-support/mute-support-media-api.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/mute-support/mute-support-media-api.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/playback-support/playback-support-autoplay.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/playback-support/playback-support-autoplay.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/playback-support/playback-support-autoplay.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;" autoplay></video>
+<video src="" style="width: 320px; height: 240px;" autoplay controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/playback-support/playback-support-media-api.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/playback-support/playback-support-media-api.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/playback-support/playback-support-media-api.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/start-support/start-support-error.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/start-support/start-support-error.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/start-support/start-support-error.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/start-support/start-support-lowPowerMode.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/start-support/start-support-lowPowerMode.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/start-support/start-support-lowPowerMode.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -45,6 +45,9 @@
         endTest();
     }
 });
+
+setTimeout(finishJSTest, 5000);
+
 </script>
 <script src=""
 </body>

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/start-support/start-support-manual-play.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/start-support/start-support-manual-play.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/start-support/start-support-manual-play.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/status-support/status-support-error.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/status-support/status-support-error.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/status-support/status-support-error.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/time-labels-support/elapsed-time.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/time-labels-support/elapsed-time.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/time-labels-support/elapsed-time.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/time-labels-support/remaining-time.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/time-labels-support/remaining-time.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/time-labels-support/remaining-time.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-audio-tracks.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-audio-tracks.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-audio-tracks.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-text-tracks.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-text-tracks.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-text-tracks.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/volume-support/volume-support-media-api-mute.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/volume-support/volume-support-media-api-mute.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/volume-support/volume-support-media-api-mute.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/LayoutTests/media/modern-media-controls/volume-support/volume-support-media-api.html (228461 => 228462)


--- branches/safari-605-branch/LayoutTests/media/modern-media-controls/volume-support/volume-support-media-api.html	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/LayoutTests/media/modern-media-controls/volume-support/volume-support-media-api.html	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,7 +1,7 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
-<video src="" style="width: 320px; height: 240px;"></video>
+<video src="" style="width: 320px; height: 240px;" controls></video>
 <div id="shadow"></div>
 <script type="text/_javascript_">
 

Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (228461 => 228462)


--- branches/safari-605-branch/Source/WebCore/ChangeLog	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog	2018-02-14 06:57:41 UTC (rev 228462)
@@ -1,5 +1,44 @@
 2018-02-13  Jason Marcell  <jmarc...@apple.com>
 
+        Cherry-pick r228445. rdar://problem/37523940
+
+    2018-02-13  Antoine Quint  <grao...@apple.com>
+
+            Removing the controls attribute from a <video> element does not tear down the controls shadow DOM nor cancel event listeners.
+            https://bugs.webkit.org/show_bug.cgi?id=182668
+            <rdar://problem/33793004>
+
+            Reviewed by Jer Noble.
+
+            When controls were turned off for inline media players, we would remove all media controls elements from the shadow root,
+            but we would nevertheless continue to listen to media events and, as a result, update properties of the media controls
+            which would lead to requestAnimationFrame() calls that would update the detached DOM nodes.
+
+            We now only listent to media events if controls are turned on.
+
+            * Modules/modern-media-controls/media/controls-visibility-support.js:
+            (ControlsVisibilitySupport.prototype.enable): Remove the mutation observer from ControlsVisibilitySupport since observing
+            changes to the controls attribute is now performed directly in MediaController. We need to make sure that we update the
+            controls however since fadesWhileIdle is turned off in the disable() call to ensure that the auto-hide behavior is disabled
+            as well.
+            (ControlsVisibilitySupport.prototype.disable): Disable the auto-hide controller as well.
+            (ControlsVisibilitySupport.prototype._updateControls): Remove code that has now been moved into MediaController._updateControlsAvailability().
+            * Modules/modern-media-controls/media/media-controller.js:
+            (MediaController): Listen to the "play" event on the media so that we call _updateControlsAvailability() in this situation to account for
+            shouldForceControlsDisplay on MediaControlsHost. We also register for a mutation observer to track when the controls attribute availability
+            changes in which case we want to call _updateControlsAvailability() as well.
+            (MediaController.prototype.handleEvent): Call _updateControlsAvailability() instead of _updateiOSFullscreenProperties() which has been renamed
+            and expanded.
+            (MediaController.prototype._updateControlsIfNeeded): Call _updateControlsAvailability() after controls have been updated.
+            (MediaController.prototype._updateControlsAvailability): We now disable supporting media controller objects when we know that controls should
+            be hidden in all cases except when in fullscreen on macOS.
+            (MediaController.prototype._updateiOSFullscreenProperties): Deleted.
+            * Modules/modern-media-controls/media/placard-support.js:
+            (PlacardSupport.prototype.disable): Only allow the media events required to track when to show placards when in fullscreen since inline media
+            players need to show the AirPlay and picture-in-picture placards even when controls are disabled.
+
+2018-02-13  Jason Marcell  <jmarc...@apple.com>
+
         Cherry-pick r228430. rdar://problem/37518683
 
     2018-02-13  Chris Dumez  <cdu...@apple.com>

Modified: branches/safari-605-branch/Source/WebCore/Modules/modern-media-controls/media/controls-visibility-support.js (228461 => 228462)


--- branches/safari-605-branch/Source/WebCore/Modules/modern-media-controls/media/controls-visibility-support.js	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/Source/WebCore/Modules/modern-media-controls/media/controls-visibility-support.js	2018-02-14 06:57:41 UTC (rev 228462)
@@ -38,23 +38,13 @@
     enable()
     {
         super.enable();
-
-        if (this._controlsAttributeObserver)
-            return;
-
-        this._controlsAttributeObserver = new MutationObserver(this._updateControls.bind(this));
-        this._controlsAttributeObserver.observe(this.mediaController.media, { attributes: true, attributeFilter: ["controls"] });
+        this._updateControls();
     }
 
     disable()
     {
         super.disable();
-
-        if (!this._controlsAttributeObserver)
-            return;
-
-        this._controlsAttributeObserver.disconnect();
-        delete this._controlsAttributeObserver;
+        this.mediaController.controls.autoHideController.fadesWhileIdle = false;
     }
 
     get mediaEvents()
@@ -77,13 +67,8 @@
     _updateControls()
     {
         const media = this.mediaController.media;
-        const host = this.mediaController.host;
-        const shouldShowControls = !!(media.controls || (host && host.shouldForceControlsDisplay) || this.mediaController.isFullscreen);
         const isVideo = media instanceof HTMLVideoElement && media.videoTracks.length > 0;
-
-        const controls = this.mediaController.controls;
-        controls.visible = shouldShowControls;
-        controls.autoHideController.fadesWhileIdle = isVideo ? !media.paused && !media.webkitCurrentPlaybackTargetIsWireless : false;
+        this.mediaController.controls.autoHideController.fadesWhileIdle = isVideo ? !media.paused && !media.webkitCurrentPlaybackTargetIsWireless : false;
     }
 
 }

Modified: branches/safari-605-branch/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (228461 => 228462)


--- branches/safari-605-branch/Source/WebCore/Modules/modern-media-controls/media/media-controller.js	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/Source/WebCore/Modules/modern-media-controls/media/media-controller.js	2018-02-14 06:57:41 UTC (rev 228462)
@@ -56,9 +56,12 @@
         media.videoTracks.addEventListener("addtrack", this);
         media.videoTracks.addEventListener("removetrack", this);
 
+        media.addEventListener("play", this);
         media.addEventListener(this.fullscreenChangeEventType, this);
 
         window.addEventListener("keydown", this);
+
+        new MutationObserver(this._updateControlsAvailability.bind(this)).observe(this.media, { attributes: true, attributeFilter: ["controls"] });
     }
 
     // Public
@@ -164,7 +167,7 @@
             scheduler.flushScheduledLayoutCallbacks();
         } else if (event.currentTarget === this.media) {
             this._updateControlsIfNeeded();
-            this._updateiOSFullscreenProperties();
+            this._updateControlsAvailability();
             if (event.type === "webkitpresentationmodechanged")
                 this._returnMediaLayerToInlineIfNeeded();
         } else if (event.type === "keydown" && this.isFullscreen && event.key === " ") {
@@ -214,6 +217,8 @@
         }, this);
 
         this.controls.shouldUseSingleBarLayout = this.controls instanceof InlineMediaControls && this.isYouTubeEmbedWithTitle;
+
+        this._updateControlsAvailability();
     }
 
     _updateControlsSize()
@@ -300,20 +305,16 @@
         this._supportingObjects.forEach(supportingObject => supportingObject.controlsUserVisibilityDidChange());
     }
 
-    _updateiOSFullscreenProperties()
+    _updateControlsAvailability()
     {
-        // On iOS, we want to make sure not to update controls when we're in fullscreen since the UI
-        // will be completely invisible.
-        if (!(this.layoutTraits & LayoutTraits.iOS))
-            return;
+        const shouldControlsBeAvailable = !!(this.media.controls || (this.host && this.host.shouldForceControlsDisplay) || ((this.layoutTraits & LayoutTraits.macOS) && this.isFullscreen));
 
-        const isFullscreen = this.isFullscreen;
-        if (isFullscreen)
+        if (!shouldControlsBeAvailable)
             this._supportingObjects.forEach(supportingObject => supportingObject.disable());
         else
             this._supportingObjects.forEach(supportingObject => supportingObject.enable());
 
-        this.controls.visible = !isFullscreen;
+        this.controls.visible = shouldControlsBeAvailable;
     }
 
 }

Modified: branches/safari-605-branch/Source/WebCore/Modules/modern-media-controls/media/placard-support.js (228461 => 228462)


--- branches/safari-605-branch/Source/WebCore/Modules/modern-media-controls/media/placard-support.js	2018-02-14 06:57:35 UTC (rev 228461)
+++ branches/safari-605-branch/Source/WebCore/Modules/modern-media-controls/media/placard-support.js	2018-02-14 06:57:41 UTC (rev 228462)
@@ -44,6 +44,14 @@
         this._updatePlacard();
     }
 
+    disable()
+    {
+        // We should not allow disabling Placard support when playing inline as it would prevent the
+        // PiP placard from being shown if the controls are disabled.
+        if (this.mediaController.isFullscreen)
+            super.disable();
+    }
+
     // Private
 
     _updatePlacard()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to