Bug 1319569 - Remove unused timeThumb binding in videocontrols.xml and unreferenced statistics formatting styling from videocontrols.css. r=jaws
authorRay Lin <ralin@mozilla.com>
Fri, 16 Dec 2016 02:22:00 -0500
changeset 450682 449c5354f001f0cb0fc6e5a12451b3c877f3bbed
parent 450681 f9e9d46e10ea4ce7fd970515ad7ad222da9128c7
child 450683 90b91d69b5760c4bb454ae6d6ad4e04ae3782f20
push id38944
push userbmo:leftysolara@gmail.com
push dateSun, 18 Dec 2016 16:01:15 +0000
reviewersjaws
bugs1319569, 1271765, 1270853
milestone53.0a1
Bug 1319569 - Remove unused timeThumb binding in videocontrols.xml and unreferenced statistics formatting styling from videocontrols.css. r=jaws The timeThumb is no longer used since bug 1271765 and the statistics were removed by bug 1270853. MozReview-Commit-ID: 3Pwl381IBdz
toolkit/content/widgets/videocontrols.css
toolkit/content/widgets/videocontrols.xml
--- a/toolkit/content/widgets/videocontrols.css
+++ b/toolkit/content/widgets/videocontrols.css
@@ -5,20 +5,16 @@
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 @namespace html url("http://www.w3.org/1999/xhtml");
 
 .scrubber,
 .volumeControl {
   -moz-binding: url("chrome://global/content/bindings/videocontrols.xml#suppressChangeEvent");
 }
 
-.scrubber .scale-thumb {
-  -moz-binding: url("chrome://global/content/bindings/videocontrols.xml#timeThumb");
-}
-
 .playButton,
 .muteButton,
 .scrubber .scale-slider,
 .volumeControl .scale-slider {
   -moz-user-focus: none;
 }
 
 .controlBar[fullscreen-unavailable] > .fullscreenButton {
@@ -67,57 +63,16 @@
   transition-property: opacity;
   transition-duration: 1ms;
   transition-delay: 750ms;
 }
 .statusOverlay[fadeout] {
   opacity: 0;
 }
 
-/* Statistics formatting */
-html|td.statLabel {
-  font-weight: bold;
-  max-width: 20%;
-  white-space: nowrap;
-}
-html|td.statValue {
-  max-width: 30%;
-}
-html|td.filename {
-  max-width: 80%;
-  white-space: nowrap;
-  overflow: hidden;
-  text-overflow: ellipsis;
-}
-html|span.statActivity > html|span {
-  display: none;
-}
-html|span.statActivity[activity="paused"] > html|span.statActivityPaused,
-html|span.statActivity[activity="playing"] > html|span.statActivityPlaying,
-html|span.statActivity[activity="ended"] > html|span.statActivityEnded,
-html|span.statActivity[seeking] > html|span.statActivitySeeking {
-  display: inline;
-}
-
-.controlBar[size="hidden"],
-.controlBar[size="small"] .durationBox,
-.controlBar[size="small"] .durationLabel,
-.controlBar[size="small"] .positionLabel,
-.controlBar[size="small"] .volumeStack {
-  visibility: collapse;
-}
-
-.controlBar[size="small"] .scrubberStack,
-.controlBar[size="small"] .backgroundBar,
-.controlBar[size="small"] .bufferBar,
-.controlBar[size="small"] .progressBar,
-.controlBar[size="small"] .scrubber {
-  visibility: hidden;
-}
-
 /* Error description formatting */
 .errorLabel {
   display: none;
 }
 
 [error="errorAborted"]         > [anonid="errorAborted"],
 [error="errorNetwork"]         > [anonid="errorNetwork"],
 [error="errorDecode"]          > [anonid="errorDecode"],
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -10,191 +10,102 @@
 
 <bindings id="videoControlBindings"
           xmlns="http://www.mozilla.org/xbl"
           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
           xmlns:xbl="http://www.mozilla.org/xbl"
           xmlns:svg="http://www.w3.org/2000/svg"
           xmlns:html="http://www.w3.org/1999/xhtml">
 
-<binding id="timeThumb"
-         extends="chrome://global/content/bindings/scale.xml#scalethumb">
-  <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-    <xbl:children/>
-    <hbox class="timeThumb" xbl:inherits="showhours">
-      <label class="timeLabel"/>
-    </hbox>
-  </xbl:content>
-  <implementation>
-
-  <constructor>
-    <![CDATA[
-    this.timeLabel = document.getAnonymousElementByAttribute(this, "class", "timeLabel");
-    this.timeLabel.setAttribute("value", "0:00");
-    ]]>
-  </constructor>
-
-  <property name="showHours">
-    <getter>
-      <![CDATA[
-      return this.getAttribute("showhours") == "true";
-      ]]>
-    </getter>
-    <setter>
-      <![CDATA[
-      this.setAttribute("showhours", val);
-      // If the duration becomes known while we're still showing the value
-      // for time=0, immediately update the value to show or hide the hours.
-      // It's less intrusive to do it now than when the user clicks play and
-      // is looking right next to the thumb.
-      if (!this.timeLabel) {
-        return;
-      }
-      var displayedTime = this.timeLabel.getAttribute("value");
-      if (val && displayedTime == "0:00") {
-        this.timeLabel.setAttribute("value", "0:00:00");
-      } else if (!val && displayedTime == "0:00:00") {
-        this.timeLabel.setAttribute("value", "0:00");
-      }
-      ]]>
-    </setter>
-  </property>
-
-  <method name="setTime">
-    <parameter name="time"/>
-    <body>
-      <![CDATA[
-      var timeString;
-      time = Math.round(time / 1000);
-      var hours = Math.floor(time / 3600);
-      var mins  = Math.floor((time % 3600) / 60);
-      var secs  = Math.floor(time % 60);
-      if (secs < 10) {
-        secs = "0" + secs;
-      }
-      if (hours || this.showHours) {
-        if (mins < 10) {
-          mins = "0" + mins;
-        }
-        timeString = hours + ":" + mins + ":" + secs;
-      } else {
-        timeString = mins + ":" + secs;
-      }
-
-      this.timeLabel.setAttribute("value", timeString);
-      ]]>
-    </body>
-  </method>
-  </implementation>
-</binding>
-
 <binding id="suppressChangeEvent"
          extends="chrome://global/content/bindings/scale.xml#scale">
 <implementation implements="nsIXBLAccessible">
   <!-- nsIXBLAccessible -->
   <property name="accessibleName" readonly="true">
     <getter>
-      if (this.type != "scrubber") {
-        return "";
-      }
-
-      var currTime = this.thumb.timeLabel.getAttribute("value");
+      var currTime = this.positionValue;
       var totalTime = this.durationValue;
 
       return this.scrubberNameFormat
                  .replace(/#1/, currTime)
                  .replace(/#2/, totalTime);
     </getter>
   </property>
 
   <constructor>
     <![CDATA[
     this.scrubberNameFormat = ]]>"&scrubberScale.nameFormat;"<![CDATA[;
+    this.positionValue = "";
     this.durationValue = "";
     this.valueBar = null;
     this.isDragging = false;
     this.isPausedByDragging = false;
 
-    this.thumb = document.getAnonymousElementByAttribute(this, "class", "scale-thumb");
     this.type = this.getAttribute("class");
     this.Utils = document.getBindingParent(this.parentNode).Utils;
-    if (this.type == "scrubber") {
-      this.valueBar = this.Utils.progressBar;
-    }
+    this.valueBar = this.Utils.progressBar;
     ]]>
   </constructor>
 
   <method name="valueChanged">
     <parameter name="which"/>
     <parameter name="newValue"/>
     <parameter name="userChanged"/>
     <body>
       <![CDATA[
       // This method is a copy of the base binding's valueChanged(), except that it does
       // not dispatch a |change| event (to avoid exposing the event to web content), and
       // just calls the videocontrol's seekToPosition() method directly.
       switch (which) {
         case "curpos":
-          if (this.type == "scrubber") {
-            // Update the time shown in the thumb.
-            this.thumb.setTime(newValue);
-            this.Utils.positionLabel.setAttribute("value", this.thumb.timeLabel.value);
-            // Update the value bar to match the thumb position.
-            let percent = newValue / this.max;
-            if (!isNaN(percent) && percent != Infinity) {
-              this.valueBar.value = Math.round(percent * 10000); // has max=10000
-            } else {
-              this.valueBar.removeAttribute("value");
-            }
+          // Update the time shown in the thumb.
+          this.positionValue = this.Utils.formatTime(newValue);
+          this.Utils.positionLabel.setAttribute("value", this.positionValue);
+          // Update the value bar to match the thumb position.
+          let percent = newValue / this.max;
+          if (!isNaN(percent) && percent != Infinity) {
+            this.valueBar.value = Math.round(percent * 10000); // has max=10000
+          } else {
+            this.valueBar.removeAttribute("value");
           }
 
           // The value of userChanged is true when changing the position with the mouse,
           // but not when pressing an arrow key. However, the base binding sets
           // ._userChanged in its keypress handlers, so we just need to check both.
           if (!userChanged && !this._userChanged) {
             return;
           }
           this.setAttribute("value", newValue);
-
-          if (this.type == "scrubber") {
-            this.Utils.seekToPosition(newValue);
-          } else if (this.type == "volumeControl") {
-            this.Utils.setVolume(newValue / 100);
-          }
+          this.Utils.seekToPosition(newValue);
           break;
 
         case "minpos":
           this.setAttribute("min", newValue);
           break;
 
         case "maxpos":
-          if (this.type == "scrubber") {
-            // Update the value bar to match the thumb position.
-            let percent = this.value / newValue;
-            this.valueBar.value = Math.round(percent * 10000); // has max=10000
-          }
+          // Update the value bar to match the thumb position.
+          this.valueBar.value = Math.round(this.value / newValue  * 10000); // has max=10000
           this.setAttribute("max", newValue);
           break;
       }
       ]]>
     </body>
   </method>
 
   <method name="dragStateChanged">
     <parameter name="isDragging"/>
     <body>
       <![CDATA[
-      if (this.type == "scrubber") {
-        this.Utils.log("--- dragStateChanged: " + isDragging + " ---");
-        this.isDragging = isDragging;
-        if (this.isPausedByDragging && !isDragging) {
-          // After the drag ends, resume playing.
-          this.Utils.video.play();
-          this.isPausedByDragging = false;
-        }
+      this.Utils.log("--- dragStateChanged: " + isDragging + " ---");
+      this.isDragging = isDragging;
+      if (this.isPausedByDragging && !isDragging) {
+        // After the drag ends, resume playing.
+        this.Utils.video.play();
+        this.isPausedByDragging = false;
       }
       ]]>
     </body>
   </method>
 
   <method name="pauseVideoDuringDragging">
     <body>
       <![CDATA[