Commit bfdee0db authored by Danton Vu's avatar Danton Vu Committed by Commit Bot

wm: update window cycle selecter to match overview

The overview selector is newer, so the window cycle selector should be
updated to match it. Instead of using LayerFillBackgroundPainter, we'll
opt to use setters for the layers more directly like with overview.

R=afakhry@chromium.org, sammiequon@chromium.org

Bug: 974050
Test: manual

Change-Id: I86721cdb8a75daaabac2337a5b27ebc6b53102c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1670288Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Commit-Queue: Danton Vu <dantonvu@google.com>
Cr-Commit-Position: refs/heads/master@{#671879}
parent ee7090f8
...@@ -43,9 +43,15 @@ namespace { ...@@ -43,9 +43,15 @@ namespace {
bool g_disable_initial_delay = false; bool g_disable_initial_delay = false;
// Used for the highlight view and the shield (black background). // The color of the window cycle highlight.
constexpr SkColor kHighlightColor = SkColorSetARGB(36, 255, 255, 255);
// Used for the shield (black background).
constexpr float kBackgroundCornerRadius = 4.f; constexpr float kBackgroundCornerRadius = 4.f;
// Corner radius applied to the alt-tab selector border.
constexpr gfx::RoundedCornersF kWindowSelectionCornerRadii{2};
// Horizontal spacing between the icon and label views. // Horizontal spacing between the icon and label views.
constexpr int kIconLabelSpacingDp = 12; constexpr int kIconLabelSpacingDp = 12;
...@@ -68,26 +74,6 @@ constexpr int kFixedPreviewHeightDp = 256; ...@@ -68,26 +74,6 @@ constexpr int kFixedPreviewHeightDp = 256;
constexpr int kMinPreviewWidthDp = kFixedPreviewHeightDp / 2; constexpr int kMinPreviewWidthDp = kFixedPreviewHeightDp / 2;
constexpr int kMaxPreviewWidthDp = kFixedPreviewHeightDp * 2; constexpr int kMaxPreviewWidthDp = kFixedPreviewHeightDp * 2;
// This background paints a |Painter| but fills the view's layer's size rather
// than the view's size.
class LayerFillBackgroundPainter : public views::Background {
public:
explicit LayerFillBackgroundPainter(std::unique_ptr<views::Painter> painter)
: painter_(std::move(painter)) {}
~LayerFillBackgroundPainter() override = default;
void Paint(gfx::Canvas* canvas, views::View* view) const override {
views::Painter::PaintPainterAt(canvas, painter_.get(),
gfx::Rect(view->layer()->size()));
}
private:
std::unique_ptr<views::Painter> painter_;
DISALLOW_COPY_AND_ASSIGN(LayerFillBackgroundPainter);
};
} // namespace } // namespace
// This view represents a single aura::Window by displaying a title and a // This view represents a single aura::Window by displaying a title and a
...@@ -285,15 +271,10 @@ class WindowCycleView : public views::WidgetDelegateView { ...@@ -285,15 +271,10 @@ class WindowCycleView : public views::WidgetDelegateView {
mirror_container_->AddChildView(view); mirror_container_->AddChildView(view);
} }
// The background needs to be painted to fill the layer, not the View, highlight_view_->SetPaintToLayer(ui::LAYER_SOLID_COLOR);
// because the layer animates bounds changes but the View's bounds change highlight_view_->layer()->SetRoundedCornerRadius(
// immediately. kWindowSelectionCornerRadii);
highlight_view_->SetBackground(std::make_unique<LayerFillBackgroundPainter>( highlight_view_->layer()->SetColor(kHighlightColor);
views::Painter::CreateRoundRectWith1PxBorderPainter(
SkColorSetA(SK_ColorWHITE, 0x4D), SkColorSetA(SK_ColorWHITE, 0x33),
kBackgroundCornerRadius)));
highlight_view_->SetPaintToLayer();
highlight_view_->layer()->SetFillsBoundsOpaquely(false); highlight_view_->layer()->SetFillsBoundsOpaquely(false);
AddChildView(highlight_view_); AddChildView(highlight_view_);
......
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