Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Unified Diff: ui/views/controls/combobox/combobox.cc

Issue 2964453002: Use style::CONTEXT_TEXTFIELD for Combobox and Textfield (Closed)
Patch Set: Rebase on top of https://codereview.chromium.org/2957263002 Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/cocoa/bridged_native_widget_unittest.mm ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/combobox/combobox.cc
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc
index 615318fe42c1d7e1a549b7f3fbd8387b5a41eb3f..9a1df5b50e7acd702e150d01d3fa012a12317b0c 100644
--- a/ui/views/controls/combobox/combobox.cc
+++ b/ui/views/controls/combobox/combobox.cc
@@ -95,6 +95,12 @@ bool UseMd() {
return ui::MaterialDesignController::IsSecondaryUiMaterial();
}
+SkColor GetTextColorForEnableState(bool enabled, ui::NativeTheme* theme) {
+ return style::GetColor(style::CONTEXT_TEXTFIELD,
+ enabled ? style::STYLE_PRIMARY : style::STYLE_DISABLED,
+ theme);
+}
+
gfx::Rect PositionArrowWithinContainer(const gfx::Rect& container_bounds,
const gfx::Size& arrow_size,
Combobox::Style style) {
@@ -815,12 +821,7 @@ void Combobox::PaintText(gfx::Canvas* canvas) {
int x = insets.left();
int y = insets.top();
int text_height = height() - insets.height();
- SkColor text_color = GetNativeTheme()->GetSystemColor(
- UseMd() ? (enabled() ? ui::NativeTheme::kColorId_TextfieldDefaultColor
- : ui::NativeTheme::kColorId_TextfieldReadOnlyColor)
- : (enabled() ? ui::NativeTheme::kColorId_LabelEnabledColor
- : ui::NativeTheme::kColorId_LabelDisabledColor));
-
+ SkColor text_color = GetTextColorForEnableState(enabled(), GetNativeTheme());
DCHECK_GE(selected_index_, 0);
DCHECK_LT(selected_index_, model()->GetItemCount());
if (selected_index_ < 0 || selected_index_ > model()->GetItemCount())
@@ -863,8 +864,7 @@ void Combobox::PaintText(gfx::Canvas* canvas) {
path.rLineTo(height, -height);
path.close();
cc::PaintFlags flags;
- SkColor arrow_color = GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_ButtonEnabledColor);
+ SkColor arrow_color = GetTextColorForEnableState(true, GetNativeTheme());
if (!enabled())
arrow_color = SkColorSetA(arrow_color, gfx::kDisabledControlAlpha);
flags.setColor(arrow_color);
« no previous file with comments | « ui/views/cocoa/bridged_native_widget_unittest.mm ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698