mirror of
https://github.com/electron/electron.git
synced 2026-01-06 22:24:03 -05:00
* chore: bump chromium in DEPS to 145.0.7562.0 * fix(patch-conflict): update code cache patch for PersistentCache refactor Upstream refactored code cache to use PersistentCache with new class-based implementation (NoopCodeCacheHost, LocalCodeCacheHost, CodeCacheWithPersistentCacheHost). Updated patch to integrate custom scheme support into the new structure while preserving ProcessLockURLIsCodeCacheScheme checks for embedder-registered schemes. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7044986 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(patch-conflict): update dialog patch for RequestXdgDesktopPortal API Upstream changed from SetSystemdScopeUnitNameForXdgPortal to RequestXdgDesktopPortal API pattern. Updated OnServiceStarted signature and kept OnSystemdUnitStarted callback that calls Electron's file_dialog::StartPortalAvailabilityTestInBackground(). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7204285 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(patch-conflict): remove reference to deleted AbortByPlaceholderLayout flag Upstream removed the AbortByPlaceholderLayout runtime flag from runtime_enabled_features.json5. Updated patch to only add ElectronCSSCornerSmoothing without the removed flag reference. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7226494 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * chore: update patch hunk headers Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(build): guard media_file_system_registry for ChromeOS only Upstream CL https://chromium-review.googlesource.com/c/chromium/src/+/7100719 moved media_file_system_registry to be ChromeOS-only since Media Galleries is a Chrome Apps API and Chrome Apps are only available on Chrome OS now. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(build): update VideoPixelFormat API for SharedImageFormat Upstream CL https://chromium-review.googlesource.com/c/chromium/src/+/7207153 removed VideoPixelFormatToGfxBufferFormat as part of migration to SharedImageFormat. Update to use VideoPixelFormatToSharedImageFormat which directly returns the SharedImageFormat. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(build): extend profile methods patch for ShouldEnableXfaForms The ShouldEnableXfaForms function uses Profile::FromBrowserContext() which is not available in Electron. Wrap the profile-dependent code in #if 0 to fall through to the feature flag default. Co-Authored-By: Claude <noreply@anthropic.com> * chore: bump chromium in DEPS to 145.0.7563.0 * chore: bump chromium in DEPS to 145.0.7565.0 * chore: bump chromium in DEPS to 145.0.7567.0 * chore: bump chromium in DEPS to 145.0.7568.0 * fix(patch-conflict): update content_main_delegate.h context for IsInitFeatureListEarly Upstream added a new IsInitFeatureListEarly() virtual method to ContentMainDelegate just before where our GetBrowserV8SnapshotFilename() method is added. Updated patch context to account for this new method. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7092856 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * chore: update patch hunk headers Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(patch-update): include v8-cppgc.h for CppHeap complete type The std::unique_ptr<v8::CppHeap> default argument in node.h requires the complete CppHeap type definition for the destructor. Added the v8-cppgc.h include to provide the full type definition. Ref: Unable to locate CL - libc++ unique_ptr requires complete type for destructor Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * chore: update patch hunk headers Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(build): move NativeAppWindowFrameViewMacClient before constructor The std::unique_ptr<NativeAppWindowFrameViewMacClient> member requires the complete type definition to be visible at the point of the constructor because the unique_ptr destructor may be instantiated during exception handling. Moved the class definition before the NativeWindowMac constructor. Ref: Unable to locate CL - libc++ unique_ptr requires complete type for destructor Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix(patch-conflict): update create_browser_v8_snapshot_file_name_fuse context for IsInitFeatureListEarly The upstream added IsInitFeatureListEarly() virtual method declaration to ContentMainDelegate class. Updated the patch context to account for this new function being present before the GetBrowserV8SnapshotFilename() declaration we add. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7092856 Co-Authored-By: Claude <noreply@anthropic.com> * chore: update patch hunk headers Co-Authored-By: Claude <noreply@anthropic.com> * fix(patch-update): remove reverted IsInitFeatureListEarly from v8 snapshot patch The upstream added IsInitFeatureListEarly() was reverted, so the patch should not include this declaration. Only GetBrowserV8SnapshotFilename() should be added by the create_browser_v8_snapshot_file_name_fuse patch. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7230430 Co-Authored-By: Claude <noreply@anthropic.com> * 6171655: include single_thread_task_runner.h for complete type Added include for base/task/single_thread_task_runner.h in osr_converter.cc to resolve incomplete type error when using base::SingleThreadTaskRunner::GetCurrentDefault(). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/6171655 Co-Authored-By: Claude <noreply@anthropic.com> * 7224136: use CHROMIUM_GIT_REVISION directly instead of removed function Upstream removed GetChromiumGitRevision() function from embedder_support. Updated to use CHROMIUM_GIT_REVISION macro directly via build/util/chromium_git_revision.h as recommended in the Chromium CL. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7224136 Co-Authored-By: Claude <noreply@anthropic.com> * fixup! 7224136: use CHROMIUM_GIT_REVISION directly instead of removed function * fix(build): add missing include `components/dbus/xdg/systemd.h` for `void OnSystemdUnitStarted(dbus_xdg::SystemdUnitStatus)` in the same patch. * fix(build): adapt to string-view-ification change in windows jump_list.cc 7186922: Fix unsafe buffer usage in base/win/win_util.cc https://chromium-review.googlesource.com/c/chromium/src/+/7186922 * chore: update libc++ filenames * fixup! fix(build): add missing include * fixup! fix(build): extend profile methods patch for ShouldEnableXfaForms * fixup! fix(build): guard media_file_system_registry for ChromeOS only * fixup! fixup! fix(build): extend profile methods patch for ShouldEnableXfaForms --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: Claude <svc-devxp-claude@slack-corp.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: clavin <clavin@electronjs.org>
286 lines
13 KiB
Diff
286 lines
13 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: John Kleinschmidt <jkleinsc@electronjs.org>
|
|
Date: Sat, 14 Jun 2025 16:21:07 -0400
|
|
Subject: Revert "[views] Remove DesktopWindowTreeHostWin::window_enlargement_"
|
|
|
|
This reverts commit 1771dbae6961e7bb7c22bbc6c77f84d90ef2be46.
|
|
|
|
Electron needs this patch to allow windows smaller than 64x64
|
|
on Windows. We should refactor our code so that this patch isn't
|
|
necessary.
|
|
|
|
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
|
|
index cd4902bda5d14de5d28739624c831bf93261d555..5fc2fc80bd08de257537f43902ae1aa9fa123661 100644
|
|
--- a/testing/variations/fieldtrial_testing_config.json
|
|
+++ b/testing/variations/fieldtrial_testing_config.json
|
|
@@ -25569,6 +25569,21 @@
|
|
]
|
|
}
|
|
],
|
|
+ "TransparentHwndEnlargement": [
|
|
+ {
|
|
+ "platforms": [
|
|
+ "windows"
|
|
+ ],
|
|
+ "experiments": [
|
|
+ {
|
|
+ "name": "DisableTransparentHwndEnlargement",
|
|
+ "disable_features": [
|
|
+ "EnableTransparentHwndEnlargement"
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ],
|
|
"TransportSecurityFileWriterScheduleAndroid": [
|
|
{
|
|
"platforms": [
|
|
diff --git a/ui/views/views_features.cc b/ui/views/views_features.cc
|
|
index 9ecf5330bb9b3a5a7b12f3b9bb76192ea1694d07..202d3e3df60ec8d23b4cbd3e5814c3fce1b07871 100644
|
|
--- a/ui/views/views_features.cc
|
|
+++ b/ui/views/views_features.cc
|
|
@@ -22,6 +22,14 @@ BASE_FEATURE(kAnnounceTextAdditionalAttributes,
|
|
// crbug.com/370856871.
|
|
BASE_FEATURE(kEnableTouchDragCursorSync, base::FEATURE_ENABLED_BY_DEFAULT);
|
|
|
|
+// Enables enlargement of HWNDs to a minimum size of 64x64 to handle reported
|
|
+// graphical glitches on certain hardware.
|
|
+// TODO(crbug.com/401996981): Remove this once enlargement is confirmed to no
|
|
+// longer be needed.
|
|
+BASE_FEATURE(kEnableTransparentHwndEnlargement,
|
|
+ "EnableTransparentHwndEnlargement",
|
|
+ base::FEATURE_DISABLED_BY_DEFAULT);
|
|
+
|
|
// Used to enable keyboard-accessible tooltips in Views UI, as opposed
|
|
// to kKeyboardAccessibleTooltip in //ui/base/ui_base_features.cc.
|
|
BASE_FEATURE(kKeyboardAccessibleTooltipInViews,
|
|
diff --git a/ui/views/views_features.h b/ui/views/views_features.h
|
|
index 5f5ea15678bd76399fdbbb8904fe155657f49335..a67c124878fb710599fed5d9714bfa723d0d67a5 100644
|
|
--- a/ui/views/views_features.h
|
|
+++ b/ui/views/views_features.h
|
|
@@ -14,6 +14,7 @@ namespace views::features {
|
|
// Please keep alphabetized.
|
|
VIEWS_EXPORT BASE_DECLARE_FEATURE(kAnnounceTextAdditionalAttributes);
|
|
VIEWS_EXPORT BASE_DECLARE_FEATURE(kEnableTouchDragCursorSync);
|
|
+VIEWS_EXPORT BASE_DECLARE_FEATURE(kEnableTransparentHwndEnlargement);
|
|
VIEWS_EXPORT BASE_DECLARE_FEATURE(kKeyboardAccessibleTooltipInViews);
|
|
VIEWS_EXPORT BASE_DECLARE_FEATURE(kApplyInitialUrlToWebContents);
|
|
|
|
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 fd23b8036c7f2d8bf3ed1bba126f8ee813f688a8..392de361fe395b81b346abb477d91d495d00ba34 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
|
|
@@ -84,6 +84,23 @@ namespace {
|
|
// This constant controls how many pixels wide that border is.
|
|
const int kMouseCaptureRegionBorder = 5;
|
|
|
|
+gfx::Size GetExpandedWindowSize(bool is_translucent, gfx::Size size) {
|
|
+ if (!base::FeatureList::IsEnabled(
|
|
+ features::kEnableTransparentHwndEnlargement) ||
|
|
+ !is_translucent) {
|
|
+ return size;
|
|
+ }
|
|
+
|
|
+ // Some AMD drivers can't display windows that are less than 64x64 pixels,
|
|
+ // so expand them to be at least that size. http://crbug.com/286609
|
|
+ gfx::Size expanded(std::max(size.width(), 64), std::max(size.height(), 64));
|
|
+ return expanded;
|
|
+}
|
|
+
|
|
+void InsetBottomRight(gfx::Rect* rect, const gfx::Vector2d& vector) {
|
|
+ rect->Inset(gfx::Insets::TLBR(0, 0, vector.y(), vector.x()));
|
|
+}
|
|
+
|
|
// Updates the cursor clip region. Used for mouse locking.
|
|
void UpdateMouseLockRegion(aura::Window* window, bool locked) {
|
|
if (!locked) {
|
|
@@ -329,9 +346,14 @@ bool DesktopWindowTreeHostWin::IsVisible() const {
|
|
}
|
|
|
|
void DesktopWindowTreeHostWin::SetSize(const gfx::Size& size) {
|
|
- const gfx::Size size_in_pixels =
|
|
+ gfx::Size size_in_pixels =
|
|
display::win::GetScreenWin()->DIPToScreenSize(GetHWND(), size);
|
|
- message_handler_->SetSize(size_in_pixels);
|
|
+ gfx::Size expanded =
|
|
+ GetExpandedWindowSize(message_handler_->is_translucent(), size_in_pixels);
|
|
+ window_enlargement_ =
|
|
+ gfx::Vector2d(expanded.width() - size_in_pixels.width(),
|
|
+ expanded.height() - size_in_pixels.height());
|
|
+ message_handler_->SetSize(expanded);
|
|
}
|
|
|
|
void DesktopWindowTreeHostWin::StackAbove(aura::Window* window) {
|
|
@@ -346,30 +368,40 @@ void DesktopWindowTreeHostWin::StackAtTop() {
|
|
}
|
|
|
|
void DesktopWindowTreeHostWin::CenterWindow(const gfx::Size& size) {
|
|
- const gfx::Size size_in_pixels =
|
|
+ gfx::Size size_in_pixels =
|
|
display::win::GetScreenWin()->DIPToScreenSize(GetHWND(), size);
|
|
- message_handler_->CenterWindow(size_in_pixels);
|
|
+ gfx::Size expanded_size;
|
|
+ expanded_size =
|
|
+ GetExpandedWindowSize(message_handler_->is_translucent(), size_in_pixels);
|
|
+ window_enlargement_ =
|
|
+ gfx::Vector2d(expanded_size.width() - size_in_pixels.width(),
|
|
+ expanded_size.height() - size_in_pixels.height());
|
|
+ message_handler_->CenterWindow(expanded_size);
|
|
}
|
|
|
|
void DesktopWindowTreeHostWin::GetWindowPlacement(
|
|
gfx::Rect* bounds,
|
|
ui::mojom::WindowShowState* show_state) const {
|
|
message_handler_->GetWindowPlacement(bounds, show_state);
|
|
+ InsetBottomRight(bounds, window_enlargement_);
|
|
*bounds = display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), *bounds);
|
|
}
|
|
|
|
gfx::Rect DesktopWindowTreeHostWin::GetWindowBoundsInScreen() const {
|
|
gfx::Rect pixel_bounds = message_handler_->GetWindowBoundsInScreen();
|
|
+ InsetBottomRight(&pixel_bounds, window_enlargement_);
|
|
return display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), pixel_bounds);
|
|
}
|
|
|
|
gfx::Rect DesktopWindowTreeHostWin::GetClientAreaBoundsInScreen() const {
|
|
gfx::Rect pixel_bounds = message_handler_->GetClientAreaBoundsInScreen();
|
|
+ InsetBottomRight(&pixel_bounds, window_enlargement_);
|
|
return display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), pixel_bounds);
|
|
}
|
|
|
|
gfx::Rect DesktopWindowTreeHostWin::GetRestoredBounds() const {
|
|
gfx::Rect pixel_bounds = message_handler_->GetRestoredBounds();
|
|
+ InsetBottomRight(&pixel_bounds, window_enlargement_);
|
|
return display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), pixel_bounds);
|
|
}
|
|
|
|
@@ -677,37 +709,44 @@ void DesktopWindowTreeHostWin::HideImpl() {
|
|
// other get/set methods work in DIP.
|
|
|
|
gfx::Rect DesktopWindowTreeHostWin::GetBoundsInPixels() const {
|
|
- const gfx::Rect bounds_px(message_handler_->GetClientAreaBounds());
|
|
+ gfx::Rect bounds(message_handler_->GetClientAreaBounds());
|
|
// If the window bounds were expanded we need to return the original bounds
|
|
// To achieve this we do the reverse of the expansion, i.e. add the
|
|
// window_expansion_top_left_delta_ to the origin and subtract the
|
|
// window_expansion_bottom_right_delta_ from the width and height.
|
|
- const gfx::Rect without_expansion_bounds_px(
|
|
- bounds_px.x() + window_expansion_top_left_delta_.x(),
|
|
- bounds_px.y() + window_expansion_top_left_delta_.y(),
|
|
- bounds_px.width() - window_expansion_bottom_right_delta_.x(),
|
|
- bounds_px.height() - window_expansion_bottom_right_delta_.y());
|
|
- return without_expansion_bounds_px;
|
|
+ gfx::Rect without_expansion(
|
|
+ bounds.x() + window_expansion_top_left_delta_.x(),
|
|
+ bounds.y() + window_expansion_top_left_delta_.y(),
|
|
+ bounds.width() - window_expansion_bottom_right_delta_.x() -
|
|
+ window_enlargement_.x(),
|
|
+ bounds.height() - window_expansion_bottom_right_delta_.y() -
|
|
+ window_enlargement_.y());
|
|
+ return without_expansion;
|
|
}
|
|
|
|
-void DesktopWindowTreeHostWin::SetBoundsInPixels(
|
|
- const gfx::Rect& bounds_in_pixels) {
|
|
+void DesktopWindowTreeHostWin::SetBoundsInPixels(const gfx::Rect& bounds) {
|
|
// If the window bounds have to be expanded we need to subtract the
|
|
// window_expansion_top_left_delta_ from the origin and add the
|
|
// window_expansion_bottom_right_delta_ to the width and height
|
|
- const gfx::Size old_content_size_px = GetBoundsInPixels().size();
|
|
-
|
|
- const gfx::Rect expanded_bounds_px(
|
|
- bounds_in_pixels.x() - window_expansion_top_left_delta_.x(),
|
|
- bounds_in_pixels.y() - window_expansion_top_left_delta_.y(),
|
|
- bounds_in_pixels.width() + window_expansion_bottom_right_delta_.x(),
|
|
- bounds_in_pixels.height() + window_expansion_bottom_right_delta_.y());
|
|
-
|
|
- // When `expanded_bounds_px` causes the window to be moved to a display with a
|
|
+ gfx::Size old_content_size = GetBoundsInPixels().size();
|
|
+
|
|
+ gfx::Rect expanded(
|
|
+ bounds.x() - window_expansion_top_left_delta_.x(),
|
|
+ bounds.y() - window_expansion_top_left_delta_.y(),
|
|
+ bounds.width() + window_expansion_bottom_right_delta_.x(),
|
|
+ bounds.height() + window_expansion_bottom_right_delta_.y());
|
|
+
|
|
+ gfx::Rect new_expanded(
|
|
+ expanded.origin(),
|
|
+ GetExpandedWindowSize(message_handler_->is_translucent(),
|
|
+ expanded.size()));
|
|
+ window_enlargement_ =
|
|
+ gfx::Vector2d(new_expanded.width() - expanded.width(),
|
|
+ new_expanded.height() - expanded.height());
|
|
+ // When |new_expanded| causes the window to be moved to a display with a
|
|
// different DSF, HWNDMessageHandler::OnDpiChanged() will be called and the
|
|
// window size will be scaled automatically.
|
|
- message_handler_->SetBounds(expanded_bounds_px,
|
|
- old_content_size_px != bounds_in_pixels.size());
|
|
+ message_handler_->SetBounds(new_expanded, old_content_size != bounds.size());
|
|
}
|
|
|
|
gfx::Rect
|
|
@@ -917,18 +956,26 @@ int DesktopWindowTreeHostWin::GetNonClientComponent(
|
|
|
|
void DesktopWindowTreeHostWin::GetWindowMask(const gfx::Size& size_px,
|
|
SkPath* path) {
|
|
- Widget* widget = GetWidget();
|
|
- if (!widget || !widget->non_client_view()) {
|
|
- return;
|
|
- }
|
|
+ // Request the window mask for hwnd of `size_px`. The hwnd size must be
|
|
+ // adjusted by `window_enlargement` to return to the client-expected window
|
|
+ // size (see crbug.com/41047830).
|
|
+ const gfx::Size adjusted_size_in_px =
|
|
+ size_px - gfx::Size(window_enlargement_.x(), window_enlargement_.y());
|
|
|
|
- widget->non_client_view()->GetWindowMask(
|
|
- display::win::GetScreenWin()->ScreenToDIPSize(GetHWND(), size_px), path);
|
|
- // Convert path in DIPs to pixels.
|
|
- if (!path->isEmpty()) {
|
|
- const float scale =
|
|
- display::win::GetScreenWin()->GetScaleFactorForHWND(GetHWND());
|
|
- *path = path->makeTransform(SkMatrix::Scale(scale, scale));
|
|
+ if (Widget* widget = GetWidget(); widget && widget->non_client_view()) {
|
|
+ widget->non_client_view()->GetWindowMask(
|
|
+ display::win::GetScreenWin()->ScreenToDIPSize(GetHWND(),
|
|
+ adjusted_size_in_px),
|
|
+ path);
|
|
+ // Convert path in DIPs to pixels.
|
|
+ if (!path->isEmpty()) {
|
|
+ const float scale =
|
|
+ display::win::GetScreenWin()->GetScaleFactorForHWND(GetHWND());
|
|
+ *path = path->makeTransform(SkMatrix::Scale(scale, scale));
|
|
+ }
|
|
+ } else if (!window_enlargement_.IsZero()) {
|
|
+ *path = SkPath::Rect(SkRect::MakeXYWH(0, 0, adjusted_size_in_px.width(),
|
|
+ adjusted_size_in_px.height()));
|
|
}
|
|
}
|
|
|
|
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
|
index e8acd2828ed05deefa335ce2bb461f0c3be8d7b7..0cd07fd5fb55dcc0d972de4c027fcb895d156592 100644
|
|
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
|
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
|
@@ -175,7 +175,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
|
|
void ShowImpl() override;
|
|
void HideImpl() override;
|
|
gfx::Rect GetBoundsInPixels() const override;
|
|
- void SetBoundsInPixels(const gfx::Rect& bounds_in_pixels) override;
|
|
+ void SetBoundsInPixels(const gfx::Rect& bounds) override;
|
|
gfx::Rect GetBoundsInAcceleratedWidgetPixelCoordinates() override;
|
|
gfx::Point GetLocationOnScreenInPixels() const override;
|
|
void SetCapture() override;
|
|
@@ -328,6 +328,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
|
|
gfx::Vector2d window_expansion_top_left_delta_;
|
|
gfx::Vector2d window_expansion_bottom_right_delta_;
|
|
|
|
+ // Windows are enlarged to be at least 64x64 pixels, so keep track of the
|
|
+ // extra added here.
|
|
+ // TODO(crbug.com/401996981): This is likely no longer necessary and should be
|
|
+ // removed.
|
|
+ gfx::Vector2d window_enlargement_;
|
|
+
|
|
// Whether the window close should be converted to a hide, and then actually
|
|
// closed on the completion of the hide animation. This is cached because
|
|
// the property is set on the contained window which has a shorter lifetime.
|