Bug 1367948 - Part2. Prevent PDFium from using GDIPlusExt to avoid garbage rendering. r=jwatt
authorFarmer Tseng <fatseng@mozilla.com>
Thu, 27 Jul 2017 11:22:45 +0800
changeset 419955 6abd15012dcd2e345ba694ae5480e223502e59b7
parent 419954 ac08e5a6a6cfc51dfc62fcecb1703d69af2d2241
child 419956 b936f241e649d6873c827aad7abf082fdfa91043
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1367948
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1367948 - Part2. Prevent PDFium from using GDIPlusExt to avoid garbage rendering. r=jwatt MozReview-Commit-ID: 8hE0q6jKFzj
modules/pdfium/pdfium/core/fxge/win32/fx_win32_device.cpp
--- a/modules/pdfium/pdfium/core/fxge/win32/fx_win32_device.cpp
+++ b/modules/pdfium/pdfium/core/fxge/win32/fx_win32_device.cpp
@@ -75,16 +75,23 @@ bool GetSubFontName(CFX_ByteString* name
       *name = g_JpFontNameMap[i].m_pSubFontName;
       return true;
     }
   }
   return false;
 }
 
 bool IsGDIEnabled() {
+  // In Chromium, PDFium runs in sandboxed process which can't get the screen
+  // DC. Therefore, we |return false| here to avoid using the GDIPlusExt class
+  // within PDFium in order to take the same code paths as Chromium.
+  // This avoids an issue where PDFium can render some garbage to EMF
+  // (see bug 1367948).
+  return false;
+
   // If GDI is disabled then GetDC for the desktop will fail.
   HDC hdc = ::GetDC(nullptr);
   if (!hdc)
     return false;
   ::ReleaseDC(nullptr, hdc);
   return true;
 }