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; ...@@ -21,7 +21,8 @@ constexpr int kHoldingSpaceContextMenuMargin = 8;
constexpr int kHoldingSpaceCornerRadius = 8; constexpr int kHoldingSpaceCornerRadius = 8;
constexpr int kHoldingSpaceDownloadsChevronIconSize = 20; constexpr int kHoldingSpaceDownloadsChevronIconSize = 20;
constexpr int kHoldingSpaceDownloadsHeaderSpacing = 16; constexpr int kHoldingSpaceDownloadsHeaderSpacing = 16;
constexpr int kHoldingSpaceFocusInsets = -2; constexpr int kHoldingSpaceFocusCornerRadius = 12;
constexpr int kHoldingSpaceFocusInsets = -4;
constexpr int kHoldingSpaceIconSize = 20; constexpr int kHoldingSpaceIconSize = 20;
constexpr gfx::Insets kHoldingSpaceScreenCapturePadding(8); constexpr gfx::Insets kHoldingSpaceScreenCapturePadding(8);
constexpr gfx::Size kHoldingSpaceScreenCapturePinButtonSize(24, 24); constexpr gfx::Size kHoldingSpaceScreenCapturePinButtonSize(24, 24);
......
...@@ -170,15 +170,17 @@ bool HoldingSpaceItemView::HandleAccessibleAction( ...@@ -170,15 +170,17 @@ bool HoldingSpaceItemView::HandleAccessibleAction(
} }
void HoldingSpaceItemView::OnBoundsChanged(const gfx::Rect& previous_bounds) { void HoldingSpaceItemView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
// Inset `bounds` to account for stroke.
gfx::Rect bounds = GetLocalBounds(); gfx::Rect bounds = GetLocalBounds();
bounds.Inset(-gfx::Insets(views::PlatformStyle::kFocusHaloThickness / 2));
// Selection ring.
selected_layer_owner_->layer()->SetBounds(bounds); selected_layer_owner_->layer()->SetBounds(bounds);
InvalidateLayer(selected_layer_owner_->layer()); InvalidateLayer(selected_layer_owner_->layer());
// The focus ring is painted just outside the bounds for this view. // Focus ring.
const float kFocusInsets = kHoldingSpaceFocusInsets - // NOTE: The focus ring is painted just outside the bounds for this view.
(views::PlatformStyle::kFocusHaloThickness / 2.f); bounds.Inset(gfx::Insets(kHoldingSpaceFocusInsets));
bounds.Inset(gfx::Insets(kFocusInsets));
focused_layer_owner_->layer()->SetBounds(bounds); focused_layer_owner_->layer()->SetBounds(bounds);
InvalidateLayer(focused_layer_owner_->layer()); InvalidateLayer(focused_layer_owner_->layer());
} }
...@@ -297,7 +299,7 @@ void HoldingSpaceItemView::OnPaintFocus(gfx::Canvas* canvas, gfx::Size size) { ...@@ -297,7 +299,7 @@ void HoldingSpaceItemView::OnPaintFocus(gfx::Canvas* canvas, gfx::Size size) {
gfx::Rect bounds = gfx::Rect(size); gfx::Rect bounds = gfx::Rect(size);
bounds.Inset(gfx::Insets(flags.getStrokeWidth() / 2)); 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) { 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