From 9093f4a8f89c173ab99c23470a8bd6a8d0c345d6 Mon Sep 17 00:00:00 2001 From: brave-builds Date: Fri, 5 Aug 2022 19:57:25 +0000 Subject: [PATCH] Uplift of #14489 (squashed) to release --- third_party/blink/renderer/brave_font_whitelist.cc | 3 +++ .../blink/renderer/brave_font_whitelist_unittest.cc | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/third_party/blink/renderer/brave_font_whitelist.cc b/third_party/blink/renderer/brave_font_whitelist.cc index cc2d812ac6a1..2cca21139720 100644 --- a/third_party/blink/renderer/brave_font_whitelist.cc +++ b/third_party/blink/renderer/brave_font_whitelist.cc @@ -19,6 +19,7 @@ bool kCanRestrictFonts = true; // This list covers the fonts installed by default on Mac OS as of Mac OS 12.3. base::flat_set kAllowedFontFamilies = base::MakeFlatSet(std::vector{ + "-apple-system", "academy engraved let", "al bayan", "al nile", @@ -69,6 +70,7 @@ base::flat_set kAllowedFontFamilies = "baskerville", "beirut", "big caslon", + "blinkmacsystemfont", "bodoni 72", "bodoni 72 oldstyle", "bodoni 72 smallcaps", @@ -284,6 +286,7 @@ base::flat_set kAllowedFontFamilies = "sukhumvit set", "superclarendon", "symbol", + "system-ui", "tahoma", "tamil mn", "tamil sangam mn", diff --git a/third_party/blink/renderer/brave_font_whitelist_unittest.cc b/third_party/blink/renderer/brave_font_whitelist_unittest.cc index efb22bb8ea9f..3364afdd4079 100644 --- a/third_party/blink/renderer/brave_font_whitelist_unittest.cc +++ b/third_party/blink/renderer/brave_font_whitelist_unittest.cc @@ -43,7 +43,7 @@ TEST(BraveFontWhitelistTest, Platforms) { #if BUILDFLAG(IS_MAC) EXPECT_EQ(brave::CanRestrictFontFamiliesOnThisPlatform(), true); - EXPECT_EQ(allowed.size(), 282UL); + EXPECT_EQ(allowed.size(), 285UL); #elif BUILDFLAG(IS_WIN) EXPECT_EQ(brave::CanRestrictFontFamiliesOnThisPlatform(), true); EXPECT_EQ(allowed.size(), 312UL); @@ -105,8 +105,11 @@ TEST(BraveFontWhitelistTest, Locales) { } TEST(BraveFontWhitelistTest, KnownFonts) { - const std::array, 7> test_cases = { + const std::array, 10> test_cases = { #if BUILDFLAG(IS_MAC) + std::make_tuple<>("-apple-system", true), + std::make_tuple<>("system-ui", true), + std::make_tuple<>("BlinkMacSystemFont", true), std::make_tuple<>("Arial Unicode MS", true), std::make_tuple<>("Calibri", false), std::make_tuple<>("Gill Sans", true), @@ -115,6 +118,9 @@ TEST(BraveFontWhitelistTest, KnownFonts) { std::make_tuple<>("Menlo", true), std::make_tuple<>("Franklin Gothic Medium", false), #elif BUILDFLAG(IS_WIN) + std::make_tuple<>("-apple-system", false), + std::make_tuple<>("system-ui", false), + std::make_tuple<>("BlinkMacSystemFont", false), std::make_tuple<>("Arial Unicode MS", false), std::make_tuple<>("Calibri", true), std::make_tuple<>("Gill Sans", false), @@ -123,6 +129,9 @@ TEST(BraveFontWhitelistTest, KnownFonts) { std::make_tuple<>("Menlo", false), std::make_tuple<>("Franklin Gothic Medium", true), #else + std::make_tuple<>("-apple-system", false), + std::make_tuple<>("system-ui", false), + std::make_tuple<>("BlinkMacSystemFont", false), std::make_tuple<>("Arial Unicode MS", false), std::make_tuple<>("Calibri", false), std::make_tuple<>("Gill Sans", false),