Skip to content

Commit

Permalink
CR2023 also involved removing the new tab button class and replacing …
Browse files Browse the repository at this point in the history
…it with a less-capable class covering all three tab-related buttons (new tab, tab search and tab organization) which needs major changes to render a non-rectangular shape. The trapezoidal tab has also been shortened as its canvas has shrunk.
  • Loading branch information
win32ss committed Sep 3, 2024
1 parent 5817c66 commit 798830e
Show file tree
Hide file tree
Showing 4 changed files with 255 additions and 84 deletions.
10 changes: 6 additions & 4 deletions chrome/browser/ui/tabs/tab_style.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ int GM2TabStyle::GetDragHandleExtension(int height) const {
}

gfx::Size GM2TabStyle::GetSeparatorSize() const {
if(base::CommandLine::ForCurrentProcess()->HasSwitch("compact-ui"))
return gfx::Size(kGM2SeparatorThickness,
if (base::FeatureList::IsEnabled(features::kSupermiumCustomTabs))
return gfx::Size(0, 0);
if (base::CommandLine::ForCurrentProcess()->HasSwitch("compact-ui"))
return gfx::Size(kGM2SeparatorThickness,
GetLayoutConstant(TAB_SEPARATOR_HEIGHT) * 0.6);
return gfx::Size(kGM2SeparatorThickness,
GetLayoutConstant(TAB_SEPARATOR_HEIGHT));
return gfx::Size(kGM2SeparatorThickness,
GetLayoutConstant(TAB_SEPARATOR_HEIGHT));
}

gfx::Insets GM2TabStyle::GetSeparatorMargins() const {
Expand Down
22 changes: 18 additions & 4 deletions chrome/browser/ui/views/frame/tab_strip_region_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,30 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr<TabStrip> tab_strip)
}

if (ShouldShowNewTabButton(browser)) {
std::unique_ptr<TabStripControlButton> tab_strip_control_button =
if (features::IsChromeRefresh2023()) {
std::unique_ptr<TabStripControlButton> tab_strip_control_button =
std::make_unique<TabStripControlButton>(
tab_strip_->controller(),
base::BindRepeating(&TabStrip::NewTabButtonPressed,
base::Unretained(tab_strip_)),
vector_icons::kAddChromeRefreshIcon);
tab_strip_control_button->SetProperty(views::kElementIdentifierKey,
kAddIcon);
tab_strip_control_button->SetProperty(views::kElementIdentifierKey,
kNewTabButtonElementId);

new_tab_button_ = AddChildView(std::move(tab_strip_control_button));
new_tab_button_ = AddChildView(std::move(tab_strip_control_button));

} else {
std::unique_ptr<NewTabButton> new_tab_button =
std::make_unique<NewTabButton>(
tab_strip_, base::BindRepeating(&TabStrip::NewTabButtonPressed,
base::Unretained(tab_strip_)));
new_tab_button->SetImageVerticalAlignment(
views::ImageButton::ALIGN_BOTTOM);
new_tab_button->SetEventTargeter(
std::make_unique<views::ViewTargeter>(new_tab_button.get()));

new_tab_button_ = AddChildView(std::move(new_tab_button));
}

new_tab_button_->SetTooltipText(
l10n_util::GetStringUTF16(IDS_TOOLTIP_NEW_TAB));
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/ui/views/tabs/new_tab_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ SkPath NewTabButton::GetBorderPath(const gfx::Point& origin,
radius);
}
} else {
SkPoint pts [] = {SkPoint(0.0, 8.0), SkPoint(24.0, 8.0), SkPoint(30.0, 20.0), SkPoint(6.0, 20.0)};
path.moveTo(origin.x() * 1.10, SkScalar(8.0));
path.addPoly(pts, 4, true);
SkPoint pts [] = {SkPoint(4.0, 8.0), SkPoint(22.0, 8.0), SkPoint(28.0, 20.0), SkPoint(10.0, 20.0)};
path.moveTo(origin.x() * 1.10, SkScalar(8.0));
path.addPoly(pts, 4, true);
}
return path;
}
Expand Down
Loading

0 comments on commit 798830e

Please sign in to comment.