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.
This commit is contained in:
wukko
2025-12-03 18:17:20 +06:00
parent a3072fedab
commit 3e07bd785f
2 changed files with 45 additions and 0 deletions

View File

@@ -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.

View File

@@ -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