Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mitigate use of private macOS font API #25117

Merged
merged 1 commit into from Aug 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 38 additions & 0 deletions patches/chromium/mas_no_private_api.patch
Expand Up @@ -420,6 +420,44 @@ index 28ca1646af0b0cce40d27baec71cbe65adc334fa..bae65c1f485bc02eb9ef2ebf7018af4a
}

} // namespace
diff --git a/content/renderer/theme_helper_mac.mm b/content/renderer/theme_helper_mac.mm
index 1db129740992672a4e8be8100da18b6813f1a4f8..5b1e456020ac859c826dbef2826cacf3bb60108b 100644
--- a/content/renderer/theme_helper_mac.mm
+++ b/content/renderer/theme_helper_mac.mm
@@ -7,11 +7,11 @@
#include <Cocoa/Cocoa.h>

#include "base/strings/sys_string_conversions.h"
-
+#if !defined(MAS_BUILD)
extern "C" {
bool CGFontRenderingGetFontSmoothingDisabled(void) API_AVAILABLE(macos(10.14));
}
-
+#endif
namespace content {

void SystemColorsDidChange(int aqua_color_variant,
@@ -59,8 +59,19 @@ void SystemColorsDidChange(int aqua_color_variant,
bool IsSubpixelAntialiasingAvailable() {
if (__builtin_available(macOS 10.14, *)) {
// See https://trac.webkit.org/changeset/239306/webkit for more info.
+#if !defined(MAS_BUILD)
return !CGFontRenderingGetFontSmoothingDisabled();
+#else
+ NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
+ NSString *default_key = @"CGFontRenderingGetFontSmoothingDisabled";
+ // Check that key exists since boolForKey defaults to NO when the
+ // key is missing and this key in fact defaults to YES;
+ if ([defaults objectForKey:default_key] == nil)
+ return false;
+ return ![defaults boolForKey:default_key];
+#endif
}
+
return true;
}

diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
index 933483c36d94336c8e9cc56a53bc86aee01e12d0..a48b4af66fb4edcf74caef5bec68c53be5469fe8 100644
--- a/device/bluetooth/bluetooth_adapter_mac.mm
Expand Down