Commit dcdcda7f authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Simplify MenuItemView Styling

BUG=865318

Change-Id: I03ebbfdc95622f986e6271dbede4d1bfa740c5eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1788198
Commit-Queue: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694844}
parent 8adf605a
......@@ -217,14 +217,19 @@ SkColor ChromeTypographyProvider::GetColor(const views::View& view,
}
}
if (context == views::style::CONTEXT_MENU &&
style == views::style::STYLE_DISABLED &&
native_theme->ShouldUseDarkColors()) {
return gfx::kGoogleGrey600;
}
switch (style) {
case views::style::STYLE_DIALOG_BUTTON_DEFAULT:
return SK_ColorWHITE;
case views::style::STYLE_DISABLED:
if (!native_theme->ShouldUseDarkColors())
return SkColorSetRGB(0x9e, 0x9e, 0x9e);
return context == views::style::CONTEXT_MENU ? gfx::kGoogleGrey600
: gfx::kGoogleGrey800;
return native_theme->ShouldUseDarkColors()
? gfx::kGoogleGrey800
: SkColorSetRGB(0x9e, 0x9e, 0x9e);
case views::style::STYLE_LINK:
return gfx::kGoogleBlue700;
case views::style::STYLE_SECONDARY:
......
......@@ -1132,26 +1132,20 @@ void MenuItemView::PaintMinorIconAndText(
}
SkColor MenuItemView::GetTextColor(bool minor, bool render_selection) const {
style::TextContext context = style::CONTEXT_MENU;
style::TextStyle text_style =
minor ? text_style = style::STYLE_SECONDARY : style::STYLE_PRIMARY;
style::TextContext context =
GetMenuController() && GetMenuController()->use_touchable_layout()
? style::CONTEXT_TOUCH_MENU
: style::CONTEXT_MENU;
if (GetEnabled()) {
if (render_selection)
text_style = style::STYLE_SELECTED;
} else {
text_style = style::STYLE_DISABLED;
}
if (GetMenuController() && GetMenuController()->use_touchable_layout()) {
context = style::CONTEXT_TOUCH_MENU;
text_style = style::STYLE_PRIMARY;
}
if (type_ == HIGHLIGHTED) {
context = style::CONTEXT_MENU;
style::TextStyle text_style = style::STYLE_PRIMARY;
if (type_ == HIGHLIGHTED)
text_style = style::STYLE_HIGHLIGHTED;
}
else if (!GetEnabled())
text_style = style::STYLE_DISABLED;
else if (render_selection)
text_style = style::STYLE_SELECTED;
else if (minor)
text_style = style::STYLE_SECONDARY;
return style::GetColor(*this, context, text_style);
}
......
......@@ -120,7 +120,10 @@ SkColor TypographyProvider::GetColor(const views::View& view,
break;
}
} else if (context == style::CONTEXT_TOUCH_MENU) {
color_id = ui::NativeTheme::kColorId_TouchableMenuItemLabelColor;
color_id =
style == views::style::STYLE_HIGHLIGHTED
? ui::NativeTheme::kColorId_HighlightedMenuItemForegroundColor
: ui::NativeTheme::kColorId_TouchableMenuItemLabelColor;
} else if (style == style::STYLE_DISABLED) {
color_id = ui::NativeTheme::kColorId_LabelDisabledColor;
}
......
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