From 3e07bd785f0ff5da4d9be534b5997ddb588ae98b Mon Sep 17 00:00:00 2001 From: wukko Date: Wed, 3 Dec 2025 18:17:20 +0600 Subject: [PATCH] helium/ui: fix caption bounds (only on macos for now) merged the related patch from macOS repo into this one and added new changes. it makes sense to keep it here as it's a "main helium" kind of change, not some platform quirk. i'm not sure whether macOS 15 bounds are correct, however, so this will probably be patched up more in the future. --- patches/helium/ui/fix-caption-bounds.patch | 44 ++++++++++++++++++++++ patches/series | 1 + 2 files changed, 45 insertions(+) create mode 100644 patches/helium/ui/fix-caption-bounds.patch diff --git a/patches/helium/ui/fix-caption-bounds.patch b/patches/helium/ui/fix-caption-bounds.patch new file mode 100644 index 00000000..447b18fc --- /dev/null +++ b/patches/helium/ui/fix-caption-bounds.patch @@ -0,0 +1,44 @@ +--- a/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm ++++ b/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm +@@ -63,13 +63,10 @@ const double kThinControllerHeight = 0.5 + } + + - (CGFloat)_minXTitlebarWidgetInset { +- if (@available(macOS 26, *)) { +- // On macOS 26, position the leading window widget the same distance from +- // the leading edge of the window as it is from the top of the window. That +- // way the window corner can be adjusted to make the widget concentric. +- return 13.0; +- } +- return [super _minXTitlebarWidgetInset]; ++ // Both macOS 15- and macOS 26+ use the same inset here, but ++ // 1px is invisible on macOS 15- for some reason. Ideally it should be 11px here, ++ // but since it appears visually to be 11, we just use 10 here for both styles. ++ return 10.0; + } + + // Override -_getCachedWindowCornerRadius rather than -_cornerRadius because the +@@ -78,7 +75,7 @@ const double kThinControllerHeight = 0.5 + // _getCachedWindowCornerRadius. + - (CGFloat)_getCachedWindowCornerRadius { + if (@available(macOS 26, *)) { +- return 13.0 /* widget position from top and left */ + ++ return 10.0 /* widget position from top and left */ + + 7.0 /* widget radius */; + } + // Don't mess with the window radius before macOS 26, as concentricity was not +--- a/chrome/browser/ui/views/frame/browser_frame_view_mac.mm ++++ b/chrome/browser/ui/views/frame/browser_frame_view_mac.mm +@@ -465,10 +465,10 @@ BrowserFrameViewMac::GetCaptionButtonBou + // not precise. + if (@available(macOS 26, *)) { + result.bounds = gfx::RectF(12, 10, 62, 18); +- result.margins = gfx::OutsetsF::VH(10, 12); ++ result.margins = gfx::OutsetsF::VH(0, 6); + } else { + result.bounds = gfx::RectF(20, 11, 54, 16); +- result.margins = gfx::OutsetsF::VH(11, 20); ++ result.margins = gfx::OutsetsF::VH(0, 14); + } + + // Mirror for when caption buttons are on the "wrong" side. diff --git a/patches/series b/patches/series index 698c4028..9120bb4a 100644 --- a/patches/series +++ b/patches/series @@ -266,6 +266,7 @@ helium/ui/ublock-show-in-settings.patch helium/ui/licenses-in-credits.patch helium/ui/remove-autofill-link-to-password-manager.patch helium/ui/fix-caption-button-tab-strip-align.patch +helium/ui/fix-caption-bounds.patch helium/ui/find-bar.patch helium/ui/remove-zoom-action.patch helium/ui/experiments/compact-action-toolbar.patch