Bug 1336400 - part1 : remove MozAutoplayEnabled from videocontrols.xml. draft
authorAlastor Wu <alwu@mozilla.com>
Mon, 13 Nov 2017 18:24:36 +0800
changeset 697106 4c4497a42ffac32932cef0a227296cd310e402cf
parent 697105 9767167d13e3c5b27ba6a69ff56b78aeb0f635bd
child 697107 0875dbcbaa432afd6eaf1d5e450539672b27303f
push id88894
push useralwu@mozilla.com
push dateMon, 13 Nov 2017 10:44:33 +0000
bugs1336400
milestone58.0a1
Bug 1336400 - part1 : remove MozAutoplayEnabled from videocontrols.xml. MozReview-Commit-ID: 8rZtAfRpjge
toolkit/content/widgets/videocontrols.xml
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -437,17 +437,17 @@
         //
         // For videos with |autoplay| set, we'll leave the controls initially hidden,
         // so that they don't get in the way of the playing video. Otherwise we'll
         // go ahead and reveal the controls now, so they're an obvious user cue.
         //
         // (Note: the |controls| attribute is already handled via layout/style/html.css)
         var shouldShow = !this.dynamicControls ||
                          (this.video.paused &&
-                         !(this.video.autoplay && this.video.mozAutoplayEnabled));
+                         !this.video.autoplay);
         // Hide the overlay if the video time is non-zero or if an error occurred to workaround bug 718107.
         let shouldClickToPlayShow = shouldShow && !this.isAudioOnly &&
                                     this.video.currentTime == 0 && !this.hasError();
         this.startFade(this.clickToPlay, shouldClickToPlayShow, true);
         this.startFade(this.controlsSpacer, shouldClickToPlayShow, true);
         this.startFade(this.controlBar, shouldShow, true);
       },
 
@@ -1022,17 +1022,17 @@
         }
 
         clearTimeout(this._hideControlsTimeout);
 
         // Suppress fading out the controls until the video has rendered
         // its first frame. But since autoplay videos start off with no
         // controls, let them fade-out so the controls don't get stuck on.
         if (!this.firstFrameShown &&
-            !(this.video.autoplay && this.video.mozAutoplayEnabled)) {
+            !this.video.autoplay) {
           return;
         }
 
         if (this._controlsHiddenByTimeout) {
           this._showControlsTimeout = setTimeout(this._showControlsFn, this.SHOW_CONTROLS_TIMEOUT_MS);
         } else {
           this.startFade(this.controlBar, true);
         }
@@ -1070,17 +1070,17 @@
         event.clientY < controlRect.bottom &&
         event.clientX > controlRect.left &&
         event.clientX < controlRect.right;
 
         // Suppress fading out the controls until the video has rendered
         // its first frame. But since autoplay videos start off with no
         // controls, let them fade-out so the controls don't get stuck on.
         if (!this.firstFrameShown && !isMouseOver &&
-            !(this.video.autoplay && this.video.mozAutoplayEnabled)) {
+            !this.video.autoplay) {
           return;
         }
 
         if (!isMouseOver && !isMouseInControls) {
           this.adjustControlSize();
 
           // Keep the controls visible if the click-to-play is visible.
           if (!this.clickToPlay.hidden) {
@@ -2267,20 +2267,16 @@
           elem.addEventListener(eventName, boundFunc, { mozSystemGroup: true });
         }
         addListener(this.clickToPlay, "click", this.clickToPlayClickHandler);
         addListener(this.video, "MozNoControlsBlockedVideo", this.blockedVideoHandler);
 
         for (let event of this.videoEvents) {
           this.video.addEventListener(event, this, { mozSystemGroup: true });
         }
-
-        if (this.video.autoplay && !this.video.mozAutoplayEnabled) {
-          this.blockedVideoHandler();
-        }
       }
     };
     this.Utils.init(this);
     this.Utils.video.dispatchEvent(new CustomEvent("MozNoControlsVideoBindingAttached"));
     ]]>
   </constructor>
   <destructor>
     <![CDATA[