From a05a0ad7803af5c6067afc26b15c423cfd18d981 Mon Sep 17 00:00:00 2001 From: Matt Howell Date: Tue, 2 Jul 2019 20:15:48 +0000 Subject: [PATCH] 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 --HG-- extra : moz-landing-system : lando --- browser/branding/official/branding.nsi | 1 + browser/installer/windows/nsis/stub.nsi | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/browser/branding/official/branding.nsi b/browser/branding/official/branding.nsi index 204ca61b18e8..d53a9efb7b90 100644 --- a/browser/branding/official/branding.nsi +++ b/browser/branding/official/branding.nsi @@ -45,6 +45,7 @@ !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" diff --git a/browser/installer/windows/nsis/stub.nsi b/browser/installer/windows/nsis/stub.nsi index 0ddc8701a716..0d3e6b588d59 100644 --- a/browser/installer/windows/nsis/stub.nsi +++ b/browser/installer/windows/nsis/stub.nsi @@ -845,10 +845,21 @@ Function createInstall ${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