Bug 1368948: Add patch files for PDFium.
MozReview-Commit-ID: 3IzvRutBopn
new file mode 100644
--- /dev/null
+++ b/widget/third_party/pdfium/patches/bug1368948_gdiplus_prerequisite.patch
@@ -0,0 +1,28 @@
+# HG changeset patch
+# User Bruce Sun <brsun@mozilla.com>
+# Date 1496653534 -28800
+# Mon Jun 05 17:05:34 2017 +0800
+# Node ID c319d318182b1f3dc7e94ebe0187461cceea2838
+# Parent d46c6444b59e71df42b18763b2b9dfdbdef9bcbc
+Bug 1368948: Include objidl.h between windows.h and gdiplus.h.
+
+diff --git a/widget/third_party/pdfium/pdfium/core/fxge/win32/fx_win32_gdipext.cpp b/widget/third_party/pdfium/pdfium/core/fxge/win32/fx_win32_gdipext.cpp
+--- a/widget/third_party/pdfium/pdfium/core/fxge/win32/fx_win32_gdipext.cpp
++++ b/widget/third_party/pdfium/pdfium/core/fxge/win32/fx_win32_gdipext.cpp
+@@ -1,15 +1,16 @@
+ // Copyright 2014 PDFium Authors. All rights reserved.
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+
+ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+ #include <windows.h>
++#include <objidl.h>
+
+ #include <algorithm>
+ #include <memory>
+
+ #include "core/fxcrt/fx_system.h"
+ #include "core/fxge/cfx_gemodule.h"
+ #include "core/fxge/cfx_graphstatedata.h"
+ #include "core/fxge/cfx_pathdata.h"
new file mode 100644
--- /dev/null
+++ b/widget/third_party/pdfium/patches/bug1368948_use_gecko_freetype.patch
@@ -0,0 +1,30 @@
+# HG changeset patch
+# User Bruce Sun <brsun@mozilla.com>
+# Date 1496653546 -28800
+# Mon Jun 05 17:05:46 2017 +0800
+# Node ID 442fe3ec49bf32a5fffe05073fab4cb4ff694af1
+# Parent c319d318182b1f3dc7e94ebe0187461cceea2838
+Bug 1368948: Use existing freetype library within Gecko.
+
+diff --git a/widget/third_party/pdfium/pdfium/core/fxge/freetype/fx_freetype.cpp b/widget/third_party/pdfium/pdfium/core/fxge/freetype/fx_freetype.cpp
+--- a/widget/third_party/pdfium/pdfium/core/fxge/freetype/fx_freetype.cpp
++++ b/widget/third_party/pdfium/pdfium/core/fxge/freetype/fx_freetype.cpp
+@@ -1,17 +1,17 @@
+ // Copyright 2014 PDFium Authors. All rights reserved.
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+
+ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+ #include "core/fxge/fx_freetype.h"
+
+-#include "third_party/freetype/src/psnames/pstables.h"
++#include "psnames/pstables.h"
+
+ static int xyq_search_node(char* glyph_name,
+ int name_offset,
+ int table_offset,
+ wchar_t unicode) {
+ int i, count;
+
+ // copy letters
new file mode 100644
--- /dev/null
+++ b/widget/third_party/pdfium/patches/bug1368948_use_gecko_libjpeg.patch
@@ -0,0 +1,30 @@
+# HG changeset patch
+# User Bruce Sun <brsun@mozilla.com>
+# Date 1496653555 -28800
+# Mon Jun 05 17:05:55 2017 +0800
+# Node ID ef486ed5325c8cf2502b3af173afba8f9dd3b11f
+# Parent 442fe3ec49bf32a5fffe05073fab4cb4ff694af1
+Bug 1368948: Use existing libjpeg library within Gecko.
+
+diff --git a/widget/third_party/pdfium/pdfium/core/fxcodec/codec/fx_codec_jpeg.cpp b/widget/third_party/pdfium/pdfium/core/fxcodec/codec/fx_codec_jpeg.cpp
+--- a/widget/third_party/pdfium/pdfium/core/fxcodec/codec/fx_codec_jpeg.cpp
++++ b/widget/third_party/pdfium/pdfium/core/fxcodec/codec/fx_codec_jpeg.cpp
+@@ -17,17 +17,17 @@
+
+ extern "C" {
+ #undef FAR
+ #if defined(USE_SYSTEM_LIBJPEG)
+ #include <jpeglib.h>
+ #elif defined(USE_LIBJPEG_TURBO)
+ #include "third_party/libjpeg_turbo/jpeglib.h"
+ #else
+-#include "third_party/libjpeg/jpeglib.h"
++#include "jpeglib.h"
+ #endif
+ }
+
+ extern "C" {
+
+ static void JpegScanSOI(const uint8_t** src_buf, uint32_t* src_size) {
+ if (*src_size == 0)
+ return;
new file mode 100644
--- /dev/null
+++ b/widget/third_party/pdfium/patches/bug1368948_use_gecko_zlib.patch
@@ -0,0 +1,30 @@
+# HG changeset patch
+# User Bruce Sun <brsun@mozilla.com>
+# Date 1496653566 -28800
+# Mon Jun 05 17:06:06 2017 +0800
+# Node ID 4b9fb1c60f8d23b60bb1237f6a96f2955802867b
+# Parent ef486ed5325c8cf2502b3af173afba8f9dd3b11f
+Bug 1368948: Use existing zlib library within Gecko.
+
+diff --git a/widget/third_party/pdfium/pdfium/core/fxcodec/codec/fx_codec_flate.cpp b/widget/third_party/pdfium/pdfium/core/fxcodec/codec/fx_codec_flate.cpp
+--- a/widget/third_party/pdfium/pdfium/core/fxcodec/codec/fx_codec_flate.cpp
++++ b/widget/third_party/pdfium/pdfium/core/fxcodec/codec/fx_codec_flate.cpp
+@@ -9,17 +9,17 @@
+ #include <algorithm>
+ #include <memory>
+ #include <utility>
+ #include <vector>
+
+ #include "core/fxcodec/fx_codec.h"
+ #include "core/fxcrt/fx_ext.h"
+ #include "third_party/base/ptr_util.h"
+-#include "third_party/zlib_v128/zlib.h"
++#include "zlib.h"
+
+ extern "C" {
+ static void* my_alloc_func(void* opaque,
+ unsigned int items,
+ unsigned int size) {
+ return FX_Alloc2D(uint8_t, items, size);
+ }
+ static void my_free_func(void* opaque, void* address) {
--- a/widget/third_party/pdfium/update.py
+++ b/widget/third_party/pdfium/update.py
@@ -82,18 +82,26 @@ def cleanup_upstream(base):
shutil.rmtree(os.path.join(upstream_folder, 'third_party/libtiff'))
# Gecko doesn't uses pymock due to no pymock tests
debug_print('Removing pdfium/third_party/pymock')
shutil.rmtree(os.path.join(upstream_folder, 'third_party/pymock'))
def apply_patches(base):
os.chdir(base)
- # Apply patches, ex:
- # os.system("patch -p4 < some.patch")
+
+ # Patch to fix build errors due to lacking GDI+ prerequisite headers
+ os.system("patch -p4 < patches/bug1368948_gdiplus_prerequisite.patch")
+ # Patch to use freetype library within Gecko
+ os.system("patch -p4 < patches/bug1368948_use_gecko_freetype.patch")
+ # Patch to use libjpeg library within Gecko
+ os.system("patch -p4 < patches/bug1368948_use_gecko_libjpeg.patch")
+ # Patch to use zlib library within Gecko
+ os.system("patch -p4 < patches/bug1368948_use_gecko_zlib.patch")
+
return
def update_readme(base, tree, commit, commitdate):
version_prefix = 'The git commit ID last used to import was '
version_regex = version_prefix + '[0-9a-fA-F]+ \(.+\)'
version_string = version_prefix + '%s (%s)' % (commit, commitdate)
os.chdir(base)