Commit 92e3fdd3 authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Mac: Ensure web content system colors use light appearance in Mojave

Bug: 908486
Change-Id: I762b8a74fcb98fb99218cee590da7cf003dec8cf
Reviewed-on: https://chromium-review.googlesource.com/c/1356870Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612732}
parent 69796c60
......@@ -335,6 +335,17 @@ ThemeHelperMac::~ThemeHelperMac() {
void ThemeHelperMac::LoadSystemColors() {
base::span<SkColor> values = writable_color_map_.GetMemoryAsSpan<SkColor>(
blink::kMacSystemColorIDCount);
// Ensure light mode appearance in web content even if the topchrome is in
// dark mode.
// TODO(lgrey): Add a second map for content dark mode for the
// `prefers-color-scheme` media query: https://crbug.com/889087.
NSAppearance* savedAppearance;
if (@available(macOS 10.14, *)) {
savedAppearance = [NSAppearance currentAppearance];
[NSAppearance
setCurrentAppearance:[NSAppearance
appearanceNamed:NSAppearanceNameAqua]];
}
for (size_t i = 0; i < blink::kMacSystemColorIDCount; ++i) {
blink::MacSystemColorID color_id = static_cast<blink::MacSystemColorID>(i);
switch (color_id) {
......@@ -409,6 +420,9 @@ void ThemeHelperMac::LoadSystemColors() {
break;
}
}
if (@available(macOS 10.14, *)) {
[NSAppearance setCurrentAppearance:savedAppearance];
}
}
void ThemeHelperMac::Observe(int type,
......
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