Skip to content

Commit

Permalink
Add missing context check in ChromeTypographyProvider::GetColor()
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhong committed Dec 19, 2019
1 parent 9f3d3d4 commit bd8506b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
32 changes: 13 additions & 19 deletions chromium_src/chrome/browser/ui/views/chrome_typography_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
// Comes after the above includes.
#include "chrome/browser/ui/views/chrome_typography_provider.h"

namespace {
const SkColor kBraveGrey800 = SkColorSetRGB(0x3b, 0x3e, 0x4f);
}

#define ChromeTypographyProvider ChromeTypographyProvider_ChromiumImpl
#include "../../../../../../chrome/browser/ui/views/chrome_typography_provider.cc"
#undef ChromeTypographyProvider
Expand All @@ -23,21 +19,19 @@ SkColor ChromeTypographyProvider::GetColor(const views::View& view,
// Harmony check duplicated from ChromiumImpl
const ui::NativeTheme* native_theme = view.GetNativeTheme();
DCHECK(native_theme);
if (ShouldIgnoreHarmonySpec(*native_theme)) {
return GetHarmonyTextColorForNonStandardNativeTheme(context, style,
*native_theme);
}
// Override button text colors
if (context == views::style::CONTEXT_BUTTON_MD) {
switch (style) {
case views::style::STYLE_DIALOG_BUTTON_DEFAULT:
return SK_ColorWHITE;
case views::style::STYLE_DISABLED:
// Keep chromium style for this state.
break;
default:
return native_theme->ShouldUseDarkColors() ? SK_ColorWHITE
: kBraveGrey800;
if (!ShouldIgnoreHarmonySpec(*native_theme)) {
// Override button text colors
if (context == views::style::CONTEXT_BUTTON_MD) {
switch (style) {
case views::style::STYLE_DIALOG_BUTTON_DEFAULT:
return SK_ColorWHITE;
case views::style::STYLE_DISABLED:
// Keep chromium style for this state.
break;
default:
return native_theme->ShouldUseDarkColors() ? SK_ColorWHITE
: gfx::kBraveGrey800;
}
}
}
return ChromeTypographyProvider_ChromiumImpl::GetColor(view, context, style);
Expand Down
1 change: 1 addition & 0 deletions chromium_src/ui/gfx/color_palette.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace gfx {

constexpr SkColor kBraveGrey700 = SkColorSetRGB(0x4A, 0x4A, 0x4A);
constexpr SkColor kBraveGrey800 = SkColorSetRGB(0x3b, 0x3e, 0x4f);
constexpr SkColor kBraveNeutral300 = SkColorSetRGB(0xDE, 0xE2, 0xE6);
constexpr SkColor kBraveNeutral800 = SkColorSetRGB(0x34, 0x3A, 0x40);

Expand Down

0 comments on commit bd8506b

Please sign in to comment.