Bug 1562115 - Prevent cutting off long stub installer text strings. r=agashlin
authorMatt Howell <mhowell@mozilla.com>
Tue, 02 Jul 2019 20:15:48 +0000
changeset 543849 da1d379db91dc16f7de64df4aff0dac6cd2ff74a
parent 543848 ba60dd480690fa93615a42b67932676f89459614
child 543850 367d45a1ef485306b08e0d5dc0e663324e1983c7
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersagashlin
bugs1562115
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1562115 - Prevent cutting off long stub installer text strings. r=agashlin This patch copies over the same fix that was used for the profile cleanup page to the installing page, since in some locales it can run into the same problem of the header string being so long that it causes the next control to get cut off by the bottom of the window. Differential Revision: https://phabricator.services.mozilla.com/D36523
browser/branding/official/branding.nsi
browser/installer/windows/nsis/stub.nsi
--- a/browser/branding/official/branding.nsi
+++ b/browser/branding/official/branding.nsi
@@ -40,16 +40,17 @@
 !define PROFILE_CLEANUP_LABEL_HEIGHT "100u"
 !define PROFILE_CLEANUP_LABEL_ALIGN "left"
 !define PROFILE_CLEANUP_CHECKBOX_LEFT "22u"
 !define PROFILE_CLEANUP_CHECKBOX_WIDTH "175u"
 !define PROFILE_CLEANUP_BUTTON_LEFT "22u"
 !define INSTALL_HEADER_TOP "70u"
 !define INSTALL_HEADER_LEFT "22u"
 !define INSTALL_HEADER_WIDTH "180u"
+!define INSTALL_HEADER_HEIGHT "100u"
 !define INSTALL_BODY_LEFT "22u"
 !define INSTALL_BODY_WIDTH "180u"
 !define INSTALL_INSTALLING_TOP "115u"
 !define INSTALL_INSTALLING_LEFT "270u"
 !define INSTALL_INSTALLING_WIDTH "150u"
 !define INSTALL_PROGRESS_BAR_TOP "100u"
 !define INSTALL_PROGRESS_BAR_LEFT "270u"
 !define INSTALL_PROGRESS_BAR_WIDTH "150u"
--- a/browser/installer/windows/nsis/stub.nsi
+++ b/browser/installer/windows/nsis/stub.nsi
@@ -840,20 +840,31 @@ Function createInstall
   ; Resize the Dialog to fill the entire window
   System::Call 'user32::MoveWindow(i$Dialog,i0,i0,i $8,i $9,i0)'
 
   !ifdef INSTALL_HEADER_WIDTH
     ; Draw the header text.
     ${DialogUnitsToPixels} ${INSTALL_HEADER_WIDTH} X $0
     ${GetTextWidthHeight} "$(STUB_INSTALLING_HEADLINE)" $FontHeader $0 $R1 $R2
     ${ConvertLeftCoordForRTL} ${INSTALL_HEADER_LEFT} $0 $9
+    ; If this text is over the maximum height, drop the font size until it fits.
+    StrCpy $4 $FontHeader
+    !ifdef INSTALL_HEADER_HEIGHT
+      ${DialogUnitsToPixels} ${INSTALL_HEADER_HEIGHT} Y $2
+      StrCpy $3 ${INSTALL_HEADER_FONT_SIZE}
+      ${While} $R2 > $2
+        IntOp $3 $3 - 2
+        CreateFont $4 "$FontFamilyName" $3 ${INSTALL_HEADER_FONT_WEIGHT}
+        ${GetTextWidthHeight} "$(STUB_INSTALLING_HEADLINE)" $4 $0 $R1 $R2
+      ${EndWhile}
+    !endif
     ${NSD_CreateLabel} $9 ${INSTALL_HEADER_TOP} $0 $R2 \
       "$(STUB_INSTALLING_HEADLINE)"
     Pop $0
-    SendMessage $0 ${WM_SETFONT} $FontHeader 0
+    SendMessage $0 ${WM_SETFONT} $4 0
     SetCtlColors $0 ${COMMON_TEXT_COLOR} transparent
   !endif
 
   !ifdef INSTALL_BODY_WIDTH
     ; Draw the body text the same way as the header, but we also need to work
     ; out where to put it based on where the bottom of the header is.
     ${GetDlgItemBottomPX} $0 $1
     ; Add a bit of padding above this text.