Commit e8093b62 authored by Tim Song's avatar Tim Song Committed by Commit Bot

Ash Tray: Clean up rounded corners in message center.

For legacy reasons, there are many places that are manually drawing rounded
corners in the message center, which can all be replaced by the fast rounded
corner implementation in the bubble widget.

Change-Id: Ife0d8f3fc74a059129cae1cd85c5bbea5ee8a2bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1992016Reviewed-by: default avatarAhmed Mehfooz <amehfooz@chromium.org>
Commit-Queue: Tim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729989}
parent 01872a02
......@@ -98,22 +98,6 @@ class StackingBarLabelButton : public views::LabelButton {
TrayPopupInkDropStyle::FILL_BOUNDS, this, background_color_);
}
std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override {
SkScalar top_radius = SkIntToScalar(kUnifiedTrayCornerRadius);
SkRect bounds = gfx::RectToSkRect(GetContentsBounds());
SkPath path;
if (base::i18n::IsRTL()) {
SkScalar radii[8] = {top_radius, top_radius, 0, 0, 0, 0, 0, 0};
path.addRoundRect(bounds, radii);
} else {
SkScalar radii[8] = {0, 0, top_radius, top_radius, 0, 0, 0, 0};
path.addRoundRect(bounds, radii);
}
return std::make_unique<views::PathInkDropMask>(size(), path);
}
private:
SkColor background_color_ = gfx::kPlaceholderColor;
UnifiedMessageCenterView* message_center_view_;
......@@ -483,14 +467,8 @@ void StackedNotificationBar::OnPaint(gfx::Canvas* canvas) {
flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setAntiAlias(true);
SkPath background_path;
SkScalar top_radius = SkIntToScalar(kUnifiedTrayCornerRadius);
SkScalar radii[8] = {top_radius, top_radius, top_radius, top_radius,
0, 0, 0, 0};
gfx::Rect bounds = GetLocalBounds();
background_path.addRoundRect(gfx::RectToSkRect(bounds), radii);
canvas->DrawPath(background_path, flags);
canvas->DrawRect(bounds, flags);
// We draw a border here than use a views::Border so the ink drop highlight
// of the clear all button overlays the border.
......
......@@ -75,7 +75,6 @@ UnifiedMessageCenterBubble::UnifiedMessageCenterBubble(UnifiedSystemTray* tray)
init_params.anchor_mode = TrayBubbleView::AnchorMode::kRect;
init_params.min_width = kTrayMenuWidth;
init_params.max_width = kTrayMenuWidth;
init_params.corner_radius = kUnifiedTrayCornerRadius;
init_params.has_shadow = false;
init_params.close_on_deactivate = false;
......
......@@ -52,32 +52,6 @@ bool CompareNotifications(message_center::Notification* n1,
} // namespace
// The background of the UnifiedMessageListView, which has a strait top and a
// rounded bottom.
class UnifiedMessageListView::Background : public views::Background {
public:
Background() = default;
~Background() override = default;
// views::Background:
void Paint(gfx::Canvas* canvas, View* view) const override {
gfx::Rect bounds = view->GetLocalBounds();
SkPath background_path;
SkScalar radius = SkIntToScalar(kUnifiedTrayCornerRadius);
SkScalar radii[8] = {0, 0, 0, 0, radius, radius, radius, radius};
background_path.addRoundRect(gfx::RectToSkRect(bounds), radii);
cc::PaintFlags flags;
flags.setColor(message_center_style::kSwipeControlBackgroundColor);
flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setAntiAlias(true);
canvas->DrawPath(background_path, flags);
}
private:
DISALLOW_COPY_AND_ASSIGN(Background);
};
// Container view of notification and swipe control.
// All children of UnifiedMessageListView should be MessageViewContainer.
class UnifiedMessageListView::MessageViewContainer
......@@ -235,8 +209,8 @@ UnifiedMessageListView::UnifiedMessageListView(
animation_(std::make_unique<gfx::LinearAnimation>(this)) {
MessageCenter::Get()->AddObserver(this);
animation_->SetCurrentValue(1.0);
SetBackground(std::unique_ptr<views::Background>(
new UnifiedMessageListView::Background()));
SetBackground(views::CreateSolidBackground(
message_center_style::kSwipeControlBackgroundColor));
}
UnifiedMessageListView::~UnifiedMessageListView() {
......
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