Browse Source

fix: maxWidth not being respected (#32637)

Co-authored-by: Jeremy Rose <[email protected]>
trop[bot] 3 years ago
parent
commit
758141f111
1 changed files with 10 additions and 10 deletions
  1. 10 10
      shell/browser/native_window.cc

+ 10 - 10
shell/browser/native_window.cc

@@ -135,16 +135,16 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
   // On Linux and Window we may already have maximum size defined.
   extensions::SizeConstraints size_constraints(
       use_content_size ? GetContentSizeConstraints() : GetSizeConstraints());
-  int min_height = 0, min_width = 0;
-  if (options.Get(options::kMinHeight, &min_height) ||
-      options.Get(options::kMinWidth, &min_width)) {
-    size_constraints.set_minimum_size(gfx::Size(min_width, min_height));
-  }
-  int max_height = INT_MAX, max_width = INT_MAX;
-  if (options.Get(options::kMaxHeight, &max_height) ||
-      options.Get(options::kMaxWidth, &max_width)) {
-    size_constraints.set_maximum_size(gfx::Size(max_width, max_height));
-  }
+  int min_width = size_constraints.GetMinimumSize().width();
+  int min_height = size_constraints.GetMinimumSize().height();
+  options.Get(options::kMinWidth, &min_width);
+  options.Get(options::kMinHeight, &min_height);
+  size_constraints.set_minimum_size(gfx::Size(min_width, min_height));
+  int max_width = size_constraints.GetMaximumSize().width();
+  int max_height = size_constraints.GetMaximumSize().height();
+  options.Get(options::kMaxWidth, &max_width);
+  options.Get(options::kMaxHeight, &max_height);
+  size_constraints.set_maximum_size(gfx::Size(max_width, max_height));
   if (use_content_size) {
     SetContentSizeConstraints(size_constraints);
   } else {