Bug 631298 - Status panel: use min-width for loading status messages only. r=gavin
authorDão Gottwald <dao@mozilla.com>
Wed, 09 Feb 2011 22:40:13 +0100
changeset 62269 5c3e3621f86eaf257e726af6c0d1e6767abcb7d7
parent 62268 f323dcb530a21b5f975261b079291ea14273b0b2
child 62270 c1fce77c84d8b618e99e0c485c376158bd12e68d
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersgavin
bugs631298
milestone2.0b12pre
Bug 631298 - Status panel: use min-width for loading status messages only. r=gavin
browser/base/content/browser.css
browser/base/content/browser.js
browser/base/content/tabbrowser.xml
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -455,26 +455,29 @@ browser[tabmodalPromptShowing] {
 /* Status panel */
 
 statuspanel {
   -moz-binding: url("chrome://browser/content/tabbrowser.xml#statuspanel");
   position: fixed;
   margin-top: -3em;
   left: 0;
   max-width: 50%;
-  min-width: 25%;
   -moz-transition: opacity 100ms ease-out;
 }
 
 statuspanel:-moz-locale-dir(ltr)[mirror],
 statuspanel:-moz-locale-dir(rtl):not([mirror]) {
   left: auto;
   right: 0;
 }
 
+statuspanel[type=status] {
+  min-width: 25%;
+}
+
 statuspanel[label=""] {
   -moz-transition: none;
   opacity: 0;
   pointer-events: none;
 }
 
 .statuspanel-inner {
   height: 3em;
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4152,26 +4152,32 @@ var XULBrowserWindow = {
     // Encode bidirectional formatting characters.
     // (RFC 3987 sections 3.2 and 4.1 paragraph 6)
     this.overLink = url.replace(/[\u200e\u200f\u202a\u202b\u202c\u202d\u202e]/g,
                                 encodeURIComponent);
     LinkTargetDisplay.update();
   },
 
   updateStatusField: function () {
-    var text = this.overLink;
-    if (!text && this._busyUI)
-      text = this.status;
-    if (!text)
-      text = this.jsStatus || this.jsDefaultStatus || this.defaultStatus;
+    var text, type, types = ["overLink"];
+    if (this._busyUI)
+      types.push("status");
+    types.push("jsStatus", "jsDefaultStatus", "defaultStatus");
+    for (let i = 0; !text && i < types.length; i++) {
+      type = types[i];
+      text = this[type];
+    }
 
     // check the current value so we don't trigger an attribute change
     // and cause needless (slow!) UI updates
     if (this.statusText != text) {
-      this.statusTextField.label = text;
+      let field = this.statusTextField;
+      field.setAttribute("previoustype", field.getAttribute("type"));
+      field.setAttribute("type", type);
+      field.label = text;
       this.statusText = text;
     }
   },
 
   // Called before links are navigated to to allow us to retarget them if needed.
   onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
     // Don't modify non-default targets or targets that aren't in top-level app
     // tab docshells (isAppTab will be false for app tab subframes).
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -3736,26 +3736,27 @@
                    xbl:inherits="value=label,mirror"
                    flex="1"
                    crop="end"/>
       </xul:hbox>
     </content>
 
     <implementation>
       <property name="label">
-        <setter>
-          if (!this.label) {
+        <setter><![CDATA[
+          if (!this.label)
             this.removeAttribute("mirror");
-            this.style.minWidth = "";
-          } else {
-            this.style.minWidth = getComputedStyle(this).width;
-          }
+
+          this.style.minWidth = this.getAttribute("type") == "status" &&
+                                this.getAttribute("previoustype") == "status"
+                                  ? getComputedStyle(this).width : "";
+
           this.setAttribute("label", val);
           return val;
-        </setter>
+        ]]></setter>
         <getter>
           return this.getAttribute("label");
         </getter>
       </property>
 
       <method name="_mirror">
         <body>
           if (this.hasAttribute("mirror"))