Bug 1431255 - Part XI, Remove bogus comments in videocontrols.js draft
authorTimothy Guan-tin Chien <timdream@gmail.com>
Fri, 06 Jul 2018 22:39:10 +0800
changeset 829416 32e394f34461013857092d5b48c3d0b40758b02a
parent 829415 ed962ec1413f1b58ee5e3ad3894c7d9dafd93b43
child 829417 ee261a1a6ea580a1b2ba693e60b808f21455f779
push id118779
push usertimdream@gmail.com
push dateWed, 15 Aug 2018 23:50:47 +0000
bugs1431255
milestone63.0a1
Bug 1431255 - Part XI, Remove bogus comments in videocontrols.js Also removing unremoved <xul:slider> properties and workarounds. MozReview-Commit-ID: 8JrcDyDOBWS
toolkit/content/widgets/videocontrols.js
--- a/toolkit/content/widgets/videocontrols.js
+++ b/toolkit/content/widgets/videocontrols.js
@@ -171,17 +171,17 @@ this.VideoControlsImplPageWidget = class
                  " networkState=" + this.video.networkState +
                  " timeUpdateCount=" + this.timeUpdateCount +
                  " _showThrobberTimer=" + this._showThrobberTimer +
                  " --> " + (show ? "SHOW" : "HIDE"));
         this.startFade(this.statusOverlay, show, immediate);
       },
 
       /*
-      * Set the initial state of the controls. The binding is normally created along
+      * Set the initial state of the controls. The UA widget is normally created along
       * with video element, but could be attached at any point (eg, if the video is
       * removed from the document and then reinserted). Thus, some one-time events may
       * have already fired, and so we'll need to explicitly check the initial state.
       */
       setupInitialState() {
         this.setPlayButtonState(this.video.paused);
 
         this.setFullscreenButtonState();
@@ -198,28 +198,25 @@ this.VideoControlsImplPageWidget = class
         // If we have metadata, check if this is a <video> without
         // video data, or a video with no audio track.
         if (this.video.readyState >= this.video.HAVE_METADATA) {
           if (this.video instanceof this.window.HTMLVideoElement &&
               (this.video.videoWidth == 0 || this.video.videoHeight == 0)) {
             this.isAudioOnly = true;
           }
 
-          // We have to check again if the media has audio here,
-          // because of bug 718107: switching to fullscreen may
-          // cause the bindings to detach and reattach, hence
-          // unsetting the attribute.
+          // We have to check again if the media has audio here.
           if (!this.isAudioOnly && !this.video.mozHasAudio) {
             this.muteButton.setAttribute("noAudio", "true");
             this.muteButton.setAttribute("disabled", "true");
           }
         }
 
         // We should lock the orientation if we are already in
-        // fullscreen and were reattached because of bug 718107.
+        // fullscreen.
         this.updateOrientationState(this.isVideoInFullScreen);
 
         if (this.isAudioOnly) {
           this.clickToPlay.hidden = true;
         }
 
         // If the first frame hasn't loaded, kick off a throbber fade-in.
         if (this.video.readyState >= this.video.HAVE_CURRENT_DATA) {
@@ -318,26 +315,19 @@ this.VideoControlsImplPageWidget = class
 
         // Can only update the volume controls once we've computed
         // _volumeControlWidth, since the volume slider implementation
         // depends on it.
         this.updateVolumeControls();
       },
 
       setupNewLoadState() {
-        // videocontrols.css hides the control bar by default, because if script
-        // is disabled our binding's script is disabled too (bug 449358). Thus,
-        // the controls are broken and we don't want them shown. But if script is
-        // enabled, the code here will run and can explicitly unhide the controls.
-        //
         // 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);
         // 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.controlBar, shouldShow, true);
@@ -833,25 +823,17 @@ this.VideoControlsImplPageWidget = class
         let timeString = isInfinite ? "" : this.formatTime(duration);
         this.positionDurationBox.duration = timeString;
 
         if (this.showHours) {
           this.positionDurationBox.modifier = "long";
           this.durationSpan.modifier = "long";
         }
 
-        // "durationValue" property is used by scale binding to
-        // generate accessible name.
-        this.scrubber.durationValue = timeString;
-
         this.scrubber.max = duration;
-        // XXX Can't set increment here, due to bug 473103. Also, doing so causes
-        // snapping when dragging with the mouse, so we can't just set a value for
-        // the arrow-keys.
-        this.scrubber.pageIncrement = Math.round(duration / 10);
       },
 
       pauseVideoDuringDragging() {
         if (!this.video.paused &&
             !this.isPausedByDragging &&
             this.scrubber.isDragging) {
           this.isPausedByDragging = true;
           this.video.pause();
@@ -1135,23 +1117,16 @@ this.VideoControlsImplPageWidget = class
         // All it offered is a then() method to register a callback
         // to be triggered at the right time.
         Object.defineProperty(animation, "finished", { value: handler, configurable: true });
         animation.addEventListener("finish", handler);
         animation.addEventListener("cancel", handler);
       },
 
       startFade(element, fadeIn, immediate = false) {
-        // Bug 493523, the scrubber doesn't call valueChanged while hidden,
-        // so our dependent state (eg, timestamp in the thumb) will be stale.
-        // As a workaround, update it manually when it first becomes unhidden.
-        if (element == this.controlBar && fadeIn && element.hidden) {
-          this.scrubber.value = this.video.currentTime * 1000;
-        }
-
         let animationProp =
           this.animationProps[element.id];
         if (!animationProp) {
           throw new Error("Element " + element.id +
             " has no transition. Toggle the hidden property directly.");
         }
 
         let animation = this.animationMap.get(element);