Turn on chromium_code (except -Wsign-compare, for now) for pdfium
[pdfium.git] / BUILD.gn
index f38c1be..fa6c906 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -3,29 +3,25 @@
 # found in the LICENSE file.
 
 import("//testing/test.gni")
-
-pdf_use_skia = false
-
-declare_args() {
-  # On Android there's no system FreeType. On Windows and Mac, only a few
-  # methods are used from it.
-  pdfium_bundle_freetype = !is_linux
-}
+import("pdfium.gni")
 
 config("pdfium_config") {
   cflags = []
   include_dirs = [ "third_party/freetype/include" ]
   defines = [
-    "_FPDFSDK_LIB",
-    "_NO_GDIPLUS_",  # workaround text rendering issues on Windows
     "OPJ_STATIC",
     "V8_DEPRECATION_WARNINGS",
+    "_CRT_SECURE_NO_WARNINGS",
   ]
 
   if (pdf_use_skia) {
     defines += [ "_SKIA_SUPPORT_" ]
   }
 
+  if (pdf_enable_v8) {
+    defines += [ "PDF_ENABLE_V8" ]
+  }
+
   if (is_linux) {
     if (current_cpu == "x64") {
       defines += [ "_FX_CPU_=_FX_X64_" ]
@@ -44,6 +40,11 @@ config("pdfium_config") {
       "/wd4345",
     ]
   }
+
+  if (is_clang) {
+    # TODO(thestig): Fix all instances, remove this, pdfium:29
+    cflags += [ "-Wno-sign-compare" ]
+  }
 }
 
 static_library("pdfium") {
@@ -65,7 +66,6 @@ static_library("pdfium") {
     "fpdfsdk/src/fpdfformfill.cpp",
     "fpdfsdk/src/fpdfppo.cpp",
     "fpdfsdk/src/fpdfsave.cpp",
-    "fpdfsdk/src/fpdfsdkdll.rc",
     "fpdfsdk/src/fpdftext.cpp",
     "fpdfsdk/src/fpdfview.cpp",
     "fpdfsdk/src/fsdk_actionhandler.cpp",
@@ -74,7 +74,6 @@ static_library("pdfium") {
     "fpdfsdk/src/fsdk_baseform.cpp",
     "fpdfsdk/src/fsdk_mgr.cpp",
     "fpdfsdk/src/fsdk_rendercontext.cpp",
-    "fpdfsdk/src/resource.h",
     "public/fpdf_dataavail.h",
     "public/fpdf_doc.h",
     "public/fpdf_edit.h",
@@ -93,11 +92,7 @@ static_library("pdfium") {
   ]
 
   libs = []
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 
   deps = [
     "third_party:bigint",
@@ -112,7 +107,6 @@ static_library("pdfium") {
     ":fxedit",
     ":fxge",
     ":javascript",
-    ":jsapi",
     ":pdfwindow",
   ]
 
@@ -132,12 +126,41 @@ static_library("pdfium") {
   }
 
   if (pdfium_bundle_freetype) {
-    deps += [ "third_party:freetype" ]
+    deps += [ "third_party:fx_freetype" ]
   } else {
     libs += [ "freetype" ]
   }
 }
 
+source_set("test_support") {
+  testonly = true
+  sources = [
+    "testing/fx_string_testhelpers.cpp",
+    "testing/fx_string_testhelpers.h",
+    "testing/test_support.cpp",
+    "testing/test_support.h",
+  ]
+  deps = [
+    "//testing/gmock",
+    "//testing/gtest",
+    ":pdfium",
+  ]
+  include_dirs = [
+    "."
+  ]
+  if (pdf_enable_v8) {
+    deps += [
+      "//v8",
+      "//v8:v8_libplatform",
+    ]
+    include_dirs += [
+      "//v8",
+      "//v8/include",
+    ]
+  }
+  configs += [ ":pdfium_config" ]
+}
+
 # Targets below this are only visible within this file (and to the
 # top-level gn_visibility target used to help gn_all build everything).
 visibility = [
@@ -152,11 +175,7 @@ static_library("fdrm") {
     "core/src/fdrm/crypto/fx_crypt_aes.cpp",
     "core/src/fdrm/crypto/fx_crypt_sha.cpp",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("fpdfdoc") {
@@ -185,11 +204,7 @@ static_library("fpdfdoc") {
     "core/src/fpdfdoc/pdf_vt.h",
     "core/src/fpdfdoc/tagged_int.h",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("fpdfapi") {
@@ -251,8 +266,6 @@ static_library("fpdfapi") {
     "core/src/fpdfapi/fpdf_cmaps/Japan1/UniJIS-UCS2-HW-V_4.cpp",
     "core/src/fpdfapi/fpdf_cmaps/Japan1/UniJIS-UCS2-H_4.cpp",
     "core/src/fpdfapi/fpdf_cmaps/Japan1/UniJIS-UCS2-V_4.cpp",
-    "core/src/fpdfapi/fpdf_cmaps/Japan1/UniJIS-UTF16-H_5.cpp",
-    "core/src/fpdfapi/fpdf_cmaps/Japan1/UniJIS-UTF16-V_5.cpp",
     "core/src/fpdfapi/fpdf_cmaps/Japan1/V_1.cpp",
     "core/src/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp",
     "core/src/fpdfapi/fpdf_cmaps/Korea1/Adobe-Korea1-UCS2_2.cpp",
@@ -292,12 +305,10 @@ static_library("fpdfapi") {
     "core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp",
     "core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp",
     "core/src/fpdfapi/fpdf_page/pageint.h",
-    "core/src/fpdfapi/fpdf_parser/filters_int.h",
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp",
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp",
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp",
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp",
-    "core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp",
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp",
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp",
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp",
@@ -309,11 +320,7 @@ static_library("fpdfapi") {
     "core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp",
     "core/src/fpdfapi/fpdf_render/render_int.h",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("fpdftext") {
@@ -326,21 +333,22 @@ static_library("fpdftext") {
     "core/src/fpdftext/txtproc.h",
     "core/src/fpdftext/unicodenormalization.cpp",
     "core/src/fpdftext/unicodenormalizationdata.cpp",
+    "core/src/fpdftext/unicodenormalizationdata.h",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("fxcodec") {
   deps = [
     "third_party:fx_lcms2",
+    "third_party:fx_libjpeg",
+    "third_party:fx_libopenjpeg",
+    "third_party:fx_zlib",
   ]
   sources = [
     "core/include/fxcodec/fx_codec.h",
     "core/include/fxcodec/fx_codec_def.h",
+    "core/include/fxcodec/fx_codec_flate.h",
     "core/include/fxcodec/fx_codec_provider.h",
     "core/src/fxcodec/codec/codec_int.h",
     "core/src/fxcodec/codec/fx_codec.cpp",
@@ -351,54 +359,23 @@ static_library("fxcodec") {
     "core/src/fxcodec/codec/fx_codec_jbig_enc.cpp",
     "core/src/fxcodec/codec/fx_codec_jpeg.cpp",
     "core/src/fxcodec/codec/fx_codec_jpx_opj.cpp",
-    "core/src/fxcodec/fx_libopenjpeg/include/fx_openjpeg.h",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_bio.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_cio.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_dwt.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_event.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_function_list.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_image.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_invert.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_j2k.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_j2k_lib.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_jpt.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_mct.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_mqc.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_openjpeg.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_openjpeg_jp2.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_opj_clock.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_pi.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_raw.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_t1.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_t2.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_tcd.c",
-    "core/src/fxcodec/fx_libopenjpeg/src/fx_tgt.c",
-    "core/src/fxcodec/fx_zlib/include/fx_zlib.h",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_adler32.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_compress.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_crc32.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_deflate.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_gzclose.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_gzlib.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_gzread.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_gzwrite.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_infback.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_inffast.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_inflate.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_inftrees.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_trees.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_uncompr.c",
-    "core/src/fxcodec/fx_zlib/src/fx_zlib_zutil.c",
+    "core/src/fxcodec/jbig2/JBig2_ArithDecoder.cpp",
     "core/src/fxcodec/jbig2/JBig2_ArithDecoder.h",
     "core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp",
     "core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.h",
-    "core/src/fxcodec/jbig2/JBig2_ArithQe.h",
+    "core/src/fxcodec/jbig2/JBig2_BitStream.cpp",
     "core/src/fxcodec/jbig2/JBig2_BitStream.h",
     "core/src/fxcodec/jbig2/JBig2_Context.cpp",
     "core/src/fxcodec/jbig2/JBig2_Context.h",
     "core/src/fxcodec/jbig2/JBig2_Define.h",
-    "core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp",
-    "core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h",
+    "core/src/fxcodec/jbig2/JBig2_GrdProc.cpp",
+    "core/src/fxcodec/jbig2/JBig2_GrdProc.h",
+    "core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp",
+    "core/src/fxcodec/jbig2/JBig2_GrrdProc.h",
+    "core/src/fxcodec/jbig2/JBig2_GsidProc.cpp",
+    "core/src/fxcodec/jbig2/JBig2_GsidProc.h",
+    "core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp",
+    "core/src/fxcodec/jbig2/JBig2_HtrdProc.h",
     "core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp",
     "core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.h",
     "core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp",
@@ -407,91 +384,42 @@ static_library("fxcodec") {
     "core/src/fxcodec/jbig2/JBig2_Image.cpp",
     "core/src/fxcodec/jbig2/JBig2_Image.h",
     "core/src/fxcodec/jbig2/JBig2_List.h",
-    "core/src/fxcodec/jbig2/JBig2_Module.h",
-    "core/src/fxcodec/jbig2/JBig2_Object.cpp",
-    "core/src/fxcodec/jbig2/JBig2_Object.h",
     "core/src/fxcodec/jbig2/JBig2_Page.h",
     "core/src/fxcodec/jbig2/JBig2_PatternDict.cpp",
     "core/src/fxcodec/jbig2/JBig2_PatternDict.h",
+    "core/src/fxcodec/jbig2/JBig2_PddProc.cpp",
+    "core/src/fxcodec/jbig2/JBig2_PddProc.h",
+    "core/src/fxcodec/jbig2/JBig2_SddProc.cpp",
+    "core/src/fxcodec/jbig2/JBig2_SddProc.h",
     "core/src/fxcodec/jbig2/JBig2_Segment.cpp",
     "core/src/fxcodec/jbig2/JBig2_Segment.h",
     "core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp",
     "core/src/fxcodec/jbig2/JBig2_SymbolDict.h",
-    "core/src/fxcodec/lcms2/fx_lcms2.h",
-    "core/src/fxcodec/lcms2/fx_lcms2_plugin.h",
-    "core/src/fxcodec/libjpeg/cderror.h",
-    "core/src/fxcodec/libjpeg/cdjpeg.h",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcapimin.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcapistd.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jccoefct.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jccolor.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcdctmgr.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jchuff.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcinit.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcmainct.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcmarker.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcmaster.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcomapi.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcparam.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcphuff.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcprepct.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jcsample.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jctrans.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdapimin.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdapistd.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdcoefct.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdcolor.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jddctmgr.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdhuff.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdinput.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdmainct.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdmarker.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdmaster.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdmerge.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdphuff.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdpostct.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdsample.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jdtrans.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jerror.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jfdctfst.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jfdctint.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jidctfst.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jidctint.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jidctred.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jmemmgr.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jmemnobs.c",
-    "core/src/fxcodec/libjpeg/fpdfapi_jutils.c",
-    "core/src/fxcodec/libjpeg/jchuff.h",
-    "core/src/fxcodec/libjpeg/jconfig.h",
-    "core/src/fxcodec/libjpeg/jdct.h",
-    "core/src/fxcodec/libjpeg/jdhuff.h",
-    "core/src/fxcodec/libjpeg/jerror.h",
-    "core/src/fxcodec/libjpeg/jinclude.h",
-    "core/src/fxcodec/libjpeg/jmemsys.h",
-    "core/src/fxcodec/libjpeg/jmorecfg.h",
-    "core/src/fxcodec/libjpeg/jpegint.h",
-    "core/src/fxcodec/libjpeg/jpeglib.h",
-    "core/src/fxcodec/libjpeg/jversion.h",
-    "core/src/fxcodec/libjpeg/makefile",
-    "core/src/fxcodec/libjpeg/transupp.h",
+    "core/src/fxcodec/jbig2/JBig2_TrdProc.cpp",
+    "core/src/fxcodec/jbig2/JBig2_TrdProc.h",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
 
   if (is_posix) {
     # core/src/fxcodec/fx_libopenjpeg/src/fx_mct.c does an pointer-to-int
     # conversion to check that an address is 16-bit aligned (benign).
     cflags_c = [ "-Wno-pointer-to-int-cast" ]
   }
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
+}
+
+config("fxge_warnings") {
+  if (is_clang) {
+    cflags = [
+      # http://code.google.com/p/pdfium/issues/detail?id=188
+      "-Wno-switch",
+    ]
+  }
 }
 
 static_library("fxcrt") {
   sources = [
-    "core/include/fxcrt/fx_arb.h",
     "core/include/fxcrt/fx_basic.h",
+    "core/include/fxcrt/fx_bidi.h",
     "core/include/fxcrt/fx_coordinates.h",
     "core/include/fxcrt/fx_ext.h",
     "core/include/fxcrt/fx_memory.h",
@@ -502,8 +430,6 @@ static_library("fxcrt") {
     "core/include/fxcrt/fx_ucd.h",
     "core/include/fxcrt/fx_xml.h",
     "core/src/fxcrt/extension.h",
-    "core/src/fxcrt/fx_arabic.cpp",
-    "core/src/fxcrt/fx_arabic.h",
     "core/src/fxcrt/fx_basic_array.cpp",
     "core/src/fxcrt/fx_basic_bstring.cpp",
     "core/src/fxcrt/fx_basic_buffer.cpp",
@@ -516,6 +442,7 @@ static_library("fxcrt") {
     "core/src/fxcrt/fx_basic_utf.cpp",
     "core/src/fxcrt/fx_basic_util.cpp",
     "core/src/fxcrt/fx_basic_wstring.cpp",
+    "core/src/fxcrt/fx_bidi.cpp",
     "core/src/fxcrt/fx_extension.cpp",
     "core/src/fxcrt/fx_ucddata.cpp",
     "core/src/fxcrt/fx_unicode.cpp",
@@ -530,11 +457,7 @@ static_library("fxcrt") {
     "core/src/fxcrt/plex.h",
     "core/src/fxcrt/xml_int.h",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("fxge") {
@@ -571,6 +494,7 @@ static_library("fxge") {
     "core/src/fxge/dib/fx_dib_engine.cpp",
     "core/src/fxge/dib/fx_dib_main.cpp",
     "core/src/fxge/dib/fx_dib_transform.cpp",
+    "core/src/fxge/fontdata/chromefontdata/chromefontdata.h",
     "core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c",
     "core/src/fxge/fontdata/chromefontdata/FoxitFixed.c",
     "core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c",
@@ -599,10 +523,9 @@ static_library("fxge") {
     "core/src/fxge/ge/text_int.h",
   ]
 
-  configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
+    ":fxge_warnings",
     ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
   ]
 
   if (pdf_use_skia) {
@@ -620,9 +543,7 @@ static_library("fxge") {
       "//third_party/skia/include/utils",
       "//third_party/skia/src/core",
     ]
-    deps = [
-      "//skia",
-    ]
+    deps = [ "//skia" ]
   }
 
   if (is_win) {
@@ -651,11 +572,7 @@ static_library("fxedit") {
     "fpdfsdk/src/fxedit/fxet_module.cpp",
     "fpdfsdk/src/fxedit/fxet_pageobjs.cpp",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("pdfwindow") {
@@ -697,92 +614,68 @@ static_library("pdfwindow") {
     "fpdfsdk/src/pdfwindow/PWL_Utils.cpp",
     "fpdfsdk/src/pdfwindow/PWL_Wnd.cpp",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("javascript") {
   sources = [
-    "fpdfsdk/include/javascript/Consts.h",
-    "fpdfsdk/include/javascript/Document.h",
-    "fpdfsdk/include/javascript/Field.h",
     "fpdfsdk/include/javascript/IJavaScript.h",
-    "fpdfsdk/include/javascript/Icon.h",
-    "fpdfsdk/include/javascript/JS_Context.h",
-    "fpdfsdk/include/javascript/JS_Define.h",
-    "fpdfsdk/include/javascript/JS_EventHandler.h",
-    "fpdfsdk/include/javascript/JS_GlobalData.h",
-    "fpdfsdk/include/javascript/JS_Object.h",
-    "fpdfsdk/include/javascript/JS_Runtime.h",
-    "fpdfsdk/include/javascript/JS_Value.h",
-    "fpdfsdk/include/javascript/JavaScript.h",
-    "fpdfsdk/include/javascript/PublicMethods.h",
-    "fpdfsdk/include/javascript/app.h",
-    "fpdfsdk/include/javascript/color.h",
-    "fpdfsdk/include/javascript/console.h",
-    "fpdfsdk/include/javascript/event.h",
-    "fpdfsdk/include/javascript/global.h",
-    "fpdfsdk/include/javascript/report.h",
-    "fpdfsdk/include/javascript/resource.h",
-    "fpdfsdk/include/javascript/util.h",
-    "fpdfsdk/src/javascript/Consts.cpp",
-    "fpdfsdk/src/javascript/Document.cpp",
-    "fpdfsdk/src/javascript/Field.cpp",
-    "fpdfsdk/src/javascript/Icon.cpp",
-    "fpdfsdk/src/javascript/JS_Context.cpp",
-    "fpdfsdk/src/javascript/JS_EventHandler.cpp",
-    "fpdfsdk/src/javascript/JS_GlobalData.cpp",
-    "fpdfsdk/src/javascript/JS_Object.cpp",
-    "fpdfsdk/src/javascript/JS_Runtime.cpp",
-    "fpdfsdk/src/javascript/JS_Value.cpp",
-    "fpdfsdk/src/javascript/PublicMethods.cpp",
-    "fpdfsdk/src/javascript/app.cpp",
-    "fpdfsdk/src/javascript/color.cpp",
-    "fpdfsdk/src/javascript/console.cpp",
-    "fpdfsdk/src/javascript/event.cpp",
-    "fpdfsdk/src/javascript/global.cpp",
-    "fpdfsdk/src/javascript/report.cpp",
-    "fpdfsdk/src/javascript/resource.cpp",
-    "fpdfsdk/src/javascript/util.cpp",
-  ]
-
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
-  include_dirs = [
-    "//v8",
-    "//v8/include",
-  ]
-
-  public_deps = [
-    "//v8",
-  ]
-}
-
-static_library("jsapi") {
-  sources = [
-    "fpdfsdk/include/jsapi/fxjs_v8.h",
-    "fpdfsdk/src/jsapi/fxjs_v8.cpp",
-  ]
-
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
-  include_dirs = [
-    "//v8",
-    "//v8/include",
-  ]
-
-  public_deps = [
-    "//v8",
   ]
+  if (pdf_enable_v8) {
+    sources += [
+      "fpdfsdk/src/javascript/Consts.cpp",
+      "fpdfsdk/src/javascript/Consts.h",
+      "fpdfsdk/src/javascript/Document.cpp",
+      "fpdfsdk/src/javascript/Document.h",
+      "fpdfsdk/src/javascript/Field.cpp",
+      "fpdfsdk/src/javascript/Field.h",
+      "fpdfsdk/src/javascript/Icon.cpp",
+      "fpdfsdk/src/javascript/Icon.h",
+      "fpdfsdk/src/javascript/JS_Context.cpp",
+      "fpdfsdk/src/javascript/JS_Context.h",
+      "fpdfsdk/src/javascript/JS_Define.h",
+      "fpdfsdk/src/javascript/JS_EventHandler.cpp",
+      "fpdfsdk/src/javascript/JS_EventHandler.h",
+      "fpdfsdk/src/javascript/JS_GlobalData.cpp",
+      "fpdfsdk/src/javascript/JS_GlobalData.h",
+      "fpdfsdk/src/javascript/JS_Object.cpp",
+      "fpdfsdk/src/javascript/JS_Object.h",
+      "fpdfsdk/src/javascript/JS_Runtime.cpp",
+      "fpdfsdk/src/javascript/JS_Runtime.h",
+      "fpdfsdk/src/javascript/JS_Value.cpp",
+      "fpdfsdk/src/javascript/JS_Value.h",
+      "fpdfsdk/src/javascript/PublicMethods.cpp",
+      "fpdfsdk/src/javascript/PublicMethods.h",
+      "fpdfsdk/src/javascript/app.cpp",
+      "fpdfsdk/src/javascript/app.h",
+      "fpdfsdk/src/javascript/color.cpp",
+      "fpdfsdk/src/javascript/color.h",
+      "fpdfsdk/src/javascript/console.cpp",
+      "fpdfsdk/src/javascript/console.h",
+      "fpdfsdk/src/javascript/event.cpp",
+      "fpdfsdk/src/javascript/event.h",
+      "fpdfsdk/src/javascript/global.cpp",
+      "fpdfsdk/src/javascript/global.h",
+      "fpdfsdk/src/javascript/report.cpp",
+      "fpdfsdk/src/javascript/report.h",
+      "fpdfsdk/src/javascript/resource.cpp",
+      "fpdfsdk/src/javascript/resource.h",
+      "fpdfsdk/src/javascript/util.cpp",
+      "fpdfsdk/src/javascript/util.h",
+      "fpdfsdk/include/jsapi/fxjs_v8.h",
+      "fpdfsdk/src/jsapi/fxjs_v8.cpp",
+    ]
+    include_dirs = [
+      "//v8",
+      "//v8/include",
+    ]
+    public_deps = [
+      "//v8",
+    ]
+  } else {
+    sources += [ "fpdfsdk/src/javascript/JS_Runtime_Stub.cpp" ]
+  }
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("formfiller") {
@@ -793,11 +686,9 @@ static_library("formfiller") {
     "fpdfsdk/include/formfiller/FFL_FormFiller.h",
     "fpdfsdk/include/formfiller/FFL_IFormFiller.h",
     "fpdfsdk/include/formfiller/FFL_ListBox.h",
-    "fpdfsdk/include/formfiller/FFL_Notify.h",
     "fpdfsdk/include/formfiller/FFL_PushButton.h",
     "fpdfsdk/include/formfiller/FFL_RadioButton.h",
     "fpdfsdk/include/formfiller/FFL_TextField.h",
-    "fpdfsdk/include/formfiller/FFL_Utils.h",
     "fpdfsdk/include/formfiller/FormFiller.h",
     "fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp",
     "fpdfsdk/src/formfiller/FFL_CheckBox.cpp",
@@ -805,17 +696,11 @@ static_library("formfiller") {
     "fpdfsdk/src/formfiller/FFL_FormFiller.cpp",
     "fpdfsdk/src/formfiller/FFL_IFormFiller.cpp",
     "fpdfsdk/src/formfiller/FFL_ListBox.cpp",
-    "fpdfsdk/src/formfiller/FFL_Notify.cpp",
     "fpdfsdk/src/formfiller/FFL_PushButton.cpp",
     "fpdfsdk/src/formfiller/FFL_RadioButton.cpp",
     "fpdfsdk/src/formfiller/FFL_TextField.cpp",
-    "fpdfsdk/src/formfiller/FFL_Utils.cpp",
-  ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
   ]
+  configs += [ ":pdfium_config" ]
 }
 
 test("pdfium_unittests") {
@@ -824,26 +709,25 @@ test("pdfium_unittests") {
     "core/src/fxcrt/fx_basic_bstring_unittest.cpp",
     "core/src/fxcrt/fx_basic_memmgr_unittest.cpp",
     "core/src/fxcrt/fx_basic_wstring_unittest.cpp",
-    "testing/fx_string_testhelpers.cpp",
-    "testing/fx_string_testhelpers.h",
+    "core/src/fxcrt/fx_bidi_unittest.cpp",
+    "core/src/fxcrt/fx_system_unittest.cpp",
+    "third_party/base/nonstd_unique_ptr_unittest.cpp",
   ]
   deps = [
     "//testing/gtest",
     "//testing/gtest:gtest_main",
     ":pdfium",
+    ":test_support",
   ]
   include_dirs = [ "." ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 test("pdfium_embeddertests") {
   sources = [
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp",
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp",
+    "core/src/fpdfapi/fpdf_render/fpdf_render_pattern_embeddertest.cpp",
     "fpdfsdk/src/fpdf_dataavail_embeddertest.cpp",
     "fpdfsdk/src/fpdfdoc_embeddertest.cpp",
     "fpdfsdk/src/fpdfformfill_embeddertest.cpp",
@@ -855,23 +739,28 @@ test("pdfium_embeddertests") {
     "testing/embedder_test.h",
     "testing/embedder_test_mock_delegate.h",
     "testing/embedder_test_timer_handling_delegate.h",
-    "testing/fx_string_testhelpers.cpp",
-    "testing/fx_string_testhelpers.h",
   ]
   deps = [
     "//testing/gmock",
     "//testing/gtest",
-    "//v8:v8_libplatform",
     ":pdfium",
+    ":test_support",
   ]
   include_dirs = [
-    "//v8",
-    "//v8/include",
     "."
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  if (pdf_enable_v8) {
+    sources += [
+     "fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp"
+    ]
+    deps += [
+      "//v8",
+      "//v8:v8_libplatform",
+    ]
+    include_dirs += [
+      "//v8",
+      "//v8/include",
+    ]
+  }
+  configs += [ ":pdfium_config" ]
 }