From 524bb999486739ba012b9a036c3b50a8682f69d8 Mon Sep 17 00:00:00 2001 From: "trop[bot]" Date: Tue, 9 Oct 2018 10:52:00 -0700 Subject: [PATCH] fix: Check minSize constraints before resizing (backport: 3-0-x) (#15038) --- atom/browser/api/atom_api_top_level_window.cc | 4 +++- docs/api/browser-window.md | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/atom/browser/api/atom_api_top_level_window.cc b/atom/browser/api/atom_api_top_level_window.cc index fbba777bd5dd..334f7950cfd1 100644 --- a/atom/browser/api/atom_api_top_level_window.cc +++ b/atom/browser/api/atom_api_top_level_window.cc @@ -376,8 +376,10 @@ gfx::Rect TopLevelWindow::GetContentBounds() { void TopLevelWindow::SetSize(int width, int height, mate::Arguments* args) { bool animate = false; + gfx::Size size = window_->GetMinimumSize(); + size.SetToMax(gfx::Size(width, height)); args->GetNext(&animate); - window_->SetSize(gfx::Size(width, height), animate); + window_->SetSize(size, animate); } std::vector TopLevelWindow::GetSize() { diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 42ef516c08d3..da7edc184fca 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -881,7 +881,7 @@ Disable or enable the window. * `height` Integer * `animate` Boolean (optional) _macOS_ -Resizes the window to `width` and `height`. +Resizes the window to `width` and `height`. If `width` or `height` are below any set minimum size constraints the window will snap to its minimum size. #### `win.getSize()`