Bug 567062 Wrong number in "x more" recipients button for singleline case. r=bwinton,ui-r=andreasn
authorrsx11m.pub@gmail.com
Thu, 24 Jun 2010 09:05:36 +0100
changeset 5889 83468aaa8c87d59a98399f979f7f53247738bd44
parent 5888 6b72bf88ee096f3be30a13b6f93df5611babc366
child 5890 678b65a51740f6c2633ef564c0f86545aded5c70
push id4560
push userbugzilla@standard8.plus.com
push dateThu, 24 Jun 2010 08:09:29 +0000
treeherdercomm-central@678b65a51740 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwinton, andreasn
bugs567062
Bug 567062 Wrong number in "x more" recipients button for singleline case. r=bwinton,ui-r=andreasn
mail/base/content/mailWidgets.xml
--- a/mail/base/content/mailWidgets.xml
+++ b/mail/base/content/mailWidgets.xml
@@ -382,23 +382,28 @@
 
                 // Calculate width and lines, consider the i+1 comma node if we have to
                 // <http://www.w3.org/TR/cssom-view/#client-attributes>
                 // <https://developer.mozilla.org/en/Determining_the_dimensions_of_elements>
                 let newLineWidth = i+1 < this.mAddresses.length ?
                                    newAddressNode.clientWidth + this.commaNodeWidth:
                                    newAddressNode.clientWidth;
                 curLineWidth += newLineWidth;
-                if (curLineWidth > availableWidth && i > 0) {
+
+                let overLineWidth = curLineWidth - availableWidth;
+                if (overLineWidth > 0 && i > 0) {
                   curLine++;
                   curLineWidth = newLineWidth;
                 }
 
                 // hide the last node spanning into the additional line (n>1)
-                if (curLine >= this.maxLinesBeforeMore && this.maxLinesBeforeMore > 1) {
+                // also hide it if <30px left after sliding the address (n=1)
+                if (curLine >= this.maxLinesBeforeMore &&
+                    (this.maxLinesBeforeMore > 1 ||
+                     newLineWidth - overLineWidth < 30)) {
                   aAddressesNode.lastChild.hidden = true;
                   i--;
                 }
               }
             }
 
             // Hide any extra nodes but keep them around for later.
             for (let j = i*2 - 1; j < aAddressesNode.childNodes.length; j++) {