Bug 1334786 - Followup to also allow long maintenance service checkbox strings. r?agashlin draft
authorMatt Howell <mhowell@mozilla.com>
Tue, 07 Feb 2017 08:25:47 -0800
changeset 479975 104fca436bf1ef48bdbe42a76277e5fd245d8cfb
parent 479958 e677ba018b22558fef1d07b74d416fd3a28a5dc3
child 544835 76a54cb80644e086d9c2b6e7b61bee955ed61696
push id44415
push usermhowell@mozilla.com
push dateTue, 07 Feb 2017 16:26:36 +0000
reviewersagashlin
bugs1334786
milestone54.0a1
Bug 1334786 - Followup to also allow long maintenance service checkbox strings. r?agashlin MozReview-Commit-ID: Ke3cUKqm3uk
browser/installer/windows/nsis/stub.nsi
--- a/browser/installer/windows/nsis/stub.nsi
+++ b/browser/installer/windows/nsis/stub.nsi
@@ -1053,18 +1053,29 @@ Function createOptions
     ${IfNot} ${Errors}
       DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
       ; Read the registry instead of using ServicesHelper::IsInstalled so the
       ; plugin isn't included in the stub installer to lessen its size.
       ClearErrors
       ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\services\MozillaMaintenance" "ImagePath"
       ${If} ${Errors}
         IntOp $0 132 + $ControlTopAdjustment
+        ; In some locales, this string may be too long to fit on one line.
+        ; In that case, we'll need to give the control two lines worth of height.
+        StrCpy $1 12 ; single line height
+        ${GetTextExtent} "$(INSTALL_MAINT_SERVICE)" $FontNormal $R1 $R2
+        ${If} $R1 > ${OPTIONS_ITEM_WIDTH_DU}
+          ; Add a second line to the control height.
+          IntOp $1 $1 + 12
+          ; The rest of the controls will have to be lower to account for this label
+          ; needing two lines worth of height.
+          IntOp $ControlTopAdjustment $ControlTopAdjustment + 12
+        ${EndIf}
         ${NSD_CreateCheckbox} ${OPTIONS_ITEM_EDGE_DU} "$0u" ${OPTIONS_ITEM_WIDTH_DU} \
-                              12u "$(INSTALL_MAINT_SERVICE)"
+                              "$1u" "$(INSTALL_MAINT_SERVICE)"
         Pop $CheckboxInstallMaintSvc
         System::Call 'uxtheme::SetWindowTheme(i $CheckboxInstallMaintSvc, w " ", w " ")'
         SetCtlColors $CheckboxInstallMaintSvc ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
         SendMessage $CheckboxInstallMaintSvc ${WM_SETFONT} $FontNormal 0
         ${NSD_Check} $CheckboxInstallMaintSvc
         ; Since we're adding in an optional control, remember the lower the ones
         ; that come after it.
         IntOp $ControlTopAdjustment 20 + $ControlTopAdjustment