Bug 1563793 - Fix more attachment list messagepane display regressions. r=darktrojan,alta88 a=jorgk BETA_68_CONTINUATION
authorAlessandro Castellani <alessandro@thunderbird.net>
Tue, 09 Jul 2019 10:25:51 -0700
branchBETA_68_CONTINUATION
changeset 36065 26081cf14d0261b61044a8d4f5ea75569d5d2470
parent 36064 db02405147d0bf65623884eb4f9add11468b6d23
child 36066 1595c78e35881b6516a228e355f20405c7432ae6
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersdarktrojan, alta88, jorgk
bugs1563793
Bug 1563793 - Fix more attachment list messagepane display regressions. r=darktrojan,alta88 a=jorgk
mail/base/content/attachmentList.css
mail/base/content/mailWidgets.js
mail/base/content/msgAttachmentView.inc.xul
--- a/mail/base/content/attachmentList.css
+++ b/mail/base/content/attachmentList.css
@@ -6,19 +6,21 @@
   -moz-appearance: listbox;
   -moz-user-focus: normal;
   margin: 0;
   padding: 3px;
 }
 
 .attachmentList[orient="horizontal"] {
   display: block;
+  overflow-x: hidden;
 }
 
 .attachmentList[collapsed] {
+  display: none;
   height: 0;
 }
 
 .attachmentcell-content {
   -moz-box-orient: horizontal;
 }
 
 .attachmentcell-text {
@@ -76,9 +78,9 @@
 }
 
 .attachmentItem:not(.notfound).text-link:hover {
   text-decoration: none !important;
 }
 
 .attachmentItem:not(.notfound).text-link:hover label.attachmentcell-name {
   text-decoration: underline;
-}
+}
\ No newline at end of file
--- a/mail/base/content/mailWidgets.js
+++ b/mail/base/content/mailWidgets.js
@@ -1353,17 +1353,17 @@ class MozAttachmentlist extends MozEleme
   insertItemAt(index, attachment, name) {
     let item = this.ownerDocument.createXULElement("richlistitem");
     item.classList.add("attachmentItem");
     item.setAttribute("name", name || attachment.name);
     item.setAttribute("role", "option");
 
     let itemContainer = this.ownerDocument.createXULElement("hbox");
     itemContainer.setAttribute("flex", "1");
-    itemContainer.classList.add("attachmentcell-text");
+    itemContainer.classList.add("attachmentcell-content");
 
     item.addEventListener("dblclick", (event) => {
       let evt = document.createEvent("XULCommandEvent");
       evt.initCommandEvent("command", true, true, window, 0, event.ctrlKey,
         event.altKey, event.shiftKey, event.metaKey, null);
       event.originalTarget.dispatchEvent(evt);
     });
 
@@ -1501,26 +1501,25 @@ class MozAttachmentlist extends MozEleme
    * Only used by attachmentlist with horizontal orient.
    */
   setOptimumWidth() {
     if (this._childNodes.length == 0) {
       return;
     }
 
     let width = 0;
-    let border = this._childNodes[0].getBoundingClientRect().width -
-      this._childNodes[0].clientWidth;
 
     // If widths have changed after the initial calculation (updated
     // size string), clear each item's prior hardcoded width so
-    // scrollwidth is natural, then get the width for the widest item
-    // and set it on all the items again.
+    // getBoundingClientRect is natural, then get the width for
+    // the widest item and set it on all the items again.
+    // Use Math.ceil to always round to the next higher integer.
     for (let child of this._childNodes) {
       child.width = "";
-      width = Math.max(width, child.scrollWidth);
+      width = Math.max(width, Math.ceil(child.getBoundingClientRect().width));
     }
     for (let child of this._childNodes) {
-      child.width = width + border;
+      child.width = width;
     }
   }
 }
 
 customElements.define("attachment-list", MozAttachmentlist, { extends: "richlistbox" });
--- a/mail/base/content/msgAttachmentView.inc.xul
+++ b/mail/base/content/msgAttachmentView.inc.xul
@@ -91,13 +91,14 @@
                               </toolbaritem>
                             </hbox>
                           </vbox>
                         </hbox>
                         <richlistbox is="attachment-list" id="attachmentList"
                                      class="attachmentList"
                                      orient="horizontal"
                                      seltype="multiple"
+                                     flex="1"
                                      context="attachmentListContext"
                                      itemcontext="attachmentItemContext"
                                      role="listbox"
                                      ondragstart="nsDragAndDrop.startDrag(event, attachmentListDNDObserver);"
                                      ondragover="nsDragAndDrop.dragOver(event, attachmentListDNDObserver);"/>