Skia: Enable fallback code in CFX_GlyphCache::GetDeviceCache() for macOS

Call SkFontMgr_New_Custom_Empty() as a fallback, just like on Windows.
This fixes garbled text issues that only happen on macOS with CoreText.

Bug: pdfium:2086
Change-Id: I1eb218282265d3b2afd08ccb415c797a4199c54c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/112990
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
diff --git a/DEPS b/DEPS
index f63f684..fa523f4 100644
--- a/DEPS
+++ b/DEPS
@@ -166,7 +166,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling pdfium_tests
   # and whatever else without interference from each other.
-  'pdfium_tests_revision': 'dd9f115e29abcaba175e157f2afab8473fea0048',
+  'pdfium_tests_revision': 'e5b2404351705d43a2cc811db4bd482b9aedd6f7',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling resultdb
   # and whatever else without interference from each other.
diff --git a/core/fxge/cfx_glyphcache.cpp b/core/fxge/cfx_glyphcache.cpp
index ba308d4..f075bef 100644
--- a/core/fxge/cfx_glyphcache.cpp
+++ b/core/fxge/cfx_glyphcache.cpp
@@ -31,7 +31,7 @@
 #include "third_party/skia/include/core/SkStream.h"  // nogncheck
 #include "third_party/skia/include/core/SkTypeface.h"  // nogncheck
 
-#if BUILDFLAG(IS_WIN)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE)
 #include "third_party/skia/include/core/SkFontMgr.h"  // nogncheck
 #include "third_party/skia/include/ports/SkFontMgr_empty.h"  // nogncheck
 #endif
@@ -339,14 +339,14 @@
     m_pTypeface = SkTypeface::MakeFromStream(
         std::make_unique<SkMemoryStream>(span.data(), span.size()));
   }
-#if BUILDFLAG(IS_WIN)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE)
   if (!m_pTypeface) {
     sk_sp<SkFontMgr> customMgr(SkFontMgr_New_Custom_Empty());
     pdfium::span<const uint8_t> span = pFont->GetFontSpan();
     m_pTypeface = customMgr->makeFromStream(
         std::make_unique<SkMemoryStream>(span.data(), span.size()));
   }
-#endif  // BUILDFLAG(IS_WIN)
+#endif  // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE)
   return m_pTypeface.get();
 }
 #endif  // defined(_SKIA_SUPPORT_)
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 2f469b1..28c98ff 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -596,24 +596,6 @@
 xfermodes2.pdf * * * gdi
 xfermodes3.pdf * * * gdi
 
-# TODO(pdfium:2086): Remove this group after associated bug is fixed
-FRC_3.5_AuthEvent_EFOpen.pdf mac * * skia
-FRC_3.5_CFM_AESV2__EncryptMetadata_F.pdf mac * * skia
-FRC_3.5_CF_EFF_StdCF_Strf_Stmf_Identity.pdf mac * * skia
-FRC_3.5_CF_Strf_stmf_StdCF.pdf mac * * skia
-FRC_3.5_EncryptMetadata_None.pdf mac * * skia
-FRC_3.5_V_4_CFM_V2_.pdf mac * * skia
-FRC_3.5_V_5_CFM_AESV3.pdf mac * * skia
-FRC_3.5_v_1_length_40_Filter_standard.pdf mac * * skia
-FRC_3.5_v_2_length_128_AuthEvent_DocOpen_.pdf mac * * skia
-FRC_8.5_Bl_Hide.pdf mac * * skia
-FRC_8.5_Fo_URI_Base.pdf mac * * skia
-FRC_8.5_U_GoToR_NewWindow.pdf mac * * skia
-FRC_8.5_U_GoToR_NewWindow_2.pdf mac * * skia
-bookmarkgetcolor.pdf mac * * skia
-5.5_simple_font.pdf mac * * skia
-en_diy.pdf mac * * skia
-
 #
 # JavaScript tests
 #
@@ -692,12 +674,6 @@
 # TODO(chromium:725555, skia:9265): Remove after associated bug is fixed
 bug_725555.in * * * skia
 
-# TODO(pdfium:2086): Remove after associated bug is fixed
-bug_736703.in mac * * skia
-
-# TODO(pdfium:2086): Remove after associated bug is fixed
-bug_846.in mac * * skia
-
 # TODO(chromium:983289): Remove after associated bug is fixed
 bug_983289.in * * * agg
 
diff --git a/testing/resources/pixel/bug_846_expected_skia_mac.pdf.0.png b/testing/resources/pixel/bug_846_expected_skia_mac.pdf.0.png
new file mode 100644
index 0000000..04d8093
--- /dev/null
+++ b/testing/resources/pixel/bug_846_expected_skia_mac.pdf.0.png
Binary files differ