fix: treat maxWidth/Height<=0 as unlimited (#36487)

This commit is contained in:
Jeremy Rose 2022-11-30 17:02:22 -08:00 committed by GitHub
parent 835e248dff
commit 4ff0642af7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -175,7 +175,11 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
int max_width = max_size.width() > 0 ? max_size.width() : INT_MAX; int max_width = max_size.width() > 0 ? max_size.width() : INT_MAX;
int max_height = max_size.height() > 0 ? max_size.height() : INT_MAX; int max_height = max_size.height() > 0 ? max_size.height() : INT_MAX;
bool have_max_width = options.Get(options::kMaxWidth, &max_width); bool have_max_width = options.Get(options::kMaxWidth, &max_width);
if (have_max_width && max_width <= 0)
max_width = INT_MAX;
bool have_max_height = options.Get(options::kMaxHeight, &max_height); bool have_max_height = options.Get(options::kMaxHeight, &max_height);
if (have_max_height && max_height <= 0)
max_height = INT_MAX;
// By default the window has a default maximum size that prevents it // By default the window has a default maximum size that prevents it
// from being resized larger than the screen, so we should only set this // from being resized larger than the screen, so we should only set this