From b6492686e4977e8eac6c625c8e14c9b484d1a072 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 13 Jan 2022 16:55:19 +0900 Subject: [PATCH] fix: use setAspectRatio for frameless window on mac (#32446) * fix(window): setAspectRatio for frameless windows * dummy * undo dummy Co-authored-by: Gellert Hegyi Co-authored-by: Jeremy Rose --- shell/browser/native_window_mac.mm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index a8e7194028d51..dec78d307acd6 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -1603,10 +1603,15 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { NativeWindow::SetAspectRatio(aspect_ratio, extra_size); // Reset the behaviour to default if aspect_ratio is set to 0 or less. - if (aspect_ratio > 0.0) - [window_ setContentAspectRatio:NSMakeSize(aspect_ratio, 1.0)]; - else + if (aspect_ratio > 0.0) { + NSSize aspect_ratio_size = NSMakeSize(aspect_ratio, 1.0); + if (has_frame()) + [window_ setContentAspectRatio:aspect_ratio_size]; + else + [window_ setAspectRatio:aspect_ratio_size]; + } else { [window_ setResizeIncrements:NSMakeSize(1.0, 1.0)]; + } } void NativeWindowMac::PreviewFile(const std::string& path,