Commit 3ec768b2 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Adapt app list item focus bounds to account for ring stroke width

The app list item focus ring is painted using stroke width 2, within
bounds specified by AppListConfig::grid_focus_size().
This fixes discrepancy between what app list config specifies and what
actually gets painted using stroke width 2:
*   the bounds were painted so the stroke was centered on the focus
    ring bounds
*   app list config specifies the outer focus ring bounds

For kMedium and kSmall app list config (where the top focus ring bounds
match the app list item bounds), this caused the top focus ring to be
painted using width 1 instead of required 2 (as the upper part of the
ring stroke was clipped by the app list item bounds).

This updates the focus ring bounds calculation in AppListItemView to
account for the stroke size - the target focus ring bounds are inset by
half the ring width.

BUG=1014128

Change-Id: Ib605afdc4312214a2a6d6c7c46251dd6fbe46000
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1859578
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705732}
parent 672eebc3
......@@ -959,6 +959,11 @@ void AppListItemView::CreateDraggedViewHoverAnimation() {
void AppListItemView::AdaptBoundsForSelectionHighlight(gfx::Rect* bounds) {
bounds->Inset(0, 0, 0, GetAppListConfig().grid_icon_bottom_padding());
bounds->ClampToCenteredSize(GetAppListConfig().grid_focus_size());
// Update the bounds to account for the focus ring width - by default, the
// focus ring is painted so the highlight bounds are centered within the
// focus ring stroke - this should be overridden so the outer stroke bounds
// match the grid focus size set in the app list config.
bounds->Inset(gfx::Insets(kFocusRingWidth / 2));
}
} // namespace ash
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