Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when vertical tabs are displayed with certain themes (uplift to 1.59.x) #20514

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions browser/ui/views/frame/vertical_tab_strip_region_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,6 @@ class VerticalTabNewTabButton : public BraveNewTabButton {
}

void OnPaintFill(gfx::Canvas* canvas) const override {
if (tab_strip()
->GetCustomBackgroundId(BrowserFrameActiveState::kUseCurrent)
.has_value()) {
BraveNewTabButton::OnPaintFill(canvas);
return;
}

auto* cp = GetColorProvider();
CHECK(cp);

Expand Down
11 changes: 10 additions & 1 deletion browser/ui/views/tabs/brave_tab_style_views.inc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,16 @@ TabStyle::SeparatorBounds BraveVerticalTabStyle::GetSeparatorBounds(
}

void BraveVerticalTabStyle::PaintTab(gfx::Canvas* canvas) const {
BraveGM2TabStyle::PaintTab(canvas);
if (ShouldShowVerticalTabs()) {
// For vertical tabs, bypass the upstream logic to paint theme backgrounds,
// as this can cause crashes due to the vertical tabstrip living in a
// different widget hierarchy.
PaintTabBackground(canvas, GetSelectionState(), IsHoverAnimationActive(),
absl::nullopt, 0);
} else {
BraveGM2TabStyle::PaintTab(canvas);
}

if (!ShouldShowVerticalTabs()) {
return;
}
Expand Down