Commit a32930f3 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Update Mac focus ring color to new blue, and darken others

Per the comment in [1], this CL changes the Mac default focus ring
color to #005FCC in the case that the user has not customized the
System Preferences Accent Color setting. When they *have* customized
this setting, this CL also darkens the selected color a bit, from
0.5 alpha to 0.65 alpha.

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=1054813#c22

Bug: 1054813
Change-Id: Icde78801602b49efb93864ef8c942283634b47b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2088296Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747301}
parent 93ce65c8
...@@ -181,7 +181,11 @@ void UpdateFromSystemSettings(blink::mojom::RendererPreferences* prefs, ...@@ -181,7 +181,11 @@ void UpdateFromSystemSettings(blink::mojom::RendererPreferences* prefs,
} }
if (::features::IsFormControlsRefreshEnabled()) { if (::features::IsFormControlsRefreshEnabled()) {
#if defined(OS_MACOSX)
prefs->focus_ring_color = SkColorSetRGB(0xCC, 0x5F, 0x00);
#else
prefs->focus_ring_color = SkColorSetRGB(0x10, 0x10, 0x10); prefs->focus_ring_color = SkColorSetRGB(0x10, 0x10, 0x10);
#endif
} }
} }
......
...@@ -164,6 +164,7 @@ class LayoutThemeMacRefresh final : public LayoutThemeDefault { ...@@ -164,6 +164,7 @@ class LayoutThemeMacRefresh final : public LayoutThemeDefault {
protected: protected:
// Controls color values returned from FocusRingColor(). // Controls color values returned from FocusRingColor().
bool UsesTestModeFocusRingColor() const; bool UsesTestModeFocusRingColor() const;
bool IsAccentColorCustomized(WebColorScheme color_scheme) const;
}; };
// Inflate an IntRect to account for specific padding around margins. // Inflate an IntRect to account for specific padding around margins.
...@@ -322,6 +323,24 @@ Color LayoutThemeMacRefresh::PlatformGrammarMarkerUnderlineColor() const { ...@@ -322,6 +323,24 @@ Color LayoutThemeMacRefresh::PlatformGrammarMarkerUnderlineColor() const {
return Color(107, 107, 107); return Color(107, 107, 107);
} }
bool LayoutThemeMacRefresh::IsAccentColorCustomized(
WebColorScheme color_scheme) const {
if (@available(macOS 10.14, *)) {
static const Color kControlBlueAccentColor =
GetSystemColor(MacSystemColorID::kControlAccentBlueColor, color_scheme);
if (kControlBlueAccentColor ==
GetSystemColor(MacSystemColorID::kControlAccentColor, color_scheme)) {
return false;
}
} else {
if (NSBlueControlTint == [[NSUserDefaults standardUserDefaults]
integerForKey:@"AppleAquaColorVariant"]) {
return false;
}
}
return true;
}
Color LayoutThemeMacRefresh::FocusRingColor() const { Color LayoutThemeMacRefresh::FocusRingColor() const {
static const RGBA32 kDefaultFocusRingColor = 0xFF101010; static const RGBA32 kDefaultFocusRingColor = 0xFF101010;
if (UsesTestModeFocusRingColor()) { if (UsesTestModeFocusRingColor()) {
...@@ -338,26 +357,13 @@ Color LayoutThemeMacRefresh::FocusRingColor() const { ...@@ -338,26 +357,13 @@ Color LayoutThemeMacRefresh::FocusRingColor() const {
// different alpha value to avoid having a color too light. // different alpha value to avoid having a color too light.
Color focus_ring = Color focus_ring =
Color(keyboard_focus_indicator.Red(), keyboard_focus_indicator.Green(), Color(keyboard_focus_indicator.Red(), keyboard_focus_indicator.Green(),
keyboard_focus_indicator.Blue(), /*alpha=*/128); keyboard_focus_indicator.Blue(), /*alpha=*/166);
if (!HasCustomFocusRingColor()) if (!HasCustomFocusRingColor())
return focus_ring; return focus_ring;
// Use the custom focus ring color when the system accent color wasn't // Use the custom focus ring color when the system accent color wasn't
// changed. // changed.
if (@available(macOS 10.14, *)) { if (!IsAccentColorCustomized(color_scheme))
static const Color kControlBlueAccentColor = return GetCustomFocusRingColor();
GetSystemColor(MacSystemColorID::kControlAccentBlueColor, color_scheme);
if (kControlBlueAccentColor ==
GetSystemColor(MacSystemColorID::kControlAccentColor, color_scheme)) {
return GetCustomFocusRingColor();
}
} else {
if (NSBlueControlTint == [[NSUserDefaults standardUserDefaults]
integerForKey:@"AppleAquaColorVariant"]) {
return GetCustomFocusRingColor();
}
}
return focus_ring; return focus_ring;
} }
......
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