Skip to content

Commit

Permalink
Th24 RC 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 committed Sep 1, 2024
1 parent b52c98a commit b4c87ed
Showing 1 changed file with 221 additions and 13 deletions.
234 changes: 221 additions & 13 deletions other/thorium-2024-ui.patch
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,21 @@ index 64948595a4bc6..a568c893736ca 100644

static BookmarkNavigationWrapper* g_nav_wrapper_test_instance = nullptr;

diff --git a/chrome/browser/themes/theme_service_factory.cc b/chrome/browser/themes/theme_service_factory.cc
index 49fd0b0f7a21c..c91d24529eb75 100644
--- a/chrome/browser/themes/theme_service_factory.cc
+++ b/chrome/browser/themes/theme_service_factory.cc
@@ -120,7 +120,7 @@ void ThemeServiceFactory::RegisterProfilePrefs(
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
ui::SystemTheme default_system_theme = ui::SystemTheme::kDefault;
#if BUILDFLAG(IS_LINUX)
- default_system_theme = ui::GetDefaultSystemTheme();
+ default_system_theme = ui::SystemTheme::kDefault;
#endif
registry->RegisterIntegerPref(prefs::kSystemTheme,
static_cast<int>(default_system_theme));
diff --git a/chrome/browser/ui/layout_constants.cc b/chrome/browser/ui/layout_constants.cc
index bba403a7e5068..056b405e46ec6 100644
index bba403a7e5068..dae26bd577dcb 100644
--- a/chrome/browser/ui/layout_constants.cc
+++ b/chrome/browser/ui/layout_constants.cc
@@ -1,12 +1,14 @@
Expand Down Expand Up @@ -57,7 +70,7 @@ index bba403a7e5068..056b405e46ec6 100644
// to the white space above and below.
- const int bookmark_bar_attached_vertical_margin =
- features::IsChromeRefresh2023() ? 6 : 4;
+ const int bookmark_bar_attached_vertical_margin = features::IsThorium2024() ? 3 : 6;
+ const int bookmark_bar_attached_vertical_margin = features::IsThorium2024() ? 4 : 6;
return GetLayoutConstant(BOOKMARK_BAR_BUTTON_HEIGHT) +
bookmark_bar_attached_vertical_margin;
}
Expand Down Expand Up @@ -107,21 +120,24 @@ index bba403a7e5068..056b405e46ec6 100644
case TOOLBAR_DIVIDER_WIDTH:
return 2;
case TOOLBAR_ELEMENT_PADDING:
@@ -139,7 +155,7 @@ int GetLayoutConstant(LayoutConstant constant) {
@@ -139,17 +155,17 @@ int GetLayoutConstant(LayoutConstant constant) {
return GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
}
case TOOLBAR_STANDARD_SPACING:
- if (features::IsChromeRefresh2023()) {
+ if (features::IsChromeRefresh2023() && !features::IsThorium2024()) {
return touch_ui ? 12 : 9;
} else {
return touch_ui ? 12 : 8;
@@ -149,7 +165,7 @@ int GetLayoutConstant(LayoutConstant constant) {
- return touch_ui ? 12 : 8;
+ return touch_ui ? 12 : 6;
}
case PAGE_INFO_ICON_SIZE:
return features::IsChromeRefresh2023() ? 20 : 16;
case DOWNLOAD_ICON_SIZE:
return features::IsChromeRefresh2023() ? 20 : 16;
case TOOLBAR_CORNER_RADIUS:
- return 8;
+ return features::IsThorium2024() ? 0 : 8;
+ return 0;
default:
break;
}
Expand Down Expand Up @@ -293,8 +309,27 @@ index aa9cd30374311..c5d3cbd005dae 100644
}

int ChromeRefresh2023TabStyle::GetSeparatorCornerRadius() const {
diff --git a/chrome/browser/ui/views/chrome_layout_provider.cc b/chrome/browser/ui/views/chrome_layout_provider.cc
index efe87aa6d6dd6..be18a870f0217 100644
--- a/chrome/browser/ui/views/chrome_layout_provider.cc
+++ b/chrome/browser/ui/views/chrome_layout_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

@@ -176,7 +176,7 @@ int ChromeLayoutProvider::GetDistanceMetric(int metric) const {
case DISTANCE_INFOBAR_HEIGHT:
// Spec says height of button should be 36dp, vertical padding on both
// top and bottom should be 8dp.
- return 36 + 2 * 8;
+ return features::IsThorium2024() ? 38 : 36 + 2 * 8;
case DISTANCE_PERMISSION_PROMPT_HORIZONTAL_ICON_LABEL_PADDING:
return features::IsChromeRefresh2023()
? 8
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view.cc b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
index f534d7e925b86..e49eee8f0c2b4 100644
index f534d7e925b86..2d2e7812ef123 100644
--- a/chrome/browser/ui/views/frame/tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
@@ -1,4 +1,4 @@
Expand All @@ -308,7 +343,7 @@ index f534d7e925b86..e49eee8f0c2b4 100644
tab_search_container_->SetProperty(
views::kMarginsKey,
- gfx::Insets::TLBR(0, 0, 0, GetLayoutConstant(TAB_STRIP_PADDING)));
+ gfx::Insets::TLBR(0, 0, 0, GetLayoutConstant(TAB_INACTIVE_PADDING)));
+ gfx::Insets::TLBR(0, 0, 0, GetLayoutConstant(TAB_SEARCH_PADDING)));
} else {
const gfx::Insets control_padding = gfx::Insets::TLBR(
0, 0, 0, GetLayoutConstant(TABSTRIP_REGION_VIEW_CONTROL_PADDING));
Expand Down Expand Up @@ -382,6 +417,33 @@ index ae3b649cfcdc6..3bcf134a9b744 100644
bool CanPaintThrobberToLayer() const override;
bool HasVisibleBackgroundTabShapes() const override;
SkColor GetTabSeparatorColor() const override;
diff --git a/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc b/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc
index 66e38eaf7a5e9..6d7e98530ca03 100644
--- a/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc
+++ b/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

@@ -12,6 +12,7 @@
#include "ui/accessibility/mojom/ax_node_data.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
+#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/geometry/size.h"
@@ -31,7 +32,7 @@ SidePanelResizeHandle::SidePanelResizeHandle(SidePanel* side_panel)
SetCanProcessEventsWithinSubtree(false);
SetFocusBehavior(FocusBehavior::ALWAYS);
FocusRing::Install(this);
- if (lens::features::IsLensOverlayEnabled()) {
+ if (lens::features::IsLensOverlayEnabled() && !features::IsThorium2024()) {
const int resize_handle_left_margin = 2;
SetProperty(views::kMarginsKey,
gfx::Insets().set_left(resize_handle_left_margin));
diff --git a/ui/views/controls/menu/menu_config.cc b/ui/views/controls/menu/menu_config.cc
index 83c7f06f1b236..173b829890079 100644
--- a/ui/views/controls/menu/menu_config.cc
Expand Down Expand Up @@ -416,8 +478,154 @@ index 83c7f06f1b236..173b829890079 100644
}

// static
diff --git a/ui/views/controls/menu/menu_config_linux.cc b/ui/views/controls/menu/menu_config_linux.cc
index 7bd7c44ffc724..ee4465054642f 100644
--- a/ui/views/controls/menu/menu_config_linux.cc
+++ b/ui/views/controls/menu/menu_config_linux.cc
@@ -1,9 +1,11 @@
-// Copyright 2015 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/views/controls/menu/menu_config.h"

+#include "chrome/browser/ui/thorium_2024.h"
+#include "ui/base/ui_base_features.h"
#include "ui/ozone/public/ozone_platform.h"

namespace views {
@@ -11,6 +13,7 @@ namespace views {
void MenuConfig::InitPlatform() {
use_bubble_border =
ui::OzonePlatform::GetInstance()->IsWindowCompositingSupported();
+ arrow_to_edge_padding = features::IsThorium2024() ? 4 : 8;
}

} // namespace views
diff --git a/ui/views/controls/menu/menu_config_mac.mm b/ui/views/controls/menu/menu_config_mac.mm
index eabfb364890d3..2374c18b0f3d7 100644
--- a/ui/views/controls/menu/menu_config_mac.mm
+++ b/ui/views/controls/menu/menu_config_mac.mm
@@ -1,17 +1,55 @@
-// Copyright 2014 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

+#import <AppKit/AppKit.h>
+
+#include "base/mac/mac_util.h"
+#include "chrome/browser/ui/thorium_2024.h"
+#include "ui/base/ui_base_features.h"
#include "ui/views/controls/menu/menu_config.h"

+#include "ui/gfx/platform_font_mac.h"
+
+namespace {
+
+void InitMaterialMenuConfig(views::MenuConfig* config) {
+ // These config parameters are from https://crbug.com/829347 and the spec
+ // images linked from that bug.
+ config->submenu_horizontal_overlap = 0;
+ config->minimum_text_item_height = 28;
+ config->minimum_container_item_height = 40;
+ config->arrow_to_edge_padding = 16;
+ config->separator_height = 9;
+ config->separator_lower_height = 4;
+ config->separator_upper_height = 4;
+ config->separator_spacing_height = 5;
+ config->separator_thickness = 1;
+ config->reserve_dedicated_arrow_column = false;
+ config->icons_in_label = true;
+ config->icon_label_spacing = 8;
+ config->corner_radius = 8;
+ config->auxiliary_corner_radius = 4;
+ config->item_horizontal_border_padding = 0;
+}
+
+} // namespace
+
namespace views {

void MenuConfig::InitPlatform() {
check_selected_combobox_item = true;
- arrow_key_selection_wraps = false;
+ arrow_key_selection_wraps = true;
use_mnemonics = false;
- show_context_menu_accelerators = false;
+ show_context_menu_accelerators = features::IsThorium2024() ? true : false;
all_menus_use_prefix_selection = true;
+ if (features::IsThorium2024()) {
+ menu_horizontal_border_size = 0;
+ }
+ use_outer_border = features::IsThorium2024() ? true : false;
+ if (features::IsThorium2024()) {
+ InitMaterialMenuConfig(this);
+ }
}

} // namespace views
diff --git a/ui/views/controls/menu/menu_config_win.cc b/ui/views/controls/menu/menu_config_win.cc
index a2dae078ccbd3..3f9f6090ab699 100644
--- a/ui/views/controls/menu/menu_config_win.cc
+++ b/ui/views/controls/menu/menu_config_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

@@ -8,6 +8,8 @@

#include <Vssym32.h>

+#include "base/win/windows_version.h"
+#include "ui/base/ui_base_features.h"
#include "ui/gfx/system_fonts_win.h"

namespace views {
@@ -22,8 +24,38 @@ void MenuConfig::InitPlatform() {
show_cues == TRUE);

SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &show_delay, 0);
+
+ bool is_win11 = base::win::GetVersion() >= base::win::Version::WIN11;
separator_upper_height = 5;
separator_lower_height = 7;
+ use_outer_border = features::IsThorium2024() ? true : false;
+
+ if (features::IsThorium2024()) {
+ if (is_win11) {
+ corner_radius = 8;
+ menu_horizontal_border_size = 4;
+ submenu_horizontal_overlap = 1;
+ rounded_menu_vertical_border_size = 4;
+ item_horizontal_padding = 12;
+ between_item_vertical_padding = 2;
+ separator_height = 1;
+ separator_upper_height = 1;
+ separator_lower_height = 1;
+ item_corner_radius = 4;
+ use_outer_border = false;
+ } else {
+ menu_horizontal_border_size = 3;
+ nonrounded_menu_vertical_border_size = 3;
+ item_vertical_margin = 3;
+ item_horizontal_border_padding = -2;
+ icon_label_spacing = 10;
+ always_reserve_check_region = true;
+ separator_height = 7;
+ separator_upper_height = 5;
+ separator_lower_height = 5;
+ use_outer_border = true;
+ }
+ }

use_bubble_border = corner_radius > 0;
}
diff --git a/ui/views/layout/layout_provider.cc b/ui/views/layout/layout_provider.cc
index 3684e27766834..72f1751f64c46 100644
index 3684e27766834..5ab1c1ce9da63 100644
--- a/ui/views/layout/layout_provider.cc
+++ b/ui/views/layout/layout_provider.cc
@@ -1,4 +1,4 @@
Expand All @@ -444,13 +652,13 @@ index 3684e27766834..72f1751f64c46 100644
+ case ShapeContextTokens::kBadgeRadius:
+ return 4;
+ case ShapeContextTokens::kButtonRadius:
+ return std::min(size.width(), size.height()) / 2;
+ return 4;
+ case ShapeContextTokens::kComboboxRadius:
+ return 8;
+ return 4;
+ case ShapeContextTokens::kDialogRadius:
+ return 12;
+ return 4;
+ case ShapeContextTokens::kFindBarViewRadius:
+ return 8;
+ return 4;
+ case ShapeContextTokens::kMenuRadius:
+ case ShapeContextTokens::kMenuAuxRadius:
+ return 0;
Expand Down

0 comments on commit b4c87ed

Please sign in to comment.