-
Notifications
You must be signed in to change notification settings - Fork 15.1k
/
put_back_deleted_colors_for_autofill.patch
139 lines (131 loc) · 7.35 KB
/
put_back_deleted_colors_for_autofill.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <jkleinsc@github.com>
Date: Thu, 20 Jun 2019 16:49:25 -0400
Subject: put_back_deleted_colors_for_autofill.patch
https://chromium-review.googlesource.com/c/chromium/src/+/1652925 removed colors as they are no longer
needed in chromium but our autofill implementation uses them. This patch can be removed if we refactor
our autofill implementation to work like Chromium's.
diff --git a/ui/gtk/native_theme_gtk.cc b/ui/gtk/native_theme_gtk.cc
index a77c5718649d8703a1c8423f6a6e2cf196720526..cb4fdb40a7ec0eada94ac53aba22e8bba06d4c05 100644
--- a/ui/gtk/native_theme_gtk.cc
+++ b/ui/gtk/native_theme_gtk.cc
@@ -355,6 +355,29 @@ base::Optional<SkColor> SkColorFromColorId(
case ui::NativeTheme::kColorId_TableHeaderSeparator:
return GetBorderColor("GtkTreeView#treeview.view GtkButton#button");
+ // Results Table
+ case ui::NativeTheme::kColorId_ResultsTableNormalBackground:
+ return SkColorFromColorId(
+ ui::NativeTheme::kColorId_TextfieldDefaultBackground, base_theme, color_scheme);
+ case ui::NativeTheme::kColorId_ResultsTableHoveredBackground: {
+ auto default_background = SkColorFromColorId(
+ ui::NativeTheme::kColorId_TextfieldDefaultBackground, base_theme, color_scheme);
+ auto selection_background = SkColorFromColorId(
+ ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused, base_theme, color_scheme);
+ if (!default_background || !selection_background) return base::nullopt;
+ return color_utils::AlphaBlend(default_background.value(), selection_background.value(), 0.5f);
+ }
+ case ui::NativeTheme::kColorId_ResultsTableNormalText:
+ return SkColorFromColorId(
+ ui::NativeTheme::kColorId_TextfieldDefaultColor, base_theme, color_scheme);
+ case ui::NativeTheme::kColorId_ResultsTableDimmedText: {
+ auto default_textfield_color = SkColorFromColorId(ui::NativeTheme::kColorId_TextfieldDefaultColor, base_theme, color_scheme);
+ auto default_textfield_background = SkColorFromColorId(
+ ui::NativeTheme::kColorId_TextfieldDefaultBackground, base_theme, color_scheme);
+ if (!default_textfield_color || !default_textfield_background) return base::nullopt;
+ return color_utils::AlphaBlend(default_textfield_color.value(), default_textfield_background.value(), 0.5f);
+ }
+
// Throbber
// TODO(thomasanderson): Render GtkSpinner directly.
case ui::NativeTheme::kColorId_ThrobberSpinningColor:
diff --git a/ui/native_theme/common_theme.cc b/ui/native_theme/common_theme.cc
index 35301a2fd7fc53c940bcda47f85527f17af64248..c78bdfb3643f8a310e0ee4c788af4f09fe876d7e 100644
--- a/ui/native_theme/common_theme.cc
+++ b/ui/native_theme/common_theme.cc
@@ -63,7 +63,8 @@ base::Optional<SkColor> GetHighContrastColor(
}
}
-base::Optional<SkColor> GetDarkSchemeColor(NativeTheme::ColorId color_id) {
+base::Optional<SkColor> GetDarkSchemeColor(const NativeTheme* base_theme,
+ NativeTheme::ColorId color_id) {
switch (color_id) {
// Dialogs
case NativeTheme::kColorId_WindowBackground:
@@ -79,6 +80,14 @@ base::Optional<SkColor> GetDarkSchemeColor(NativeTheme::ColorId color_id) {
case NativeTheme::kColorId_BubbleFooterBackground:
return SkColorSetRGB(0x32, 0x36, 0x39);
+ // Results Tables
+ case NativeTheme::kColorId_ResultsTableNormalBackground:
+ return SkColorSetRGB(0x28, 0x28, 0x28);
+ case NativeTheme::kColorId_ResultsTableNormalText:
+ return SK_ColorWHITE;
+ case NativeTheme::kColorId_ResultsTableDimmedText:
+ return SkColorSetA(base_theme->GetSystemColor(NativeTheme::kColorId_ResultsTableNormalText), 0x80);
+
// FocusableBorder
case NativeTheme::kColorId_FocusedBorderColor:
return SkColorSetA(gfx::kGoogleBlue300, 0x4D);
@@ -572,6 +581,18 @@ SkColor GetDefaultColor(NativeTheme::ColorId color_id,
case NativeTheme::kColorId_UnfocusedBorderColor:
return gfx::kGoogleGrey300;
+ // Results Tables
+ case NativeTheme::kColorId_ResultsTableNormalBackground:
+ return SK_ColorWHITE;
+ case NativeTheme::kColorId_ResultsTableHoveredBackground:
+ return SkColorSetA(base_theme->GetSystemColor(
+ NativeTheme::kColorId_ResultsTableNormalText),
+ 0x0D);
+ case NativeTheme::kColorId_ResultsTableNormalText:
+ return SK_ColorBLACK;
+ case NativeTheme::kColorId_ResultsTableDimmedText:
+ return SkColorSetRGB(0x64, 0x64, 0x64);
+
// Material spinner/throbber
case NativeTheme::kColorId_ThrobberSpinningColor:
return gfx::kGoogleBlue600;
@@ -675,7 +696,7 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id,
}
if (color_scheme == NativeTheme::ColorScheme::kDark) {
- base::Optional<SkColor> color = GetDarkSchemeColor(color_id);
+ base::Optional<SkColor> color = GetDarkSchemeColor(base_theme, color_id);
if (color.has_value())
return color.value();
}
diff --git a/ui/native_theme/native_theme_color_id.h b/ui/native_theme/native_theme_color_id.h
index dde0f977c676b6914f206ca7022290887257622b..67fe14f482dcbdf884711e3b283f9d6107a6cfe6 100644
--- a/ui/native_theme/native_theme_color_id.h
+++ b/ui/native_theme/native_theme_color_id.h
@@ -146,6 +146,11 @@
OP(kColorId_TableHeaderText), \
OP(kColorId_TableHeaderBackground), \
OP(kColorId_TableHeaderSeparator), \
+ /* Results Tables, such as the omnibox */ \
+ OP(kColorId_ResultsTableNormalBackground), \
+ OP(kColorId_ResultsTableHoveredBackground), \
+ OP(kColorId_ResultsTableNormalText), \
+ OP(kColorId_ResultsTableDimmedText), \
/* Colors for the material spinner (aka throbber). */ \
OP(kColorId_ThrobberSpinningColor), \
OP(kColorId_ThrobberWaitingColor), \
diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc
index 28acb663886b4f192ed188770deaa0f5095aca0f..fd075a6f8a1357e7456a97d37af339848635a102 100644
--- a/ui/native_theme/native_theme_win.cc
+++ b/ui/native_theme/native_theme_win.cc
@@ -648,6 +648,18 @@ base::Optional<SkColor> NativeThemeWin::GetPlatformHighContrastColor(
case kColorId_ThrobberWaitingColor:
return system_colors_[SystemThemeColor::kGrayText];
+ // Results Tables
+ case kColorId_ResultsTableNormalBackground:
+ return system_colors_[SystemThemeColor::kWindow];
+ case kColorId_ResultsTableHoveredBackground:
+ return color_utils::AlphaBlend(system_colors_[SystemThemeColor::kWindowText],
+ system_colors_[SystemThemeColor::kWindow], 0.25f);
+ case kColorId_ResultsTableNormalText:
+ return system_colors_[SystemThemeColor::kWindowText];
+ case kColorId_ResultsTableDimmedText:
+ return color_utils::AlphaBlend(system_colors_[SystemThemeColor::kWindowText],
+ system_colors_[SystemThemeColor::kWindow], 0.5f);
+
// Button Background
case kColorId_ButtonColor:
case kColorId_MenuBackgroundColor: