Make core/fxcrt pass gn check.

Split some XFA-only code into their own targets to avoid circular
dependencies. Make CFX_SeekableMultiStream XFA-only.

Change-Id: I88f49556623d52dddd4d0013cc3308b694c01d42
Reviewed-on: https://pdfium-review.googlesource.com/c/43973
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/.gn b/.gn
index 0e52ba7..2c77331 100644
--- a/.gn
+++ b/.gn
@@ -17,14 +17,15 @@
 }
 
 check_targets = [
+  "//core/fxcrt/*",
   "//fxbarcode/*",
   "//samples/*",
 
   # TODO(thestig): Work on these.
-  #"//core/*",  # Need to split off.
-  #"//fpdfsdk/*",  # Need to split off.
-  #"//fxjs/*",  # Need to split off.
+  #"//core/*",
+  #"//fpdfsdk/*",
+  #"//fxjs/*",
   #"//testing/*",
   #"//testing/fuzzers/*",
-  #"//xfa/*",  # Need to split off.
+  #"//xfa/*",
 ]
diff --git a/BUILD.gn b/BUILD.gn
index 9882e72..3faf5cd 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -232,7 +232,6 @@
     "core/fxcrt/autorestorer_unittest.cpp",
     "core/fxcrt/bytestring_unittest.cpp",
     "core/fxcrt/cfx_bitstream_unittest.cpp",
-    "core/fxcrt/cfx_seekablemultistream_unittest.cpp",
     "core/fxcrt/fx_bidi_unittest.cpp",
     "core/fxcrt/fx_coordinates_unittest.cpp",
     "core/fxcrt/fx_extension_unittest.cpp",
@@ -274,6 +273,7 @@
   include_dirs = []
   if (pdf_enable_xfa) {
     sources += [
+      "core/fxcrt/cfx_seekablemultistream_unittest.cpp",
       "core/fxcrt/css/cfx_cssdeclaration_unittest.cpp",
       "core/fxcrt/css/cfx_cssstylesheet_unittest.cpp",
       "core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp",
diff --git a/core/fxcrt/BUILD.gn b/core/fxcrt/BUILD.gn
index 15a0e06..4de938b 100644
--- a/core/fxcrt/BUILD.gn
+++ b/core/fxcrt/BUILD.gn
@@ -21,8 +21,6 @@
     "cfx_memorystream.h",
     "cfx_readonlymemorystream.cpp",
     "cfx_readonlymemorystream.h",
-    "cfx_seekablemultistream.cpp",
-    "cfx_seekablemultistream.h",
     "cfx_seekablestreamproxy.cpp",
     "cfx_seekablestreamproxy.h",
     "cfx_utf8decoder.cpp",
@@ -120,50 +118,23 @@
       "cfx_char.h",
       "cfx_decimal.cpp",
       "cfx_decimal.h",
-      "css/cfx_css.h",
-      "css/cfx_csscolorvalue.cpp",
-      "css/cfx_csscolorvalue.h",
-      "css/cfx_csscomputedstyle.cpp",
-      "css/cfx_csscomputedstyle.h",
-      "css/cfx_csscustomproperty.cpp",
-      "css/cfx_csscustomproperty.h",
-      "css/cfx_cssdata.cpp",
-      "css/cfx_cssdata.h",
-      "css/cfx_cssdeclaration.cpp",
-      "css/cfx_cssdeclaration.h",
-      "css/cfx_cssenumvalue.cpp",
-      "css/cfx_cssenumvalue.h",
-      "css/cfx_cssexttextbuf.cpp",
-      "css/cfx_cssexttextbuf.h",
-      "css/cfx_cssnumbervalue.cpp",
-      "css/cfx_cssnumbervalue.h",
-      "css/cfx_csspropertyholder.cpp",
-      "css/cfx_csspropertyholder.h",
-      "css/cfx_cssrulecollection.cpp",
-      "css/cfx_cssrulecollection.h",
-      "css/cfx_cssselector.cpp",
-      "css/cfx_cssselector.h",
-      "css/cfx_cssstringvalue.cpp",
-      "css/cfx_cssstringvalue.h",
-      "css/cfx_cssstylerule.cpp",
-      "css/cfx_cssstylerule.h",
-      "css/cfx_cssstyleselector.cpp",
-      "css/cfx_cssstyleselector.h",
-      "css/cfx_cssstylesheet.cpp",
-      "css/cfx_cssstylesheet.h",
-      "css/cfx_csssyntaxparser.cpp",
-      "css/cfx_csssyntaxparser.h",
-      "css/cfx_csstextbuf.cpp",
-      "css/cfx_csstextbuf.h",
-      "css/cfx_cssvalue.cpp",
-      "css/cfx_cssvalue.h",
-      "css/cfx_cssvaluelist.cpp",
-      "css/cfx_cssvaluelist.h",
-      "css/cfx_cssvaluelistparser.cpp",
-      "css/cfx_cssvaluelistparser.h",
       "fx_arabic.cpp",
       "fx_arabic.h",
       "locale_iface.h",
     ]
   }
 }
+
+if (pdf_enable_xfa) {
+  jumbo_source_set("seekablemultistream") {
+    sources = [
+      "cfx_seekablemultistream.cpp",
+      "cfx_seekablemultistream.h",
+    ]
+    deps = [
+      ":fxcrt",
+      "../fpdfapi",
+    ]
+    visibility = [ "../../*" ]
+  }
+}
diff --git a/core/fxcrt/css/BUILD.gn b/core/fxcrt/css/BUILD.gn
new file mode 100644
index 0000000..99b7853
--- /dev/null
+++ b/core/fxcrt/css/BUILD.gn
@@ -0,0 +1,60 @@
+# Copyright 2018 The 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.
+
+import("//build/config/jumbo.gni")
+import("../../../pdfium.gni")
+
+assert(pdf_enable_xfa)
+
+jumbo_source_set("css") {
+  sources = [
+    "cfx_css.h",
+    "cfx_csscolorvalue.cpp",
+    "cfx_csscolorvalue.h",
+    "cfx_csscomputedstyle.cpp",
+    "cfx_csscomputedstyle.h",
+    "cfx_csscustomproperty.cpp",
+    "cfx_csscustomproperty.h",
+    "cfx_cssdata.cpp",
+    "cfx_cssdata.h",
+    "cfx_cssdeclaration.cpp",
+    "cfx_cssdeclaration.h",
+    "cfx_cssenumvalue.cpp",
+    "cfx_cssenumvalue.h",
+    "cfx_cssexttextbuf.cpp",
+    "cfx_cssexttextbuf.h",
+    "cfx_cssnumbervalue.cpp",
+    "cfx_cssnumbervalue.h",
+    "cfx_csspropertyholder.cpp",
+    "cfx_csspropertyholder.h",
+    "cfx_cssrulecollection.cpp",
+    "cfx_cssrulecollection.h",
+    "cfx_cssselector.cpp",
+    "cfx_cssselector.h",
+    "cfx_cssstringvalue.cpp",
+    "cfx_cssstringvalue.h",
+    "cfx_cssstylerule.cpp",
+    "cfx_cssstylerule.h",
+    "cfx_cssstyleselector.cpp",
+    "cfx_cssstyleselector.h",
+    "cfx_cssstylesheet.cpp",
+    "cfx_cssstylesheet.h",
+    "cfx_csssyntaxparser.cpp",
+    "cfx_csssyntaxparser.h",
+    "cfx_csstextbuf.cpp",
+    "cfx_csstextbuf.h",
+    "cfx_cssvalue.cpp",
+    "cfx_cssvalue.h",
+    "cfx_cssvaluelist.cpp",
+    "cfx_cssvaluelist.h",
+    "cfx_cssvaluelistparser.cpp",
+    "cfx_cssvaluelistparser.h",
+  ]
+  deps = [
+    "../",
+    "../../fxge",
+  ]
+  configs += [ "../../../:pdfium_core_config" ]
+  visibility = [ "../../../*" ]
+}
diff --git a/xfa/fxfa/BUILD.gn b/xfa/fxfa/BUILD.gn
index 5d1cc6b..4c82ed3 100644
--- a/xfa/fxfa/BUILD.gn
+++ b/xfa/fxfa/BUILD.gn
@@ -100,6 +100,8 @@
   ]
   deps = [
     "../../core/fxcrt",
+    "../../core/fxcrt:seekablemultistream",
+    "../../core/fxcrt/css",
     "../../fxjs",
     "../fde",
     "../fgas",