Commit b578316d authored by Tommy Steimel's avatar Tommy Steimel Committed by Commit Bot

GMC: Fix separator lines on Mac

This CL fixes the separator line color on Mac by removing the
transparency of the MediaNotificationListView. The 12% opacity lines
against the transparent list view was part of the issue. The other part
is crbug.com/1012024, and while this change makes the lines work
properly on Mac, it does not fix crbug.com/1012024.

This change also switches from using a hard-coded SkColor value for
the line to using the MenuSeparatorColor from the NativeTheme.

Bug: 1016717
Change-Id: I60e132e6019722e59bdc0247fc19eedd9ae3d8d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1880570Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Commit-Queue: Tommy Steimel <steimel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709947}
parent ba5c7d6f
......@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/global_media_controls/media_notification_list_view.h"
#include "chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/border.h"
#include "ui/views/controls/scrollbar/overlay_scroll_bar.h"
#include "ui/views/layout/box_layout.h"
......@@ -13,23 +14,19 @@ namespace {
constexpr int kMediaListMaxHeight = 478;
// Color for border between notifications.
constexpr SkColor kMediaListSeparatorColor = SkColorSetA(SK_ColorBLACK, 31);
// Thickness of separator border.
constexpr int kMediaListSeparatorThickness = 2;
std::unique_ptr<views::Border> CreateMediaListSeparatorBorder() {
std::unique_ptr<views::Border> CreateMediaListSeparatorBorder(SkColor color) {
return views::CreateSolidSidedBorder(/*top=*/kMediaListSeparatorThickness,
/*left=*/0,
/*bottom=*/0,
/*right=*/0, kMediaListSeparatorColor);
/*right=*/0, color);
}
} // anonymous namespace
MediaNotificationListView::MediaNotificationListView() {
SetBackgroundColor(SK_ColorTRANSPARENT);
SetContents(std::make_unique<views::View>());
contents()->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical));
......@@ -51,8 +48,11 @@ void MediaNotificationListView::ShowNotification(
// If this isn't the first notification, then create a top-sided separator
// border.
if (!notifications_.empty())
notification->SetBorder(CreateMediaListSeparatorBorder());
if (!notifications_.empty()) {
SkColor separator_color = GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_MenuSeparatorColor);
notification->SetBorder(CreateMediaListSeparatorBorder(separator_color));
}
notifications_[id] = contents()->AddChildView(std::move(notification));
......
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