Bug 1560416 - Hide the Picture-in-Picture toggle by default when initializing a video binding. r=JSON_voorhees
authorMike Conley <mconley@mozilla.com>
Tue, 25 Jun 2019 18:03:30 +0000
changeset 480062 75c588f5f2259a17487138f05b26e383f6328816
parent 480061 efa19cd2bba83fed6c27660036ca56bd06eee299
child 480063 ae83f2b3979f536a0e24ca8730753eb6ef2974d4
push id36200
push useraiakab@mozilla.com
push dateTue, 25 Jun 2019 21:58:14 +0000
treeherdermozilla-central@b23bd78e4d94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJSON_voorhees
bugs1560416
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1560416 - Hide the Picture-in-Picture toggle by default when initializing a video binding. r=JSON_voorhees Later, once we have enough video metadata, the binding will decide whether or not to display the toggle again. Differential Revision: https://phabricator.services.mozilla.com/D35811
toolkit/content/widgets/videocontrols.js
--- a/toolkit/content/widgets/videocontrols.js
+++ b/toolkit/content/widgets/videocontrols.js
@@ -317,16 +317,20 @@ this.VideoControlsImplWidget = class {
           this.startFadeOut(this.clickToPlay, true);
           this.statusIcon.setAttribute("type", "error");
           this.updateErrorText();
           this.setupStatusFader(true);
         } else if (VideoControlsWidget.isPictureInPictureVideo(this.video)) {
           this.setShowPictureInPictureMessage(true);
         }
 
+        // Default the Picture-in-Picture toggle button to being hidden. We might unhide it
+        // later if we determine that this video is qualified to show it.
+        this.pictureInPictureToggleButton.setAttribute("hidden", true);
+
         if (this.video.readyState >= this.video.HAVE_METADATA) {
           // According to the spec[1], at the HAVE_METADATA (or later) state, we know
           // the video duration and dimensions, which means we can calculate whether or
           // not to show the Picture-in-Picture toggle now.
           //
           // [1]: https://www.w3.org/TR/html50/embedded-content-0.html#dom-media-have_metadata
           this.updatePictureInPictureToggleDisplay();
         }
@@ -2665,16 +2669,20 @@ this.NoControlsDesktopImplWidget = class
 
         this.pictureInPictureToggleButton =
           this.shadowRoot.getElementById("pictureInPictureToggleButton");
 
         if (this.document.fullscreenElement) {
           this.videocontrols.setAttribute("inDOMFullscreen", true);
         }
 
+        // Default the Picture-in-Picture toggle button to being hidden. We might unhide it
+        // later if we determine that this video is qualified to show it.
+        this.pictureInPictureToggleButton.setAttribute("hidden", true);
+
         if (this.video.readyState >= this.video.HAVE_METADATA) {
           // According to the spec[1], at the HAVE_METADATA (or later) state, we know
           // the video duration and dimensions, which means we can calculate whether or
           // not to show the Picture-in-Picture toggle now.
           //
           // [1]: https://www.w3.org/TR/html50/embedded-content-0.html#dom-media-have_metadata
           this.updatePictureInPictureToggleDisplay();
         }