Commit 27ac53b9 authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

In the non-newer material mode, made the close (X) white for the hovered and pressed states.

Bug: 838523
Change-Id: Ifbe36e9b0a6b1ffad61da0f977ba7660d18f4e55
Reviewed-on: https://chromium-review.googlesource.com/1037904
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555395}
parent f57536a4
......@@ -45,17 +45,21 @@ TabCloseButton::~TabCloseButton() {}
void TabCloseButton::SetTabColor(SkColor color, bool tab_color_is_dark) {
SkColor hover_color = SkColorSetRGB(0xDB, 0x44, 0x37);
SkColor pressed_color = SkColorSetRGB(0xA8, 0x35, 0x2A);
SkColor icon_color = SK_ColorWHITE;
if (MD::GetMode() == MD::MATERIAL_REFRESH) {
hover_color = tab_color_is_dark ? gfx::kGoogleGrey700 : gfx::kGoogleGrey200;
pressed_color =
tab_color_is_dark ? gfx::kGoogleGrey600 : gfx::kGoogleGrey300;
icon_color = color;
}
GenerateImages(false, color, hover_color, pressed_color);
GenerateImages(false, color, icon_color, hover_color, pressed_color);
}
void TabCloseButton::ActiveStateChanged(const Tab* parent_tab) {
SkColor icon_color =
parent_tab->GetCloseTabButtonColor(views::Button::STATE_NORMAL);
GenerateImages(
true, parent_tab->GetCloseTabButtonColor(views::Button::STATE_NORMAL),
true, icon_color, icon_color,
parent_tab->GetCloseTabButtonColor(views::Button::STATE_HOVERED),
parent_tab->GetCloseTabButtonColor(views::Button::STATE_PRESSED));
}
......@@ -134,26 +138,32 @@ bool TabCloseButton::GetHitTestMask(gfx::Path* mask) const {
}
void TabCloseButton::GenerateImages(bool is_touch,
SkColor normal_color,
SkColor hover_color,
SkColor pressed_color) {
SkColor normal_icon_color,
SkColor hover_pressed_icon_color,
SkColor hover_highlight_color,
SkColor pressed_highlight_color) {
const gfx::VectorIcon& button_icon =
is_touch ? kTabCloseButtonTouchIcon : kTabCloseNormalIcon;
const gfx::VectorIcon& highlight = is_touch
? kTabCloseButtonTouchHighlightIcon
: kTabCloseButtonHighlightIcon;
const gfx::ImageSkia& normal =
gfx::CreateVectorIcon(button_icon, normal_color);
gfx::CreateVectorIcon(button_icon, normal_icon_color);
const gfx::ImageSkia& hover_pressed =
normal_icon_color != hover_pressed_icon_color
? gfx::CreateVectorIcon(button_icon, hover_pressed_icon_color)
: normal;
const gfx::ImageSkia& hover_highlight =
gfx::CreateVectorIcon(highlight, hover_color);
gfx::CreateVectorIcon(highlight, hover_pressed_icon_color);
const gfx::ImageSkia& pressed_highlight =
gfx::CreateVectorIcon(highlight, pressed_color);
gfx::CreateVectorIcon(highlight, pressed_highlight_color);
const gfx::ImageSkia& hover =
gfx::ImageSkiaOperations::CreateSuperimposedImage(hover_highlight,
normal);
hover_pressed);
const gfx::ImageSkia& pressed =
gfx::ImageSkiaOperations::CreateSuperimposedImage(pressed_highlight,
normal);
hover_pressed);
SetImage(views::Button::STATE_NORMAL, normal);
SetImage(views::Button::STATE_HOVERED, hover);
SetImage(views::Button::STATE_PRESSED, pressed);
......
......@@ -32,10 +32,12 @@ class TabCloseButton : public views::ImageButton,
// This function must be called before the tab is painted so it knows what
// color to use. It must also be called when the background color of the tab
// changes (this class does not track tab activation state), and when the
// theme changes.
// theme changes. |tab_color_is_dark| will be true if the tab is a dark
// color. This will NOT be called when in newer material ui mode.
void SetTabColor(SkColor color, bool tab_color_is_dark);
// This is called whenever the |parent_tab| changes its active state.
// This is called whenever the |parent_tab| changes its active state. This
// is only called when in newer material ui mode.
void ActiveStateChanged(const Tab* parent_tab);
// views::View:
......@@ -52,9 +54,10 @@ class TabCloseButton : public views::ImageButton,
bool GetHitTestMask(gfx::Path* mask) const override;
void GenerateImages(bool is_touch,
SkColor normal_color,
SkColor hover_color,
SkColor pressed_color);
SkColor normal_icon_color,
SkColor hover_pressed_icon_color,
SkColor hover_highlight_color,
SkColor pressed_highlight_color);
MouseEventCallback mouse_event_callback_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment