Skip to content

Commit

Permalink
Uplift of #14489 (squashed) to release
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-browser-releases committed Aug 5, 2022
1 parent 35c9806 commit 9093f4a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions third_party/blink/renderer/brave_font_whitelist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<base::StringPiece> kAllowedFontFamilies =
base::MakeFlatSet<base::StringPiece>(std::vector<base::StringPiece>{
"-apple-system",
"academy engraved let",
"al bayan",
"al nile",
Expand Down Expand Up @@ -69,6 +70,7 @@ base::flat_set<base::StringPiece> kAllowedFontFamilies =
"baskerville",
"beirut",
"big caslon",
"blinkmacsystemfont",
"bodoni 72",
"bodoni 72 oldstyle",
"bodoni 72 smallcaps",
Expand Down Expand Up @@ -284,6 +286,7 @@ base::flat_set<base::StringPiece> kAllowedFontFamilies =
"sukhumvit set",
"superclarendon",
"symbol",
"system-ui",
"tahoma",
"tamil mn",
"tamil sangam mn",
Expand Down
13 changes: 11 additions & 2 deletions third_party/blink/renderer/brave_font_whitelist_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -105,8 +105,11 @@ TEST(BraveFontWhitelistTest, Locales) {
}

TEST(BraveFontWhitelistTest, KnownFonts) {
const std::array<std::tuple<AtomicString, bool>, 7> test_cases = {
const std::array<std::tuple<AtomicString, bool>, 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),
Expand All @@ -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),
Expand All @@ -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),
Expand Down

0 comments on commit 9093f4a

Please sign in to comment.