Commit 8c81e162 authored by flackr's avatar flackr Committed by Commit bot

Draw a 2pt white stroke around selection rectangle in overview.

This draws a light stroke around the selection rectangle so that it will be
visible on dark or solid black backgrounds. Additionally the border painting
code was fixed to not draw the corners twice, which with a transparent draw
color was visible as more opaque borders in the corners.

BUG=294860
TEST=visual, enter overview mode (F5) and press arrow key to show selection.

Review URL: https://codereview.chromium.org/1105563003

Cr-Commit-Position: refs/heads/master@{#326812}
parent c8d41cd2
......@@ -27,6 +27,7 @@
#include "ui/gfx/animation/tween.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
#include "ui/wm/core/window_animations.h"
......@@ -92,8 +93,9 @@ const int kMinCardsMajor = 3;
const int kOverviewSelectorTransitionMilliseconds = 100;
// The color and opacity of the overview selector.
const SkColor kWindowOverviewSelectionColor = SK_ColorBLACK;
const unsigned char kWindowOverviewSelectorOpacity = 128;
const SkColor kWindowSelectionColor = SkColorSetARGB(128, 0, 0, 0);
const SkColor kWindowSelectionBorderColor = SkColorSetARGB(38, 255, 255, 255);
const int kWindowSelectionBorderThickness = 2;
// The minimum amount of spacing between the bottom of the text filtering
// text field and the top of the selection widget on the first row of items.
......@@ -368,7 +370,9 @@ void WindowGrid::InitSelectionWidget(WindowSelector::Direction direction) {
views::View* content_view = new views::View;
content_view->set_background(
views::Background::CreateSolidBackground(kWindowOverviewSelectionColor));
views::Background::CreateSolidBackground(kWindowSelectionColor));
content_view->SetBorder(views::Border::CreateSolidBorder(
kWindowSelectionBorderThickness, kWindowSelectionBorderColor));
selection_widget_->SetContentsView(content_view);
selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom(
selection_widget_->GetNativeWindow());
......@@ -438,11 +442,11 @@ void WindowGrid::MoveSelectionWidgetToTarget(bool animate) {
animation_settings.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
selection_widget_->SetBounds(SelectedWindow()->target_bounds());
selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity);
selection_widget_->SetOpacity(255);
return;
}
selection_widget_->SetBounds(SelectedWindow()->target_bounds());
selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity);
selection_widget_->SetOpacity(255);
}
} // namespace ash
......@@ -44,13 +44,15 @@ void SidedSolidBorder::Paint(const View& view, gfx::Canvas* canvas) {
// Top border.
canvas->FillRect(gfx::Rect(0, 0, view.width(), insets_.top()), color_);
// Left border.
canvas->FillRect(gfx::Rect(0, 0, insets_.left(), view.height()), color_);
canvas->FillRect(gfx::Rect(0, insets_.top(), insets_.left(),
view.height() - insets_.height()), color_);
// Bottom border.
canvas->FillRect(gfx::Rect(0, view.height() - insets_.bottom(), view.width(),
insets_.bottom()), color_);
// Right border.
canvas->FillRect(gfx::Rect(view.width() - insets_.right(), 0, insets_.right(),
view.height()), color_);
canvas->FillRect(gfx::Rect(view.width() - insets_.right(), insets_.top(),
insets_.right(), view.height() - insets_.height()),
color_);
}
gfx::Insets SidedSolidBorder::GetInsets() const {
......
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