Split part of xfa/fgas/BUILD.gn into xfa/fgas/layout/BUILD.gn.

Reduce the scope of the circular dependency with xfa/fde.

Change-Id: Icf710a3c5342cc450b042599ac7a88a95a774a9c
Reviewed-on: https://pdfium-review.googlesource.com/c/47154
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 4834578..3a2cf0a 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -279,6 +279,7 @@
       "xfa/fde:unittests",
       "xfa/fgas",
       "xfa/fgas:unittests",
+      "xfa/fgas/layout:unittests",
       "xfa/fwl:unittests",
       "xfa/fxfa:unittests",
       "xfa/fxfa/fm2js:unittests",
diff --git a/testing/fuzzers/BUILD.gn b/testing/fuzzers/BUILD.gn
index 0e91ac2..bb3a521 100644
--- a/testing/fuzzers/BUILD.gn
+++ b/testing/fuzzers/BUILD.gn
@@ -142,6 +142,7 @@
       ]
       deps = [
         "../../xfa/fgas",
+        "../../xfa/fgas/layout",
       ]
     }
 
diff --git a/xfa/fde/BUILD.gn b/xfa/fde/BUILD.gn
index ff728a7..0b126d9 100644
--- a/xfa/fde/BUILD.gn
+++ b/xfa/fde/BUILD.gn
@@ -21,6 +21,7 @@
   deps = [
     "../../core/fxcrt",
     "../../core/fxge",
+    "../fgas",
   ]
   configs += [
     "../../:pdfium_core_config",
diff --git a/xfa/fgas/BUILD.gn b/xfa/fgas/BUILD.gn
index d2819b8..37c94f6 100644
--- a/xfa/fgas/BUILD.gn
+++ b/xfa/fgas/BUILD.gn
@@ -22,27 +22,13 @@
     "font/cfgas_pdffontmgr.h",
     "font/fgas_fontutils.cpp",
     "font/fgas_fontutils.h",
-    "layout/cfx_break.cpp",
-    "layout/cfx_break.h",
-    "layout/cfx_breakline.cpp",
-    "layout/cfx_breakline.h",
-    "layout/cfx_breakpiece.cpp",
-    "layout/cfx_breakpiece.h",
-    "layout/cfx_linebreak.cpp",
-    "layout/cfx_linebreak.h",
-    "layout/cfx_rtfbreak.cpp",
-    "layout/cfx_rtfbreak.h",
-    "layout/cfx_txtbreak.cpp",
-    "layout/cfx_txtbreak.h",
   ]
   deps = [
     "../../core/fpdfapi/font",
     "../../core/fpdfapi/parser",
     "../../core/fxcrt",
     "../../core/fxge",
-    "../fde",
   ]
-  allow_circular_includes_from = [ "../fde" ]
   configs += [
     "../../:pdfium_core_config",
     "../:xfa_warnings",
@@ -60,13 +46,10 @@
 pdfium_unittest_source_set("unittests") {
   sources = [
     "crt/cfgas_formatstring_unittest.cpp",
-    "layout/cfx_rtfbreak_unittest.cpp",
-    "layout/cfx_txtbreak_unittest.cpp",
   ]
   deps = [
     ":fgas",
     "../../core/fpdfapi",
-    "../../core/fxge",
     "../fxfa/parser",
   ]
   pdfium_root_dir = "../../"
diff --git a/xfa/fgas/layout/BUILD.gn b/xfa/fgas/layout/BUILD.gn
new file mode 100644
index 0000000..41bd375
--- /dev/null
+++ b/xfa/fgas/layout/BUILD.gn
@@ -0,0 +1,51 @@
+# 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")
+import("../../../testing/test.gni")
+
+assert(pdf_enable_xfa)
+
+jumbo_source_set("layout") {
+  sources = [
+    "cfx_break.cpp",
+    "cfx_break.h",
+    "cfx_breakline.cpp",
+    "cfx_breakline.h",
+    "cfx_breakpiece.cpp",
+    "cfx_breakpiece.h",
+    "cfx_linebreak.cpp",
+    "cfx_linebreak.h",
+    "cfx_rtfbreak.cpp",
+    "cfx_rtfbreak.h",
+    "cfx_txtbreak.cpp",
+    "cfx_txtbreak.h",
+  ]
+  deps = [
+    "../:fgas",
+    "../../../core/fxcrt",
+    "../../../core/fxge",
+    "../../fde",
+  ]
+  allow_circular_includes_from = [ "../../fde" ]
+  configs += [
+    "../../../:pdfium_core_config",
+    "../../:xfa_warnings",
+  ]
+  visibility = [ "../../../*" ]
+}
+
+pdfium_unittest_source_set("unittests") {
+  sources = [
+    "cfx_rtfbreak_unittest.cpp",
+    "cfx_txtbreak_unittest.cpp",
+  ]
+  deps = [
+    ":layout",
+    "../:fgas",
+    "../../../core/fxge",
+  ]
+  pdfium_root_dir = "../../../"
+}
diff --git a/xfa/fxfa/BUILD.gn b/xfa/fxfa/BUILD.gn
index ae8679f..ba07acb 100644
--- a/xfa/fxfa/BUILD.gn
+++ b/xfa/fxfa/BUILD.gn
@@ -113,6 +113,7 @@
     "../../fxjs",
     "../fde",
     "../fgas",
+    "../fgas/layout",
     "../fwl",
     "../fxgraphics",
     "parser",
@@ -120,6 +121,7 @@
   allow_circular_includes_from = [
     "../../fxjs",
     "../fgas",
+    "../fgas/layout",
     "../fwl",
     "parser",
   ]