Skip to content

Commit

Permalink
Updated active/hover bg color of inactive tab in split view
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhong committed Dec 14, 2024
1 parent 30c4797 commit 63e2244
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
7 changes: 7 additions & 0 deletions browser/ui/color/brave_color_mixer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -724,4 +724,11 @@ void AddBravifiedTabStripColorMixer(ui::ColorProvider* provider,
ui::AlphaBlend({nala::kColorDividerStrong},
{kColorTabBackgroundInactiveFrameActive}, 0.75 * 0xff);
mixer[kColorTabDividerFrameInactive] = {kColorTabDividerFrameActive};

if (key.color_mode == ui::ColorProviderKey::ColorMode::kDark) {
mixer[kColorTabBackgroundActiveFrameActive] = {
nala::kColorDesktopbrowserTabbarActiveTabHorizontal};
mixer[kColorTabBackgroundInactiveHoverFrameActive] = {
nala::kColorDesktopbrowserTabbarHoverTabHorizontal};
}
}
28 changes: 13 additions & 15 deletions browser/ui/views/tabs/brave_tab_style_views.inc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,6 @@ SkPath BraveVerticalTabStyle::GetPath(
}
}

const bool is_tab_tiled = IsTabTiled(tab());

if (is_tab_tiled && !tab()->IsActive() &&
(path_type == TabStyle::PathType::kBorder ||
path_type == TabStyle::PathType::kFill)) {
// We don't want inactive tab in a tile to have border or fill.
return SkPath();
}

const bool is_pinned = tab()->data().pinned;

// Calculate the bounds of the actual path.
Expand Down Expand Up @@ -216,7 +207,7 @@ SkPath BraveVerticalTabStyle::GetPath(
}
}

if (is_tab_tiled && path_type != TabStyle::PathType::kHitTest) {
if (IsTabTiled(tab()) && path_type != TabStyle::PathType::kHitTest) {
if (ShouldShowVerticalTabs()) {
constexpr auto kPaddingForVerticalTab = 4;
tab_top += scale * kPaddingForVerticalTab;
Expand Down Expand Up @@ -397,6 +388,18 @@ void BraveVerticalTabStyle::PaintTab(gfx::Canvas* canvas) const {
SkColor BraveVerticalTabStyle::GetTargetTabBackgroundColor(
TabStyle::TabSelectionState selection_state,
bool hovered) const {
const ui::ColorProvider* cp = tab()->GetColorProvider();
if (!cp) {
return gfx::kPlaceholderColor;
}

// Tab in tile doesn't have background in inactive state.
if (IsTabTiled(tab()) && !tab()->IsActive() && !hovered) {
return cp->GetColor(ShouldShowVerticalTabs()
? kColorBraveSplitViewTileBackgroundVertical
: kColorBraveSplitViewTileBackgroundHorizontal);
}

if (!ShouldShowVerticalTabs()) {
return BraveTabStyleViews::GetTargetTabBackgroundColor(selection_state,
hovered);
Expand All @@ -408,11 +411,6 @@ SkColor BraveVerticalTabStyle::GetTargetTabBackgroundColor(
hovered);
}

const ui::ColorProvider* cp = tab()->GetColorProvider();
if (!cp) {
return gfx::kPlaceholderColor;
}

if (selection_state == TabStyle::TabSelectionState::kInactive) {
return cp->GetColor(hovered ? kColorBraveVerticalTabInactiveHoverBackground
: kColorBraveVerticalTabInactiveBackground);
Expand Down

0 comments on commit 63e2244

Please sign in to comment.