Commit 1935a9b5 authored by Sam Sebree's avatar Sam Sebree Committed by Chromium LUCI CQ

[Controls Refresh] Bug fix for Datalist uses wrong colors for HC black

and HC white

This CL fixes an issue in which, when in ForcedColors mode, the data
list control uses an the default color scheme

Bug: 1157185
Change-Id: I5103d371fe69226be4ee495f237dd23c874f23f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2623150Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Sam Sebree <sasebree@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#842778}
parent 0a24d9e3
......@@ -24,7 +24,6 @@
#include "ui/accessibility/platform/ax_platform_node.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/color_palette.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/border.h"
#include "ui/views/bubble/bubble_border.h"
......@@ -39,23 +38,37 @@ int AutofillPopupBaseView::GetCornerRadius() {
}
SkColor AutofillPopupBaseView::GetBackgroundColor() {
return GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_DropdownBackgroundColor);
return GetHighContrastAwareColor(
ui::NativeTheme::kColorId_DropdownBackgroundColor,
ui::NativeTheme::SystemThemeColor::kButtonFace);
}
SkColor AutofillPopupBaseView::GetForegroundColor() {
return GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_DropdownForegroundColor);
return GetHighContrastAwareColor(
ui::NativeTheme::kColorId_DropdownForegroundColor,
ui::NativeTheme::SystemThemeColor::kButtonText);
}
SkColor AutofillPopupBaseView::GetSelectedBackgroundColor() {
return GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_DropdownSelectedBackgroundColor);
return GetHighContrastAwareColor(
ui::NativeTheme::kColorId_DropdownSelectedBackgroundColor,
ui::NativeTheme::SystemThemeColor::kButtonText);
}
SkColor AutofillPopupBaseView::GetSelectedForegroundColor() {
return GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_DropdownSelectedForegroundColor);
return GetHighContrastAwareColor(
ui::NativeTheme::kColorId_DropdownSelectedForegroundColor,
ui::NativeTheme::SystemThemeColor::kButtonFace);
}
SkColor AutofillPopupBaseView::GetHighContrastAwareColor(
ui::NativeTheme::ColorId non_hc_color,
ui::NativeTheme::SystemThemeColor hc_color) {
if (ui::NativeTheme::GetInstanceForWeb()->UserHasContrastPreference()) {
return *GetNativeTheme()->GetSystemThemeColor(hc_color);
} else {
return GetNativeTheme()->GetSystemColor(non_hc_color);
}
}
SkColor AutofillPopupBaseView::GetFooterBackgroundColor() {
......
......@@ -12,6 +12,7 @@
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/focus/widget_focus_manager.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
......@@ -48,6 +49,8 @@ class AutofillPopupBaseView : public views::WidgetDelegateView,
SkColor GetForegroundColor();
SkColor GetSelectedBackgroundColor();
SkColor GetSelectedForegroundColor();
SkColor GetHighContrastAwareColor(ui::NativeTheme::ColorId non_hc_color,
ui::NativeTheme::SystemThemeColor hc_color);
SkColor GetFooterBackgroundColor();
SkColor GetSeparatorColor();
SkColor GetWarningColor();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment