Commit 243b8dfe authored by Ana Salazar's avatar Ana Salazar Committed by Commit Bot

Cros: Add focus ring to shelf app button

As we moved from mask layers to highlight paths for ink drops, we
removed the focus ring.
This change re-enables it.

Bug: 1046176
Change-Id: I028fdee9543fac3710243f45227d4f88921425f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2119638Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Ana Salazar <anasalazar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753655}
parent 33a9a395
......@@ -38,6 +38,7 @@
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/painter.h"
#include "ui/views/style/platform_style.h"
namespace {
......@@ -336,6 +337,14 @@ ShelfAppButton::ShelfAppButton(ShelfView* shelf_view,
// Do not set a clip, allow the ink drop to burst out.
views::InstallEmptyHighlightPathGenerator(this);
SetFocusBehavior(FocusBehavior::ALWAYS);
SetInstallFocusRingOnFocus(true);
focus_ring()->SetColor(ShelfConfig::Get()->shelf_focus_border_color());
// The focus ring should have an inset of half the focus border thickness, so
// the parent view won't clip it.
focus_ring()->SetPathGenerator(
std::make_unique<views::RoundRectHighlightPathGenerator>(
gfx::Insets(views::PlatformStyle::kFocusHaloThickness / 2, 0), 0));
}
ShelfAppButton::~ShelfAppButton() {
......@@ -699,6 +708,7 @@ void ShelfAppButton::Layout() {
indicator_->SetBoundsRect(indicator_bounds);
UpdateState();
focus_ring()->Layout();
}
void ShelfAppButton::ChildPreferredSizeChanged(views::View* child) {
......
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