Bug 561099 - Long filenames make the download dialog span out past the viewable area [r=mfinkle]
authorWesley Johnston <wjohnston@mozilla.com>
Tue, 24 Aug 2010 02:34:10 -0400
changeset 66472 eb4a450cc4b2efa6bfd7ab2622061446cfd3022a
parent 66471 8013c247548facc8fde66c4a4d30c7fde9848c88
child 66473 a03c3109f8e7adf8242255b480bbb7d2ef87effa
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs561099
Bug 561099 - Long filenames make the download dialog span out past the viewable area [r=mfinkle]
mobile/chrome/content/browser.js
mobile/chrome/content/browser.xul
mobile/themes/core/browser.css
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -2196,47 +2196,63 @@ function showDownloadManager(aWindowCont
   // TODO: select the download with aID
 }
 
 var AlertsHelper = {
   _timeoutID: -1,
   _listener: null,
   _cookie: "",
   _clickable: false,
+  _container: null,
+  get container() {
+    if (!this._container) {
+      this._container = document.getElementById("alerts-container");
+      let self = this;
+      this._container.addEventListener("transitionend", function() {
+        self.alertTransitionOver();
+      }, true);
+    }
+    return this._container;
+  },
 
   showAlertNotification: function ah_show(aImageURL, aTitle, aText, aTextClickable, aCookie, aListener) {
     this._clickable = aTextClickable || false;
     this._listener = aListener || null;
     this._cookie = aCookie || "";
 
     document.getElementById("alerts-image").setAttribute("src", aImageURL);
     document.getElementById("alerts-title").value = aTitle;
     document.getElementById("alerts-text").textContent = aText;
-
-    let container = document.getElementById("alerts-container");
+    
+    let container = this.container;
     container.hidden = false;
-
-    let rect = container.getBoundingClientRect();
-    container.top = window.innerHeight - (rect.height + 20);
-    container.left = window.innerWidth - (rect.width + 20);
+    container.height = container.getBoundingClientRect().height;
+    container.classList.add("showing");
 
     let timeout = Services.prefs.getIntPref("alerts.totalOpenTime");
     let self = this;
+    if (this._timeoutID)
+      clearTimeout(this._timeoutID);
     this._timeoutID = setTimeout(function() { self._timeoutAlert(); }, timeout);
   },
-
+    
   _timeoutAlert: function ah__timeoutAlert() {
     this._timeoutID = -1;
-    let container = document.getElementById("alerts-container");
-    container.hidden = true;
-
+    
+    this.container.classList.remove("showing");
     if (this._listener)
       this._listener.observe(null, "alertfinished", this._cookie);
-
-    // TODO: add slide to UI
+  },
+  
+  alertTransitionOver: function ah_alertTransitionOver() {
+    let container = this.container;
+    if (!container.classList.contains("showing")) {
+      container.height = 0;
+      container.hidden = true;
+    }
   },
 
   click: function ah_click(aEvent) {
     if (this._clickable && this._listener)
       this._listener.observe(null, "alertclickcallback", this._cookie);
 
     if (this._timeoutID != -1) {
       clearTimeout(this._timeoutID);
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -548,17 +548,17 @@
           <richlistitem class="context-command" id="context-removebookmark" type="edit-bookmark" onclick="ContextCommands.removeBookmark();">
             <label value="&contextRemoveBookmark.label;"/>
           </richlistitem>
         </richlistbox>
       </vbox>
     </hbox>
 
     <!-- alerts for content -->
-    <hbox id="alerts-container" hidden="true" align="start" class="dialog-dark" top="0" left="0"
+    <hbox id="alerts-container" hidden="true" align="start" class="dialog-dark" bottom="0" right="0"
           onclick="AlertsHelper.click(event);">
       <image id="alerts-image"/>
       <vbox flex="1">
         <label id="alerts-title" value=""/>
         <description id="alerts-text" flex="1"/>
       </vbox>
     </hbox>
   </stack>
--- a/mobile/themes/core/browser.css
+++ b/mobile/themes/core/browser.css
@@ -1182,16 +1182,28 @@ pageaction:hover:active > vbox > .pageac
 }
 
 @media (max-width: 499px) {
   #alerts-container {
     width: 200px;
   }
 }
 
+#alerts-container {
+  -moz-transform: translatex(100%);
+  -moz-transition-property: -moz-transform;
+  -moz-transition-duration: 0.5s;
+  margin-bottom: 20px;
+  -moz-margin-end: 20px;
+}
+
+#alerts-container.showing {
+  -moz-transform: translatex(0);
+}
+
 #alerts-text {
   font-size: 18px !important;
   white-space: pre-wrap;
 }
 
 /* helperapp (save-as) popup ----------------------------------------------- */
 #helperapp-target {
   font-size: 18px !important;