Skip to content

Commit

Permalink
Combine diverged color values
Browse files Browse the repository at this point in the history
There are unreachable case state that it returns when it meets
first switch-case.
So we need to delete and combine them for unreachable case.

Bug: 1020475
Change-Id: I014190e3b7373d86da08912eacdc509d3ccc2cbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1894667
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712024}
  • Loading branch information
codeimpl authored and Commit Bot committed Nov 3, 2019
1 parent 9b1692a commit f0679eb
Showing 1 changed file with 14 additions and 39 deletions.
53 changes: 14 additions & 39 deletions ui/native_theme/common_theme.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,40 +166,7 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id,
}
}

// Second wave of MD colors (colors that only appear in secondary UI).
constexpr SkColor kPrimaryTextColor = gfx::kGoogleGrey900;

switch (color_id) {
// Labels
case NativeTheme::kColorId_LabelEnabledColor:
return kPrimaryTextColor;
case NativeTheme::kColorId_LabelDisabledColor:
return SkColorSetA(
base_theme->GetSystemColor(NativeTheme::kColorId_LabelEnabledColor,
color_scheme),
gfx::kDisabledControlAlpha);

// FocusableBorder
case NativeTheme::kColorId_UnfocusedBorderColor:
return SkColorSetA(SK_ColorBLACK, 0x4e);

// Textfields
case NativeTheme::kColorId_TextfieldDefaultColor:
return kPrimaryTextColor;
case NativeTheme::kColorId_TextfieldDefaultBackground:
return base_theme->GetSystemColor(NativeTheme::kColorId_DialogBackground,
color_scheme);
case NativeTheme::kColorId_TextfieldReadOnlyColor:
return SkColorSetA(
base_theme->GetSystemColor(
NativeTheme::kColorId_TextfieldDefaultColor, color_scheme),
gfx::kDisabledControlAlpha);

default:
break;
}

// Shared constant for disabled text.
constexpr SkColor kDisabledTextColor = gfx::kGoogleGrey600;

// Buttons:
Expand Down Expand Up @@ -269,10 +236,12 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id,

// Label
case NativeTheme::kColorId_LabelEnabledColor:
return kButtonEnabledColor;
return kPrimaryTextColor;
case NativeTheme::kColorId_LabelDisabledColor:
return base_theme->GetSystemColor(
NativeTheme::kColorId_ButtonDisabledColor, color_scheme);
return SkColorSetA(
base_theme->GetSystemColor(NativeTheme::kColorId_LabelEnabledColor,
color_scheme),
gfx::kDisabledControlAlpha);
case NativeTheme::kColorId_LabelTextSelectionColor:
return kTextSelectionColor;
case NativeTheme::kColorId_LabelTextSelectionBackgroundFocused:
Expand Down Expand Up @@ -301,12 +270,18 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id,

// Textfield
case NativeTheme::kColorId_TextfieldDefaultColor:
return SK_ColorBLACK;
return kPrimaryTextColor;
case NativeTheme::kColorId_TextfieldDefaultBackground:
return base_theme->GetSystemColor(NativeTheme::kColorId_DialogBackground,
color_scheme);
case NativeTheme::kColorId_TextfieldReadOnlyBackground:
return SK_ColorWHITE;
case NativeTheme::kColorId_TextfieldReadOnlyColor:
return kDisabledTextColor;
return SkColorSetA(
base_theme->GetSystemColor(
NativeTheme::kColorId_TextfieldDefaultColor, color_scheme),
gfx::kDisabledControlAlpha);

case NativeTheme::kColorId_TextfieldSelectionColor:
return kTextSelectionColor;
case NativeTheme::kColorId_TextfieldSelectionBackgroundFocused:
Expand Down Expand Up @@ -357,7 +332,7 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id,
case NativeTheme::kColorId_FocusedBorderColor:
return SkColorSetA(gfx::kGoogleBlue500, 0x66);
case NativeTheme::kColorId_UnfocusedBorderColor:
return SkColorSetA(SK_ColorBLACK, 0x66);
return SkColorSetA(SK_ColorBLACK, 0x4e);

// Material spinner/throbber
case NativeTheme::kColorId_ThrobberSpinningColor:
Expand Down

0 comments on commit f0679eb

Please sign in to comment.