Commit abd59b7f authored by David Black's avatar David Black Committed by Chromium LUCI CQ

Polish holding space item view focus/selection.

Problems addressed:
- Selection ring was too small
- Focus ring was too tight around view
- Focus ring had wrong corner radius

Before: http://shortn/_cqPPbTDIUI
After: http://shortn/_Bvt34oqzIC

Bug: 1147182, 1163739
Change-Id: I1e70ad9ffa00d0e57e32ea1f77ba5201ef79a8b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2623707Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#842639}
parent 191960b6
......@@ -21,7 +21,8 @@ constexpr int kHoldingSpaceContextMenuMargin = 8;
constexpr int kHoldingSpaceCornerRadius = 8;
constexpr int kHoldingSpaceDownloadsChevronIconSize = 20;
constexpr int kHoldingSpaceDownloadsHeaderSpacing = 16;
constexpr int kHoldingSpaceFocusInsets = -2;
constexpr int kHoldingSpaceFocusCornerRadius = 12;
constexpr int kHoldingSpaceFocusInsets = -4;
constexpr int kHoldingSpaceIconSize = 20;
constexpr gfx::Insets kHoldingSpaceScreenCapturePadding(8);
constexpr gfx::Size kHoldingSpaceScreenCapturePinButtonSize(24, 24);
......
......@@ -170,15 +170,17 @@ bool HoldingSpaceItemView::HandleAccessibleAction(
}
void HoldingSpaceItemView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
// Inset `bounds` to account for stroke.
gfx::Rect bounds = GetLocalBounds();
bounds.Inset(-gfx::Insets(views::PlatformStyle::kFocusHaloThickness / 2));
// Selection ring.
selected_layer_owner_->layer()->SetBounds(bounds);
InvalidateLayer(selected_layer_owner_->layer());
// The focus ring is painted just outside the bounds for this view.
const float kFocusInsets = kHoldingSpaceFocusInsets -
(views::PlatformStyle::kFocusHaloThickness / 2.f);
bounds.Inset(gfx::Insets(kFocusInsets));
// Focus ring.
// NOTE: The focus ring is painted just outside the bounds for this view.
bounds.Inset(gfx::Insets(kHoldingSpaceFocusInsets));
focused_layer_owner_->layer()->SetBounds(bounds);
InvalidateLayer(focused_layer_owner_->layer());
}
......@@ -297,7 +299,7 @@ void HoldingSpaceItemView::OnPaintFocus(gfx::Canvas* canvas, gfx::Size size) {
gfx::Rect bounds = gfx::Rect(size);
bounds.Inset(gfx::Insets(flags.getStrokeWidth() / 2));
canvas->DrawRoundRect(bounds, kHoldingSpaceCornerRadius, flags);
canvas->DrawRoundRect(bounds, kHoldingSpaceFocusCornerRadius, flags);
}
void HoldingSpaceItemView::OnPaintSelect(gfx::Canvas* canvas, gfx::Size size) {
......
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