460fc9b452
* chore: bump chromium in DEPS to 132.0.6791.1 * 5804481: [UI] Migrate remaining clients of `MenuSourceType` https://chromium-review.googlesource.com/c/chromium/src/+/5804481 * chore: bump chromium in DEPS to 132.0.6793.1 * chore: bump chromium in DEPS to 132.0.6794.0 * chore: bump chromium in DEPS to 132.0.6797.0 * 5952404: Clean up //ui/base/resource from Lacros code. https://chromium-review.googlesource.com/c/chromium/src/+/5952404 * 5920842: Generate combined grd for PEPC strings and use them in the element https://chromium-review.googlesource.com/c/chromium/src/+/5920842 * 5943708: Enable DynamicSafeAreaInsets for eligible users only https://chromium-review.googlesource.com/c/chromium/src/+/5943708 * 5937004: Remove components/services/language_detection https://chromium-review.googlesource.com/c/chromium/src/+/5937004 * 5920322: [UI] Use mojo enum for `MenuSourceType` in ui/views/controls/ https://chromium-review.googlesource.com/c/chromium/src/+/5920322 * chore: fixup patch indices * chore: bump chromium in DEPS to 132.0.6799.0 * chore: bump chromium in DEPS to 132.0.6801.0 * chore: bump chromium in DEPS to 132.0.6803.0 * chore: bump chromium in DEPS to 132.0.6805.1 * chore: bump chromium in DEPS to 132.0.6807.0 * chore: bump chromium in DEPS to 132.0.6809.1 * chore: bump chromium in DEPS to 132.0.6811.1 * chore: bump chromium in DEPS to 132.0.6813.1 * chore: bump chromium in DEPS to 132.0.6815.1 * chore: bump chromium in DEPS to 132.0.6817.1 * 5947724: [ui] Add missing shortcut text for VKEY_COMMAND on linux https://chromium-review.googlesource.com/c/chromium/src/+/5947724 (cherry picked from commit 0fdf6c6e510752dcfd9d3062dff71aff55c5fdab) * 5948024: [DNT] Fix NavigationController raw_ptr during WebContents destruction https://chromium-review.googlesource.com/c/chromium/src/+/5948024 (cherry picked from commit f6662c3b6dd5f40691644911a2d527ae48015ccb) * 5945209: Roll libc++ from c8eec3629a9e to e2c39ff9388b (1 revision) https://chromium-review.googlesource.com/c/chromium/src/+/5945209 (cherry picked from commit 55b75a1456ccdb9a9771db741fed14a9706419b7) * 5942398: Remove some chrome:: namespace from chrome/browser/win/* Refs: https://chromium-review.googlesource.com/c/chromium/src/+/5942398 (cherry picked from commit d664ce2434e3995b628b3b252877df4efebc6825) * chore: fixup patch indices (cherry picked from commit 657cd6ee3470291123e8a8d0f6f189f2a3280c5d) * 5963016: FSA: Use the profile path for base::DIR_HOME on ChromeOS Refs: https://chromium-review.googlesource.com/c/chromium/src/+/5963016 (cherry picked from commit 69505baee6d037fe370ec10c0ffa03447a43ab34) * chore: fixup patch indices (cherry picked from commit c79c2c8734a82be32cd7ff6f9d70d3be5e08e50b) * 5924816: [macOS][FSA] Block Access to Application Bundle Path Refs: https://chromium-review.googlesource.com/c/chromium/src/+/5924816 (cherry picked from commit dbcc24fe26337d063a9623379a8e9c2b5a64ce65) * 5962517: [media] Apply inside blink to renderer/platform/media Refs: https://chromium-review.googlesource.com/c/chromium/src/+/5962517 (cherry picked from commit f396860717dc4692c9ee036b91a07d12f3114991) * 5829616: MPArch based GuestViews basic implementation Refs: https://chromium-review.googlesource.com/c/chromium/src/+/5829616 (cherry picked from commit b95772daa33fce58e0c09847c60511e8b53eacb2) * 5953710: Expose a rust_static_library instead of raw rs file from rust_bindgen Refs: https://chromium-review.googlesource.com/c/chromium/src/+/5953710 (cherry picked from commit 11edc865b578d1596d42a4abfb811360c960e51c) * chore: fixup patch indices (cherry picked from commit 7be81bdd02cff8894c4fff141d39408906164a8e) * chore: disable ELF CREL on Linux Arm 5938657: Reapply "Enable ELF CREL, which reduces the size of ELF relocatable object files." | https://chromium-review.googlesource.com/c/chromium/src/+/5938657 (cherry picked from commit 48c5efd0b0ab8fdfafb1b8df2ef35150362df410) * chore: bump chromium in DEPS to 132.0.6807.0 (cherry picked from commit f41da7b5a3b8da6af161ab37c7b6792de1c008d7) * 5868889: Shared Storage: Support saved queries in selectURL Refs: https://chromium-review.googlesource.com/c/chromium/src/+/5868889 (cherry picked from commit 4e389ef21ab0e860373b7aab0cc74beee020b2fe) * Revert "5956408: [fastapi] Promote deprecation of FastApiTypedArray" Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5956408 (cherry picked from commit a4b8e46b34a01e72dbeeaa4fdbae1939402a4ca6) * Revert "5962696: [mojo] Force blink headers to only be included in blink" Refs: https://chromium-review.googlesource.com/c/chromium/src/+/5962696 (cherry picked from commit f0228c286fcb8166ff57cda4dd2b353b4c06b69a) * chore: update patches (cherry picked from commit 3a3c527a1de9ee4f6f3e8545a8e4ff7c6ac6fa0c) * 5973073: [Extensions] Improve warnings parsing (host) permissions in MV3 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/5973073 (cherry picked from commit c571e561e0b4ba06bd40d8ec4e9cfe59ede010c5) * chore: update filenames.libcxx.gni (cherry picked from commit 7677e9bfc6b18ac3556b20fd4f4888e9f2d37431) * Apply suggestions from code review Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> (cherry picked from commit e8dd8215cff2f3f7216b31ef8edc8a3b24c56e2c) * chore: update patches after rebase --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
216 lines
11 KiB
Diff
216 lines
11 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: msizanoen1 <msizanoen@qtmlabs.xyz>
|
|
Date: Tue, 19 Jul 2022 05:11:06 +0200
|
|
Subject: Add maximized parameter to LinuxUI::GetWindowFrameProvider
|
|
|
|
This allows ClientFrameViewLinux to instruct the toolkit to draw the window
|
|
decorations in maximized mode where needed, preventing empty space caused
|
|
by decoration shadows and rounded titlebars around the window while maximized.
|
|
|
|
diff --git a/ui/gtk/gtk_ui.cc b/ui/gtk/gtk_ui.cc
|
|
index ed304ba70b9924678b7318ca5f7c946b1bd90ea7..efdaefadf4c982eb859d7ddb56fc216b9077a25d 100644
|
|
--- a/ui/gtk/gtk_ui.cc
|
|
+++ b/ui/gtk/gtk_ui.cc
|
|
@@ -583,11 +583,12 @@ std::unique_ptr<ui::NavButtonProvider> GtkUi::CreateNavButtonProvider() {
|
|
}
|
|
|
|
ui::WindowFrameProvider* GtkUi::GetWindowFrameProvider(bool solid_frame,
|
|
- bool tiled) {
|
|
- auto& provider = frame_providers_[solid_frame][tiled];
|
|
+ bool tiled,
|
|
+ bool maximized) {
|
|
+ auto& provider = frame_providers_[solid_frame][tiled][maximized];
|
|
if (!provider) {
|
|
provider =
|
|
- std::make_unique<gtk::WindowFrameProviderGtk>(solid_frame, tiled);
|
|
+ std::make_unique<gtk::WindowFrameProviderGtk>(solid_frame, tiled, maximized);
|
|
}
|
|
return provider.get();
|
|
}
|
|
diff --git a/ui/gtk/gtk_ui.h b/ui/gtk/gtk_ui.h
|
|
index 32051374590fc1179e5cfa21ebc34474d2ce0190..09e9399a67d30d4686f4c141050538b8dde9f301 100644
|
|
--- a/ui/gtk/gtk_ui.h
|
|
+++ b/ui/gtk/gtk_ui.h
|
|
@@ -110,7 +110,8 @@ class GtkUi : public ui::LinuxUiAndTheme {
|
|
void SetAccentColor(std::optional<SkColor> accent_color) override;
|
|
std::unique_ptr<ui::NavButtonProvider> CreateNavButtonProvider() override;
|
|
ui::WindowFrameProvider* GetWindowFrameProvider(bool solid_frame,
|
|
- bool tiled) override;
|
|
+ bool tiled,
|
|
+ bool maximized) override;
|
|
|
|
private:
|
|
using TintMap = std::map<int, color_utils::HSL>;
|
|
@@ -199,7 +200,7 @@ class GtkUi : public ui::LinuxUiAndTheme {
|
|
// while Chrome is running. This 2D array is indexed first by whether the
|
|
// frame is translucent (0) or solid(1), then by whether the frame is normal
|
|
// (0) or tiled (1).
|
|
- std::unique_ptr<ui::WindowFrameProvider> frame_providers_[2][2];
|
|
+ std::unique_ptr<ui::WindowFrameProvider> frame_providers_[2][2][2];
|
|
|
|
// Objects to notify when the window frame button order changes.
|
|
base::ObserverList<ui::WindowButtonOrderObserver>::Unchecked
|
|
diff --git a/ui/gtk/window_frame_provider_gtk.cc b/ui/gtk/window_frame_provider_gtk.cc
|
|
index e24cce85b453ecee9a4854bfdf7b8eeb6814f8c3..d3e3e9b918011c433b4ac6ded245803410ccb5d4 100644
|
|
--- a/ui/gtk/window_frame_provider_gtk.cc
|
|
+++ b/ui/gtk/window_frame_provider_gtk.cc
|
|
@@ -29,20 +29,23 @@ constexpr int kMaxFrameSizeDip = 64;
|
|
// will get an incorrect hint as to which pixels are fully opaque.
|
|
constexpr int kMaxCornerRadiusDip = 32;
|
|
|
|
-GtkCssContext WindowContext(bool solid_frame, bool tiled, bool focused) {
|
|
+GtkCssContext WindowContext(bool solid_frame, bool tiled, bool maximized, bool focused) {
|
|
std::string selector = "window.background.";
|
|
selector += solid_frame ? "solid-csd" : "csd";
|
|
if (tiled) {
|
|
selector += ".tiled";
|
|
}
|
|
+ if (maximized) {
|
|
+ selector += ".maximized";
|
|
+ }
|
|
if (!focused) {
|
|
selector += ":inactive";
|
|
}
|
|
return AppendCssNodeToStyleContext({}, selector);
|
|
}
|
|
|
|
-GtkCssContext DecorationContext(bool solid_frame, bool tiled, bool focused) {
|
|
- auto context = WindowContext(solid_frame, tiled, focused);
|
|
+GtkCssContext DecorationContext(bool solid_frame, bool tiled, bool maximized, bool focused) {
|
|
+ auto context = WindowContext(solid_frame, tiled, maximized, focused);
|
|
// GTK4 renders the decoration directly on the window.
|
|
if (!GtkCheckVersion(4)) {
|
|
context = AppendCssNodeToStyleContext(context, "decoration");
|
|
@@ -61,8 +64,8 @@ GtkCssContext DecorationContext(bool solid_frame, bool tiled, bool focused) {
|
|
return context;
|
|
}
|
|
|
|
-GtkCssContext HeaderContext(bool solid_frame, bool tiled, bool focused) {
|
|
- auto context = WindowContext(solid_frame, tiled, focused);
|
|
+GtkCssContext HeaderContext(bool solid_frame, bool tiled, bool maximized, bool focused) {
|
|
+ auto context = WindowContext(solid_frame, tiled, maximized, focused);
|
|
context =
|
|
AppendCssNodeToStyleContext(context, "headerbar.header-bar.titlebar");
|
|
if (!focused) {
|
|
@@ -117,8 +120,8 @@ int ComputeTopCornerRadius() {
|
|
// need to experimentally determine the corner radius by rendering a sample.
|
|
// Additionally, in GTK4, the headerbar corners get clipped by the window
|
|
// rather than the headerbar having its own rounded corners.
|
|
- auto context = GtkCheckVersion(4) ? DecorationContext(false, false, false)
|
|
- : HeaderContext(false, false, false);
|
|
+ auto context = GtkCheckVersion(4) ? DecorationContext(false, false, false, false)
|
|
+ : HeaderContext(false, false, false, false);
|
|
ApplyCssToContext(context, R"(window, headerbar {
|
|
background-image: none;
|
|
background-color: black;
|
|
@@ -152,7 +155,7 @@ int ComputeTopCornerRadius() {
|
|
bool HeaderIsTranslucent() {
|
|
// The arbitrary square size to render a sample header.
|
|
constexpr int kHeaderSize = 32;
|
|
- auto context = HeaderContext(false, false, false);
|
|
+ auto context = HeaderContext(false, false, false, false);
|
|
double opacity = GetOpacityFromContext(context);
|
|
if (opacity < 1.0) {
|
|
return true;
|
|
@@ -186,8 +189,8 @@ WindowFrameProviderGtk::Asset& WindowFrameProviderGtk::Asset::operator=(
|
|
|
|
WindowFrameProviderGtk::Asset::~Asset() = default;
|
|
|
|
-WindowFrameProviderGtk::WindowFrameProviderGtk(bool solid_frame, bool tiled)
|
|
- : solid_frame_(solid_frame), tiled_(tiled) {
|
|
+WindowFrameProviderGtk::WindowFrameProviderGtk(bool solid_frame, bool tiled, bool maximized)
|
|
+ : solid_frame_(solid_frame), tiled_(tiled), maximized_(maximized) {
|
|
GtkSettings* settings = gtk_settings_get_default();
|
|
// Unretained() is safe since WindowFrameProviderGtk will own the signals.
|
|
auto callback = base::BindRepeating(&WindowFrameProviderGtk::OnThemeChanged,
|
|
@@ -337,7 +340,7 @@ void WindowFrameProviderGtk::PaintWindowFrame(gfx::Canvas* canvas,
|
|
|
|
auto header =
|
|
PaintHeaderbar({client_bounds_px.width(), top_area_height_px},
|
|
- HeaderContext(solid_frame_, tiled_, focused), scale);
|
|
+ HeaderContext(solid_frame_, tiled_, maximized_, focused), scale);
|
|
image = gfx::ImageSkia::CreateFrom1xBitmap(header);
|
|
// In GTK4, the headerbar gets clipped by the window.
|
|
if (GtkCheckVersion(4)) {
|
|
@@ -366,7 +369,7 @@ WindowFrameProviderGtk::Asset& WindowFrameProviderGtk::GetOrCreateAsset(
|
|
|
|
gfx::Rect frame_bounds_dip(kMaxFrameSizeDip, kMaxFrameSizeDip,
|
|
2 * kMaxFrameSizeDip, 2 * kMaxFrameSizeDip);
|
|
- auto focused_context = DecorationContext(solid_frame_, tiled_, true);
|
|
+ auto focused_context = DecorationContext(solid_frame_, tiled_, maximized_, true);
|
|
frame_bounds_dip.Inset(-GtkStyleContextGetPadding(focused_context));
|
|
frame_bounds_dip.Inset(-GtkStyleContextGetBorder(focused_context));
|
|
gfx::Size bitmap_size(BitmapSizePx(asset), BitmapSizePx(asset));
|
|
@@ -374,7 +377,7 @@ WindowFrameProviderGtk::Asset& WindowFrameProviderGtk::GetOrCreateAsset(
|
|
focused_context, scale);
|
|
asset.unfocused_bitmap =
|
|
PaintBitmap(bitmap_size, gfx::RectF(frame_bounds_dip),
|
|
- DecorationContext(solid_frame_, tiled_, false), scale);
|
|
+ DecorationContext(solid_frame_, tiled_, maximized_, false), scale);
|
|
|
|
return asset;
|
|
}
|
|
diff --git a/ui/gtk/window_frame_provider_gtk.h b/ui/gtk/window_frame_provider_gtk.h
|
|
index 4faaae32a203bfa57f3e61c391dc6917c4a0bf59..94050a0136b78730f607f42991742e0434948d0e 100644
|
|
--- a/ui/gtk/window_frame_provider_gtk.h
|
|
+++ b/ui/gtk/window_frame_provider_gtk.h
|
|
@@ -20,7 +20,7 @@ namespace gtk {
|
|
|
|
class WindowFrameProviderGtk : public ui::WindowFrameProvider {
|
|
public:
|
|
- WindowFrameProviderGtk(bool solid_frame, bool tiled);
|
|
+ WindowFrameProviderGtk(bool solid_frame, bool tiled, bool maximized);
|
|
|
|
WindowFrameProviderGtk(const WindowFrameProviderGtk&) = delete;
|
|
WindowFrameProviderGtk& operator=(const WindowFrameProviderGtk&) = delete;
|
|
@@ -65,6 +65,8 @@ class WindowFrameProviderGtk : public ui::WindowFrameProvider {
|
|
// Input parameters used for drawing.
|
|
const bool solid_frame_;
|
|
const bool tiled_;
|
|
+ // Whether to draw the window decorations as maximized.
|
|
+ const bool maximized_;
|
|
|
|
// Scale-independent metric calculated based on the bitmaps.
|
|
std::optional<gfx::Insets> frame_thickness_dip_;
|
|
diff --git a/ui/linux/fallback_linux_ui.cc b/ui/linux/fallback_linux_ui.cc
|
|
index e4a7f8eb0ef8bacd2d4e4231d0990b4a01021626..3477542587b08691c164941b2c2e3b22050231ca 100644
|
|
--- a/ui/linux/fallback_linux_ui.cc
|
|
+++ b/ui/linux/fallback_linux_ui.cc
|
|
@@ -143,7 +143,8 @@ FallbackLinuxUi::CreateNavButtonProvider() {
|
|
|
|
ui::WindowFrameProvider* FallbackLinuxUi::GetWindowFrameProvider(
|
|
bool solid_frame,
|
|
- bool tiled) {
|
|
+ bool tiled,
|
|
+ bool maximized) {
|
|
return nullptr;
|
|
}
|
|
|
|
diff --git a/ui/linux/fallback_linux_ui.h b/ui/linux/fallback_linux_ui.h
|
|
index 0800349bc18753e6a41a938c70213dd7dd123d0d..a1553e0cb1fac188fb2c74e10163c52dead02f29 100644
|
|
--- a/ui/linux/fallback_linux_ui.h
|
|
+++ b/ui/linux/fallback_linux_ui.h
|
|
@@ -67,7 +67,8 @@ class FallbackLinuxUi : public LinuxUiAndTheme {
|
|
void SetAccentColor(std::optional<SkColor> accent_color) override;
|
|
std::unique_ptr<ui::NavButtonProvider> CreateNavButtonProvider() override;
|
|
ui::WindowFrameProvider* GetWindowFrameProvider(bool solid_frame,
|
|
- bool tiled) override;
|
|
+ bool tiled,
|
|
+ bool maximized) override;
|
|
|
|
private:
|
|
std::optional<gfx::FontRenderParams> default_font_render_params_;
|
|
diff --git a/ui/linux/linux_ui.h b/ui/linux/linux_ui.h
|
|
index 1e59679d206462f72495d587740ac48ba0fa30df..090e770ac2f8e5231f2bdd11247cacaceb0c7ef6 100644
|
|
--- a/ui/linux/linux_ui.h
|
|
+++ b/ui/linux/linux_ui.h
|
|
@@ -306,7 +306,8 @@ class COMPONENT_EXPORT(LINUX_UI) LinuxUiTheme {
|
|
// The returned object is not owned by the caller and will remain alive until
|
|
// the process ends.
|
|
virtual WindowFrameProvider* GetWindowFrameProvider(bool solid_frame,
|
|
- bool tiled) = 0;
|
|
+ bool tiled,
|
|
+ bool maximized) = 0;
|
|
|
|
protected:
|
|
LinuxUiTheme();
|