Bug 1511704 - Port bug 1506835: The buttons under the languages list are not visible if several languages are added to the list. r=jorgk
authorRichard Marti <richard.marti@gmail.com>
Sun, 02 Dec 2018 14:45:56 +0100
changeset 33844 894ad5c9dce3f0dd09735f0cf5f0b98d62fe02ea
parent 33843 f275666fb33ca22f5e470c3cad5028ec2d51f513
child 33845 7cdd9ac6221e517b841c4cb786f05bad32576e0c
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersjorgk
bugs1511704, 1506835
Bug 1511704 - Port bug 1506835: The buttons under the languages list are not visible if several languages are added to the list. r=jorgk
mail/components/preferences/messengerLanguages.js
mail/components/preferences/messengerLanguages.xul
mail/components/preferences/subdialogs.js
mail/themes/shared/mail/incontentprefs/aboutPreferences.css
mail/themes/shared/mail/incontentprefs/dialog.css
--- a/mail/components/preferences/messengerLanguages.js
+++ b/mail/components/preferences/messengerLanguages.js
@@ -451,25 +451,30 @@ var gMessengerLanguagesDialog = {
       this._selectedLocales.addItem(item);
       this._availableLocales.enableWithMessageId("messenger-languages-select-language");
     } else {
       this.showError();
     }
   },
 
   showError() {
-    document.querySelectorAll(".warning-message-separator")
-      .forEach(separator => separator.classList.add("thin"));
     document.getElementById("warning-message").hidden = false;
     this._availableLocales.enableWithMessageId("messenger-languages-select-language");
+
+    // The height has likely changed, find our SubDialog and tell it to resize.
+    requestAnimationFrame(() => {
+      let dialogs = window.opener.gSubDialog._dialogs;
+      let index = dialogs.findIndex(d => d._frame.contentDocument == document);
+      if (index != -1) {
+        dialogs[index].resizeDialog();
+      }
+    });
   },
 
   hideError() {
-    document.querySelectorAll(".warning-message-separator")
-      .forEach(separator => separator.classList.remove("thin"));
     document.getElementById("warning-message").hidden = true;
   },
 
   getSelectedLocales() {
     return this._selectedLocales.items.map(item => item.value);
   },
 
   async selectedLocaleRemoved(item) {
--- a/mail/components/preferences/messengerLanguages.xul
+++ b/mail/components/preferences/messengerLanguages.xul
@@ -51,16 +51,15 @@
           </menulist>
           <button id="add"
                   class="add-messenger-language action-button"
                   data-l10n-id="languages-customize-add"
                   disabled="true"/>
         </row>
       </rows>
     </grid>
-    <separator class="warning-message-separator"/>
     <hbox id="warning-message" class="message-bar message-bar-warning" hidden="true">
       <image class="message-bar-icon"/>
       <description class="message-bar-description" data-l10n-id="messenger-languages-error"/>
     </hbox>
-    <separator class="warning-message-separator"/>
+    <separator class="thin"/>
   </vbox>
 </dialog>
--- a/mail/components/preferences/subdialogs.js
+++ b/mail/components/preferences/subdialogs.js
@@ -268,16 +268,20 @@ SubDialog.prototype = {
     }
 
     // In order to properly calculate the sizing of the subdialog, we need to
     // ensure that all of the l10n is done.
     if (aEvent.target.contentDocument.l10n) {
       await aEvent.target.contentDocument.l10n.ready;
     }
 
+    await this.resizeDialog();
+  },
+
+  async resizeDialog() {
     // Do this on load to wait for the CSS to load and apply before calculating the size.
     let docEl = this._frame.contentDocument.documentElement;
 
     let titleBarHeight = this._titleBar.clientHeight +
                          parseFloat(getComputedStyle(this._titleBar).borderBottomWidth);
 
     // These are deduced from styles which we don't change, so it's safe to get them now:
     let boxHorizontalBorder = 2 * parseFloat(getComputedStyle(this._box).borderLeftWidth);
--- a/mail/themes/shared/mail/incontentprefs/aboutPreferences.css
+++ b/mail/themes/shared/mail/incontentprefs/aboutPreferences.css
@@ -424,16 +424,20 @@ richlistbox:focus > richlistitem[selecte
   margin-inline-end: 0;
 }
 
 #availableLocales {
   margin: 0;
   margin-inline-end: 4px;
 }
 
+#warning-message {
+  margin-top: 8px;
+}
+
 #warning-message > .message-bar-description {
   width: 32em;
 }
 
 .add-messenger-language {
   margin: 0;
   margin-inline-start: 4px;
 }
--- a/mail/themes/shared/mail/incontentprefs/dialog.css
+++ b/mail/themes/shared/mail/incontentprefs/dialog.css
@@ -13,16 +13,21 @@ prefwindow,
   margin: 0;
   padding: 0;
 }
 
 .contentPane {
   margin: 0;
 }
 
+.contentPane,
+dialog > .dialog-content-box {
+  padding: 4px;
+}
+
 tabbox {
   /* override the rule in certManager.xul */
   margin: 0 0 5px !important;
 }
 
 tabpanels {
   font-size: 1em;
 }