electron/patches/chromium/enable_reset_aspect_ratio.patch
electron-roller[bot] 37f8db15e9
chore: bump chromium to 137.0.7143.0 (main) (#46757)
* chore: bump chromium in DEPS to 137.0.7142.0

* chore: bump chromium in DEPS to 137.0.7143.0

* Add accelerator API to get shortcut vector representation

Refs 6442193

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-04-25 14:53:51 +09:00

38 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Thu, 4 Oct 2018 14:57:02 -0700
Subject: feat: enable setting aspect ratio to 0
Make SetAspectRatio accept 0 as valid input, which would reset to null.
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
index 6ad16425f2fb3438be178cb06a85ef72f8d09e22..61509e2eb982797845098abf5f36e031be63686b 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -664,7 +664,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) {
void DesktopWindowTreeHostWin::SetAspectRatio(
const gfx::SizeF& aspect_ratio,
const gfx::Size& excluded_margin) {
- DCHECK(!aspect_ratio.IsEmpty());
+ DCHECK_NE(aspect_ratio.height(), 0);
message_handler_->SetAspectRatio(aspect_ratio.width() / aspect_ratio.height(),
excluded_margin);
}
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index ac502dee8a21725db9de2e232cb5092a0670f1d9..db2b841e973f05049f712c732ae8d4815a8aff7a 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -992,8 +992,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen,
void HWNDMessageHandler::SetAspectRatio(float aspect_ratio,
const gfx::Size& excluded_margin) {
- // If the aspect ratio is not in the valid range, do nothing.
- DCHECK_GT(aspect_ratio, 0.0f);
+ // If the aspect ratio is 0, reset it to null.
+ if (aspect_ratio == 0.0f) {
+ aspect_ratio_.reset();
+ return;
+ }
aspect_ratio_ = aspect_ratio;