Commit 5e12b718 authored by Wei Li's avatar Wei Li Committed by Commit Bot

[color] Use themed color for bookmark menu arrow

The default color used by bookmark menu expanding arrows is black. On
Windows, the color is retrieved from system text color. However, none of
those responds well to different themes. Change to get the color from
native theme.

BUG=1059867

Change-Id: Id7c998a4d82bf6812ac9461139fbf72065c9bf03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2146174
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758530}
parent fa0dd99a
......@@ -43,9 +43,6 @@ struct VIEWS_EXPORT MenuConfig {
// Font list used by menus.
gfx::FontList font_list;
// Color for the arrow to scroll bookmarks.
SkColor arrow_color = SK_ColorBLACK;
// Menu border sizes. The vertical border size does not apply to menus with
// rounded corners - those menus always use the corner radius as the vertical
// border size.
......
......@@ -20,7 +20,6 @@ using ui::NativeTheme;
namespace views {
void MenuConfig::Init() {
arrow_color = color_utils::GetSysSkColor(COLOR_MENUTEXT);
font_list =
gfx::FontList(gfx::win::GetSystemFont(gfx::win::SystemFont::kMenu));
......
......@@ -22,6 +22,7 @@
#include "ui/views/controls/menu/submenu_view.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/round_rect_painter.h"
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"
using ui::NativeTheme;
......@@ -51,6 +52,12 @@ class MenuScrollButton : public View {
pref_height_);
}
void OnThemeChanged() override {
View::OnThemeChanged();
arrow_color_ = GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor);
}
bool CanDrop(const OSExchangeData& data) override {
DCHECK(host_->GetMenuItem()->GetMenuController());
return true; // Always return true so that drop events are targeted to us.
......@@ -108,7 +115,7 @@ class MenuScrollButton : public View {
cc::PaintFlags flags;
flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setAntiAlias(true);
flags.setColor(config.arrow_color);
flags.setColor(arrow_color_);
canvas->DrawPath(path, flags);
}
......@@ -122,6 +129,9 @@ class MenuScrollButton : public View {
// Preferred height.
int pref_height_;
// Color for the arrow to scroll.
SkColor arrow_color_;
DISALLOW_COPY_AND_ASSIGN(MenuScrollButton);
};
......
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