mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-10 03:47:44 -03:00
395 lines
16 KiB
Diff
395 lines
16 KiB
Diff
diff --git a/chrome/browser/ui/layout_constants.cc b/chrome/browser/ui/layout_constants.cc
|
|
index bba403a7e5068..52d3d6485cecb 100644
|
|
--- a/chrome/browser/ui/layout_constants.cc
|
|
+++ b/chrome/browser/ui/layout_constants.cc
|
|
@@ -1,12 +1,14 @@
|
|
-// 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 "chrome/browser/ui/layout_constants.h"
|
|
|
|
+#include "base/command_line.h"
|
|
#include "base/feature_list.h"
|
|
#include "base/notreached.h"
|
|
#include "build/build_config.h"
|
|
+#include "chrome/browser/ui/thorium_2024.h"
|
|
#include "chrome/browser/ui/ui_features.h"
|
|
#include "components/omnibox/common/omnibox_features.h"
|
|
#include "ui/base/pointer/touch_ui_controller.h"
|
|
@@ -27,8 +29,7 @@ int GetLayoutConstant(LayoutConstant constant) {
|
|
case BOOKMARK_BAR_HEIGHT: {
|
|
// The fixed margin ensures the bookmark buttons appear centered relative
|
|
// 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 = Th24State() ? 4 : 6;
|
|
return GetLayoutConstant(BOOKMARK_BAR_BUTTON_HEIGHT) +
|
|
bookmark_bar_attached_vertical_margin;
|
|
}
|
|
@@ -97,7 +98,13 @@ int GetLayoutConstant(LayoutConstant constant) {
|
|
return GetLayoutConstant(TAB_HEIGHT) +
|
|
GetLayoutConstant(TAB_STRIP_PADDING);
|
|
case TAB_STRIP_PADDING:
|
|
- return features::IsChromeRefresh2023() ? 6 : 0;
|
|
+ return Th24State() ? 0 : 6;
|
|
+ case TAB_MARGIN:
|
|
+ return Th24State() ? 6 : GetLayoutConstant(TAB_STRIP_PADDING);
|
|
+ case TAB_INACTIVE_PADDING:
|
|
+ return Th24State() ? 3 : 6;
|
|
+ case TAB_SEARCH_PADDING:
|
|
+ return Th24State() ? 4 : 0;
|
|
case TAB_SEPARATOR_HEIGHT:
|
|
// TODO (crbug.com/1451400): ChromeRefresh2023 needs different values for
|
|
// this constant.
|
|
@@ -139,7 +146,7 @@ int GetLayoutConstant(LayoutConstant constant) {
|
|
return GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
|
|
}
|
|
case TOOLBAR_STANDARD_SPACING:
|
|
- if (features::IsChromeRefresh2023()) {
|
|
+ if (features::IsChromeRefresh2023() && !Th24State()) {
|
|
return touch_ui ? 12 : 9;
|
|
} else {
|
|
return touch_ui ? 12 : 8;
|
|
@@ -149,7 +156,7 @@ int GetLayoutConstant(LayoutConstant constant) {
|
|
case DOWNLOAD_ICON_SIZE:
|
|
return features::IsChromeRefresh2023() ? 20 : 16;
|
|
case TOOLBAR_CORNER_RADIUS:
|
|
- return 8;
|
|
+ return Th24State() ? 0 : 8;
|
|
default:
|
|
break;
|
|
}
|
|
diff --git a/chrome/browser/ui/layout_constants.h b/chrome/browser/ui/layout_constants.h
|
|
index d26bc737d3177..f453b459eb3f8 100644
|
|
--- a/chrome/browser/ui/layout_constants.h
|
|
+++ b/chrome/browser/ui/layout_constants.h
|
|
@@ -1,4 +1,4 @@
|
|
-// 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.
|
|
|
|
@@ -119,9 +119,18 @@ enum LayoutConstant {
|
|
// detached tab, and on all sides of the controls padding.
|
|
TAB_STRIP_PADDING,
|
|
|
|
+ // For the tab margins
|
|
+ TAB_MARGIN,
|
|
+
|
|
+ // For inactive tab padding
|
|
+ TAB_INACTIVE_PADDING,
|
|
+
|
|
// The height of a separator in the tabstrip.
|
|
TAB_SEPARATOR_HEIGHT,
|
|
|
|
+ // Padding for the tab search button
|
|
+ TAB_SEARCH_PADDING,
|
|
+
|
|
// Padding before the tab title.
|
|
TAB_PRE_TITLE_PADDING,
|
|
|
|
diff --git a/chrome/browser/ui/tabs/tab_style.cc b/chrome/browser/ui/tabs/tab_style.cc
|
|
index aa9cd30374311..d544ca4cf4d40 100644
|
|
--- a/chrome/browser/ui/tabs/tab_style.cc
|
|
+++ b/chrome/browser/ui/tabs/tab_style.cc
|
|
@@ -1,27 +1,32 @@
|
|
-// Copyright 2019 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 "chrome/browser/ui/tabs/tab_style.h"
|
|
|
|
#include "chrome/browser/ui/layout_constants.h"
|
|
+#include "chrome/browser/ui/thorium_2024.h"
|
|
#include "chrome/browser/ui/ui_features.h"
|
|
#include "ui/base/ui_base_features.h"
|
|
#include "ui/color/color_provider.h"
|
|
#include "ui/views/layout/layout_provider.h"
|
|
|
|
namespace {
|
|
-
|
|
// Thickness in DIPs of the separator painted on the left and right edges of
|
|
// the tab.
|
|
constexpr int kGM2SeparatorThickness = 1;
|
|
+constexpr int kThoriumSeparatorThickness = 2;
|
|
constexpr int kChromeRefreshSeparatorThickness = 2;
|
|
+constexpr int kThoriumSeparatorHorizontalMargin = 1;
|
|
constexpr int kChromeRefreshSeparatorHorizontalMargin = 2;
|
|
// TODO (crbug.com/1451400): This constant should be in LayoutConstants.
|
|
+constexpr int kThoriumSeparatorHeight = 20;
|
|
constexpr int kChromeRefreshSeparatorHeight = 16;
|
|
|
|
// The padding from the top of the tab to the content area.
|
|
+constexpr int kThoriumTabVerticalPadding = 9;
|
|
constexpr int kChromeRefreshTabVerticalPadding = 6;
|
|
+constexpr int kThoriumTabHorizontalPadding = 6;
|
|
constexpr int kChromeRefreshTabHorizontalPadding = 8;
|
|
|
|
class GM2TabStyle : public TabStyle {
|
|
@@ -197,11 +202,27 @@ float GM2TabStyle::GetSelectedTabOpacity() const {
|
|
}
|
|
|
|
int ChromeRefresh2023TabStyle::GetTopCornerRadius() const {
|
|
- return 10;
|
|
+ static const bool rectangular_tabs =
|
|
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
|
|
+ if (Th24State()) {
|
|
+ return 8;
|
|
+ } else if (rectangular_tabs) {
|
|
+ return 0;
|
|
+ } else {
|
|
+ return 10;
|
|
+ }
|
|
}
|
|
|
|
int ChromeRefresh2023TabStyle::GetBottomCornerRadius() const {
|
|
- return 12;
|
|
+ static const bool rectangular_tabs =
|
|
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
|
|
+ if (Th24State()) {
|
|
+ return 10;
|
|
+ } else if (rectangular_tabs) {
|
|
+ return 0;
|
|
+ } else {
|
|
+ return 12;
|
|
+ }
|
|
}
|
|
|
|
int ChromeRefresh2023TabStyle::GetTabOverlap() const {
|
|
@@ -213,23 +234,43 @@ int ChromeRefresh2023TabStyle::GetTabOverlap() const {
|
|
}
|
|
|
|
gfx::Size ChromeRefresh2023TabStyle::GetSeparatorSize() const {
|
|
- return gfx::Size(kChromeRefreshSeparatorThickness,
|
|
- kChromeRefreshSeparatorHeight);
|
|
+ if (Th24State()) {
|
|
+ return gfx::Size(kThoriumSeparatorThickness,
|
|
+ kThoriumSeparatorHeight);
|
|
+ } else {
|
|
+ return gfx::Size(kChromeRefreshSeparatorThickness,
|
|
+ kChromeRefreshSeparatorHeight);
|
|
+ }
|
|
}
|
|
|
|
gfx::Insets ChromeRefresh2023TabStyle::GetContentsInsets() const {
|
|
- return gfx::Insets::TLBR(
|
|
- kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
|
|
- GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding,
|
|
- kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
|
|
- GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding);
|
|
+ if (Th24State()) {
|
|
+ return gfx::Insets::TLBR(
|
|
+ kThoriumTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
|
|
+ GetBottomCornerRadius() + kThoriumTabHorizontalPadding,
|
|
+ kThoriumTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
|
|
+ GetBottomCornerRadius() + kThoriumTabHorizontalPadding);
|
|
+ } else {
|
|
+ return gfx::Insets::TLBR(
|
|
+ kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
|
|
+ GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding,
|
|
+ kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
|
|
+ GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding);
|
|
+ }
|
|
}
|
|
|
|
gfx::Insets ChromeRefresh2023TabStyle::GetSeparatorMargins() const {
|
|
- return gfx::Insets::TLBR(GetLayoutConstant(TAB_STRIP_PADDING),
|
|
- kChromeRefreshSeparatorHorizontalMargin,
|
|
- GetLayoutConstant(TAB_STRIP_PADDING),
|
|
- kChromeRefreshSeparatorHorizontalMargin);
|
|
+ if (Th24State()) {
|
|
+ return gfx::Insets::TLBR(GetLayoutConstant(TAB_INACTIVE_PADDING),
|
|
+ kThoriumSeparatorHorizontalMargin,
|
|
+ GetLayoutConstant(TAB_INACTIVE_PADDING),
|
|
+ kThoriumSeparatorHorizontalMargin);
|
|
+ } else {
|
|
+ return gfx::Insets::TLBR(GetLayoutConstant(TAB_STRIP_PADDING),
|
|
+ kChromeRefreshSeparatorHorizontalMargin,
|
|
+ GetLayoutConstant(TAB_STRIP_PADDING),
|
|
+ kChromeRefreshSeparatorHorizontalMargin);
|
|
+ }
|
|
}
|
|
|
|
int ChromeRefresh2023TabStyle::GetSeparatorCornerRadius() const {
|
|
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
|
|
--- 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 @@
|
|
-// Copyright 2019 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.
|
|
|
|
@@ -222,7 +222,7 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr<TabStrip> tab_strip)
|
|
if (features::IsChromeRefresh2023()) {
|
|
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)));
|
|
} else {
|
|
const gfx::Insets control_padding = gfx::Insets::TLBR(
|
|
0, 0, 0, GetLayoutConstant(TABSTRIP_REGION_VIEW_CONTROL_PADDING));
|
|
@@ -357,7 +357,7 @@ void TabStripRegionView::Layout(PassKey) {
|
|
int product_specifications_button_width =
|
|
product_specifications_button_
|
|
? product_specifications_button_->GetPreferredSize().width()
|
|
- : 0;
|
|
+ : GetLayoutConstant(TAB_SEARCH_PADDING);
|
|
AdjustViewBoundsRect(tab_search_container_,
|
|
product_specifications_button_width);
|
|
}
|
|
@@ -372,7 +372,7 @@ void TabStripRegionView::Layout(PassKey) {
|
|
gfx::Point new_tab_button_new_position =
|
|
gfx::Point(tab_strip_container_->bounds().right() -
|
|
TabStyle::Get()->GetBottomCornerRadius() +
|
|
- GetLayoutConstant(TAB_STRIP_PADDING),
|
|
+ GetLayoutConstant(TAB_MARGIN),
|
|
0);
|
|
|
|
gfx::Rect new_tab_button_new_bounds =
|
|
@@ -502,7 +502,7 @@ void TabStripRegionView::UpdateTabStripMargin() {
|
|
new_tab_button_->SetProperty(views::kViewIgnoredByLayoutKey, true);
|
|
|
|
tab_strip_right_margin = new_tab_button_->GetPreferredSize().width() +
|
|
- GetLayoutConstant(TAB_STRIP_PADDING);
|
|
+ GetLayoutConstant(TAB_MARGIN);
|
|
}
|
|
|
|
// If the tab search button is before the tab strip, it also overlaps the
|
|
@@ -528,8 +528,8 @@ void TabStripRegionView::UpdateTabStripMargin() {
|
|
// should have 6 px of padding between it and the tab_search button (not
|
|
// including the corner radius).
|
|
tab_strip_left_margin = tab_strip_left_margin.value() +
|
|
- GetLayoutConstant(TAB_STRIP_PADDING) +
|
|
- GetLayoutConstant(TAB_STRIP_PADDING) -
|
|
+ GetLayoutConstant(TAB_INACTIVE_PADDING) +
|
|
+ GetLayoutConstant(TAB_INACTIVE_PADDING) -
|
|
TabStyle::Get()->GetBottomCornerRadius();
|
|
}
|
|
|
|
diff --git a/chrome/browser/ui/views/tabs/tab_slot_controller.h b/chrome/browser/ui/views/tabs/tab_slot_controller.h
|
|
index e928216ad00f7..4f33e232910c1 100644
|
|
--- a/chrome/browser/ui/views/tabs/tab_slot_controller.h
|
|
+++ b/chrome/browser/ui/views/tabs/tab_slot_controller.h
|
|
@@ -167,6 +167,9 @@ class TabSlotController {
|
|
// 0 if there is no stroke.
|
|
virtual int GetStrokeThickness() const = 0;
|
|
|
|
+ // Returns the inactive vertical tab offset when strokes are enabled.
|
|
+ virtual int Th24StrokeOffset() const = 0;
|
|
+
|
|
// Returns true if tab loading throbbers can be painted to a composited layer.
|
|
// This can only be done when the TabController can guarantee that nothing
|
|
// in the same window will redraw on top of the the favicon area of any tab.
|
|
diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h
|
|
index ae3b649cfcdc6..3bcf134a9b744 100644
|
|
--- a/chrome/browser/ui/views/tabs/tab_strip.h
|
|
+++ b/chrome/browser/ui/views/tabs/tab_strip.h
|
|
@@ -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.
|
|
|
|
@@ -291,6 +291,7 @@ class TabStrip : public views::View,
|
|
bool HoverCardIsShowingForTab(Tab* tab) override;
|
|
int GetBackgroundOffset() const override;
|
|
int GetStrokeThickness() const override;
|
|
+ int Th24StrokeOffset() const override;
|
|
bool CanPaintThrobberToLayer() const override;
|
|
bool HasVisibleBackgroundTabShapes() const override;
|
|
SkColor GetTabSeparatorColor() const override;
|
|
diff --git a/ui/views/controls/menu/menu_config.cc b/ui/views/controls/menu/menu_config.cc
|
|
index 83c7f06f1b236..576150ff56af4 100644
|
|
--- a/ui/views/controls/menu/menu_config.cc
|
|
+++ b/ui/views/controls/menu/menu_config.cc
|
|
@@ -1,10 +1,11 @@
|
|
-// 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.
|
|
|
|
#include "ui/views/controls/menu/menu_config.h"
|
|
|
|
#include "base/no_destructor.h"
|
|
+#include "chrome/browser/ui/thorium_2024.h"
|
|
#include "ui/base/ui_base_features.h"
|
|
#include "ui/views/controls/menu/menu_controller.h"
|
|
#include "ui/views/controls/menu/menu_item_view.h"
|
|
@@ -55,12 +56,12 @@ void MenuConfig::InitCommon() {
|
|
reserve_dedicated_arrow_column = false;
|
|
menu_horizontal_border_size = 0;
|
|
submenu_horizontal_overlap = 0;
|
|
- item_vertical_margin = 6;
|
|
+ item_vertical_margin = Th24State() ? 4 : 6;
|
|
item_horizontal_border_padding = 12;
|
|
arrow_size = 16;
|
|
- separator_height = 17;
|
|
- separator_spacing_height = 4;
|
|
- use_outer_border = false;
|
|
+ separator_height = Th24State() ? 11 : 17;
|
|
+ separator_spacing_height = Th24State() ? 3 : 4;
|
|
+ use_outer_border = Th24State() ? true : false;
|
|
}
|
|
|
|
// static
|
|
diff --git a/ui/views/layout/layout_provider.cc b/ui/views/layout/layout_provider.cc
|
|
index 3684e27766834..d62fe3f96ab62 100644
|
|
--- a/ui/views/layout/layout_provider.cc
|
|
+++ b/ui/views/layout/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.
|
|
|
|
@@ -8,6 +8,7 @@
|
|
|
|
#include "base/containers/fixed_flat_map.h"
|
|
#include "base/logging.h"
|
|
+#include "chrome/browser/ui/thorium_2024.h"
|
|
#include "ui/base/ui_base_features.h"
|
|
#include "ui/gfx/font_list.h"
|
|
#include "ui/views/controls/focus_ring.h"
|
|
@@ -208,6 +209,37 @@ ShapeSysTokens GetShapeSysToken(ShapeContextTokens id) {
|
|
|
|
int LayoutProvider::GetCornerRadiusMetric(ShapeContextTokens id,
|
|
const gfx::Size& size) const {
|
|
+
|
|
+ if (Th24State()) {
|
|
+ switch (id) {
|
|
+ case ShapeContextTokens::kBadgeRadius:
|
|
+ return 4;
|
|
+ case ShapeContextTokens::kButtonRadius:
|
|
+ return std::min(size.width(), size.height()) / 2;
|
|
+ case ShapeContextTokens::kComboboxRadius:
|
|
+ return 8;
|
|
+ case ShapeContextTokens::kDialogRadius:
|
|
+ return 12;
|
|
+ case ShapeContextTokens::kFindBarViewRadius:
|
|
+ return 8;
|
|
+ case ShapeContextTokens::kMenuRadius:
|
|
+ case ShapeContextTokens::kMenuAuxRadius:
|
|
+ return 0;
|
|
+ case ShapeContextTokens::kMenuTouchRadius:
|
|
+ return 8;
|
|
+ case ShapeContextTokens::kOmniboxExpandedRadius:
|
|
+ return 16;
|
|
+ case ShapeContextTokens::kTextfieldRadius:
|
|
+ return 8;
|
|
+ case ShapeContextTokens::kSidePanelContentRadius:
|
|
+ return 16;
|
|
+ case ShapeContextTokens::kSidePanelPageContentRadius:
|
|
+ return 8;
|
|
+ default:
|
|
+ return 0;
|
|
+ }
|
|
+ }
|
|
+
|
|
if (!features::IsChromeRefresh2023()) {
|
|
switch (id) {
|
|
case ShapeContextTokens::kBadgeRadius:
|