Commit 46a10c19 authored by varkha's avatar varkha Committed by Commit bot

[ash-md] Updates slider control to show thumb highlight when focused

Makes the thumb highlighted when the slider control is focused helping
when controlling volume or brightness with a keyboard.

BUG=658783

Review-Url: https://codereview.chromium.org/2619953002
Cr-Commit-Position: refs/heads/master@{#442816}
parent 06d4b710
......@@ -270,8 +270,6 @@ views::ToggleButton* TrayPopupUtils::CreateToggleButton(
(kTrayToggleButtonWidth - toggle_size.width()) / 2;
toggle->SetBorder(views::CreateEmptyBorder(
gfx::Insets(vertical_padding, horizontal_padding)));
// TODO(varkha): remove this and implement toggle-button specific focus. See
// crbug.com/669124
toggle->SetFocusPainter(CreateFocusPainter());
toggle->SetAccessibleName(l10n_util::GetStringUTF16(accessible_name_id));
return toggle;
......
......@@ -73,12 +73,14 @@ void MdSlider::OnPaint(gfx::Canvas* canvas) {
gfx::Point thumb_center(x, content.height() / 2);
// Paint the thumb highlight if it exists.
if (is_active_ && thumb_highlight_radius_ > kThumbRadius) {
const int thumb_highlight_radius =
HasFocus() ? kThumbHighlightRadius : thumb_highlight_radius_;
if (is_active_ && thumb_highlight_radius > kThumbRadius) {
SkPaint highlight;
SkColor kHighlightColor = SkColorSetA(kActiveColor, kHighlightColorAlpha);
highlight.setColor(kHighlightColor);
highlight.setFlags(SkPaint::kAntiAlias_Flag);
canvas->DrawCircle(thumb_center, thumb_highlight_radius_, highlight);
canvas->DrawCircle(thumb_center, thumb_highlight_radius, highlight);
}
// Paint the thumb of the slider.
......
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