Commit c1d8e4bd authored by Jan Krcal's avatar Jan Krcal Committed by Commit Bot

[Toolbar button] Make the outline thicker if no text is displayed

This CL makes the outline of highlighted ToolbarButton thicker and thus
more visible if the highlight has no text. Highlight with no text is
at the moment only used by the AvatarToolbarButton in state
kHighlightAnimation. Without this change, that animation felt too
subtle.

Bug: 1008340
Change-Id: I64b4c3464957c34fc362fc350fb47595fa24285c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1831801
Auto-Submit: Jan Krcal <jkrcal@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703353}
parent d95c3033
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
namespace { namespace {
constexpr int kBorderThicknessDp = 1; constexpr int kBorderThicknessDpWithLabel = 1;
constexpr int kBorderThicknessDpWithoutLabel = 2;
SkColor GetDefaultTextColor(const ui::ThemeProvider* theme_provider) { SkColor GetDefaultTextColor(const ui::ThemeProvider* theme_provider) {
DCHECK(theme_provider); DCHECK(theme_provider);
...@@ -159,12 +160,15 @@ void ToolbarButton::UpdateColorsAndInsets() { ...@@ -159,12 +160,15 @@ void ToolbarButton::UpdateColorsAndInsets() {
if (!border() || new_insets != border()->GetInsets() || if (!border() || new_insets != border()->GetInsets() ||
last_border_color_ != border_color) { last_border_color_ != border_color) {
if (border_color) { if (border_color) {
int border_thickness_dp = GetText().empty()
? kBorderThicknessDpWithoutLabel
: kBorderThicknessDpWithLabel;
// Create a border with insets equal to |new_insets|, just split into a // Create a border with insets equal to |new_insets|, just split into a
// solid border and padding. // solid border and padding.
SetBorder(views::CreatePaddedBorder( SetBorder(views::CreatePaddedBorder(
views::CreateRoundedRectBorder(kBorderThicknessDp, highlight_radius, views::CreateRoundedRectBorder(border_thickness_dp, highlight_radius,
*border_color), *border_color),
new_insets - gfx::Insets(kBorderThicknessDp))); new_insets - gfx::Insets(border_thickness_dp)));
} else { } else {
SetBorder(views::CreateEmptyBorder(new_insets)); SetBorder(views::CreateEmptyBorder(new_insets));
} }
......
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