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

Update whitelist with Apple system pseudo-fonts (uplift to 1.43.x) #14499

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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