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 352bc3d9fb59ea46829ff02f779b3372efadf8db..70a49a4b473bc03e92625c57383dc9fddd85de42 100644
--- a/ui/gtk/native_theme_gtk.cc
+++ b/ui/gtk/native_theme_gtk.cc
@@ -351,6 +351,27 @@ 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:
+      return color_utils::AlphaBlend(
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldDefaultBackground, base_theme, color_scheme).value(),
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused, base_theme, color_scheme).value(),
+          0.5f);
+    case ui::NativeTheme::kColorId_ResultsTableNormalText:
+      return SkColorFromColorId(
+          ui::NativeTheme::kColorId_TextfieldDefaultColor, base_theme, color_scheme);
+    case ui::NativeTheme::kColorId_ResultsTableDimmedText:
+      return color_utils::AlphaBlend(
+          SkColorFromColorId(ui::NativeTheme::kColorId_TextfieldDefaultColor, base_theme, color_scheme).value(),
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldDefaultBackground, base_theme, color_scheme).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 aac3821e6d977a8f80e4ded5b5944b43a7f200b1..83b3f97113244108c8648f21b646ef7262f282b5 100644
--- a/ui/native_theme/common_theme.cc
+++ b/ui/native_theme/common_theme.cc
@@ -43,7 +43,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:
@@ -57,6 +58,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);
@@ -487,6 +496,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;
@@ -549,7 +570,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.h b/ui/native_theme/native_theme.h
index 8c60a3f7ba7cd3caec127028422be32024ff586b..22278bde2d532da4f8f26e102c73b0edab424135 100644
--- a/ui/native_theme/native_theme.h
+++ b/ui/native_theme/native_theme.h
@@ -339,6 +339,11 @@ class NATIVE_THEME_EXPORT NativeTheme {
 #define OP(enum_name) enum_name
     NATIVE_THEME_COLOR_IDS,
 #undef OP
+    // Results Tables, such as the omnibox
+    kColorId_ResultsTableNormalBackground,
+    kColorId_ResultsTableHoveredBackground,
+    kColorId_ResultsTableNormalText,
+    kColorId_ResultsTableDimmedText,
 
     kColorId_NumColors,
   };
diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc
index 272b70d7c993c10a45f81c4fe639cf3c203e6d14..99494b370bf45e6587d82c040f85a5ffce46a219 100644
--- a/ui/native_theme/native_theme_win.cc
+++ b/ui/native_theme/native_theme_win.cc
@@ -641,6 +641,18 @@ SkColor NativeThemeWin::GetPlatformHighContrastColor(ColorId color_id) const {
     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_MenuBackgroundColor:
     case kColorId_HighlightedMenuItemBackgroundColor:
