Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2170)

Unified Diff: ash/common/wm/window_cycle_list.cc

Issue 2580013004: Give Alt+Tab shield rounded corners when it's narrower than the screen. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/window_cycle_list.cc
diff --git a/ash/common/wm/window_cycle_list.cc b/ash/common/wm/window_cycle_list.cc
index 9a14336e6c1fafb9c4456b55f2c1cccd1b6693f8..31bb1530c22f3fc75eefe1f5f87968a3478f3a10 100644
--- a/ash/common/wm/window_cycle_list.cc
+++ b/ash/common/wm/window_cycle_list.cc
@@ -35,6 +35,9 @@ namespace {
bool g_disable_initial_delay = false;
+// Used for the highlight view and the shield (black background).
+constexpr float kBackgroundCornerRadius = 4.f;
+
// Returns the window immediately below |window| in the current container.
WmWindow* GetWindowBelow(WmWindow* window) {
WmWindow* parent = window->GetParent();
@@ -280,14 +283,13 @@ class WindowCycleView : public views::WidgetDelegateView {
mirror_container_->AddChildView(view);
}
- const float kHighlightCornerRadius = 4;
// The background needs to be painted to fill the layer, not the View,
// because the layer animates bounds changes but the View's bounds change
// immediately.
highlight_view_->set_background(new LayerFillBackgroundPainter(
base::WrapUnique(views::Painter::CreateRoundRectWith1PxBorderPainter(
SkColorSetA(SK_ColorWHITE, 0x4D), SkColorSetA(SK_ColorWHITE, 0x33),
- kHighlightCornerRadius))));
+ kBackgroundCornerRadius))));
highlight_view_->SetPaintToLayer(true);
highlight_view_->layer()->SetFillsBoundsOpaquely(false);
@@ -395,8 +397,16 @@ class WindowCycleView : public views::WidgetDelegateView {
void OnPaintBackground(gfx::Canvas* canvas) override {
// We can't set a bg on the mirror container itself because the highlight
// view needs to be on top of the bg but behind the target windows.
- canvas->FillRect(mirror_container_->bounds(),
- SkColorSetA(SK_ColorBLACK, 0xE6));
+ const gfx::RectF shield_bounds(mirror_container_->bounds());
+ SkPaint paint;
+ paint.setColor(SkColorSetA(SK_ColorBLACK, 0xE6));
+ paint.setStyle(SkPaint::kFill_Style);
+ float corner_radius = 0.f;
+ if (shield_bounds.width() < width()) {
+ paint.setAntiAlias(true);
+ corner_radius = kBackgroundCornerRadius;
+ }
+ canvas->DrawRoundRect(shield_bounds, corner_radius, paint);
}
View* GetInitiallyFocusedView() override {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698