tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit c44e1d9c2ec16b550fc492ac408015fd63930c31
parent 4707e5be71d9279c8d996cd1be6988b7b175b6a6
Author: Sam Johnson <sam@scj.me>
Date:   Tue,  7 Oct 2025 07:32:13 +0000

Bug 1992898 - Stop inflating control metrics on macOS Tahoe. r=emilio

Native-styled controls previously had margins built-in on previous releases, so Firefox would inflate the requested control size so that they are visually sized appropriately. With macOS Tahoe, and specifically when built with the new SDK, controls no longer have these built-in margins, and fill their entire frame by default. The inflation logic then causes the controls to be rendered too large. Therefore, we can skip the inflation entirely on macOS Tahoe.

Alternatively, there was a new API introduced on NSView, prefersCompactControlSizeMetrics, which could be used to instead request the previous control sizes. However, using this caused blurry control rendering, while also not being very forward-looking, so I opted to not use it.

Differential Revision: https://phabricator.services.mozilla.com/D267712

Diffstat:
Mwidget/cocoa/nsNativeThemeCocoa.mm | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm @@ -191,6 +191,10 @@ using CellMarginArray = PerSizeArray<IntMargin>; static void InflateControlRect(NSRect* rect, NSControlSize cocoaControlSize, const CellMarginArray& marginSet) { + if (nsCocoaFeatures::OnTahoeOrLater()) { + // Controls on macOS 26 fill the entire frame and do not require inflation. + return; + } auto controlSize = EnumSizeForCocoaSize(cocoaControlSize); const IntMargin& buttonMargins = marginSet[controlSize]; rect->origin.x -= buttonMargins.left;