Make fxjs/ pass gn check.
Use allow_circular_includes_from as a crutch for now.
Change-Id: I8c53bafd864048506a77354f57e27cac50369005
Reviewed-on: https://pdfium-review.googlesource.com/c/43989
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/.gn b/.gn
index 764e08c..8dc9f60 100644
--- a/.gn
+++ b/.gn
@@ -20,6 +20,7 @@
"//core/fxcrt/*",
"//fpdfsdk/*",
"//fxbarcode/*",
+ "//fxjs/*",
"//samples/*",
"//testing/:*",
"//testing/fuzzers/*",
@@ -28,5 +29,4 @@
# TODO(thestig): Work on these.
#"//core/*",
- #"//fxjs/*",
]
diff --git a/core/fxge/cfx_color.h b/core/fxge/cfx_color.h
index aaa533c..d6fabad 100644
--- a/core/fxge/cfx_color.h
+++ b/core/fxge/cfx_color.h
@@ -61,4 +61,18 @@
float fColor4;
};
+inline bool operator==(const CFX_Color& c1, const CFX_Color& c2) {
+ return c1.nColorType == c2.nColorType && c1.fColor1 - c2.fColor1 < 0.0001 &&
+ c1.fColor1 - c2.fColor1 > -0.0001 &&
+ c1.fColor2 - c2.fColor2 < 0.0001 &&
+ c1.fColor2 - c2.fColor2 > -0.0001 &&
+ c1.fColor3 - c2.fColor3 < 0.0001 &&
+ c1.fColor3 - c2.fColor3 > -0.0001 &&
+ c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001;
+}
+
+inline bool operator!=(const CFX_Color& c1, const CFX_Color& c2) {
+ return !(c1 == c2);
+}
+
#endif // CORE_FXGE_CFX_COLOR_H_
diff --git a/fpdfsdk/BUILD.gn b/fpdfsdk/BUILD.gn
index cf1fdbf..0a696d3 100644
--- a/fpdfsdk/BUILD.gn
+++ b/fpdfsdk/BUILD.gn
@@ -63,6 +63,7 @@
"pwl",
]
allow_circular_includes_from = [
+ "../fxjs",
"formfiller",
"pwl",
]
diff --git a/fpdfsdk/fpdfxfa/BUILD.gn b/fpdfsdk/fpdfxfa/BUILD.gn
index baa615d..a1c6170 100644
--- a/fpdfsdk/fpdfxfa/BUILD.gn
+++ b/fpdfsdk/fpdfxfa/BUILD.gn
@@ -28,6 +28,7 @@
"../../xfa/fxfa",
"../../xfa/fxfa/parser",
]
+ allow_circular_includes_from = [ "../../fxjs" ]
configs += [ "../../:pdfium_core_config" ]
visibility = [ "../../*" ]
}
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index cc6662b..93938db 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -78,20 +78,6 @@
int32_t nPhase;
};
-inline bool operator==(const CFX_Color& c1, const CFX_Color& c2) {
- return c1.nColorType == c2.nColorType && c1.fColor1 - c2.fColor1 < 0.0001 &&
- c1.fColor1 - c2.fColor1 > -0.0001 &&
- c1.fColor2 - c2.fColor2 < 0.0001 &&
- c1.fColor2 - c2.fColor2 > -0.0001 &&
- c1.fColor3 - c2.fColor3 < 0.0001 &&
- c1.fColor3 - c2.fColor3 > -0.0001 &&
- c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001;
-}
-
-inline bool operator!=(const CFX_Color& c1, const CFX_Color& c2) {
- return !(c1 == c2);
-}
-
#define PWL_SCROLLBAR_WIDTH 12.0f
#define PWL_SCROLLBAR_TRANSPARENCY 150
#define PWL_DEFAULT_BLACKCOLOR CFX_Color(CFX_Color::kGray, 0)
diff --git a/fxjs/BUILD.gn b/fxjs/BUILD.gn
index a197d78..673386b 100644
--- a/fxjs/BUILD.gn
+++ b/fxjs/BUILD.gn
@@ -104,6 +104,12 @@
"jse_define.h",
]
deps += [
+ "../core/fdrm",
+ "../core/fpdfapi/font",
+ "../core/fpdfapi/page",
+ "../core/fpdfapi/parser",
+ "../core/fpdfdoc",
+ "../core/fxge",
"//v8",
"//v8:v8_libplatform",
]
diff --git a/fxjs/cjs_color.cpp b/fxjs/cjs_color.cpp
index 06c61f8..7ce5c29 100644
--- a/fxjs/cjs_color.cpp
+++ b/fxjs/cjs_color.cpp
@@ -8,6 +8,7 @@
#include <vector>
+#include "core/fxge/cfx_color.h"
#include "fxjs/cjs_event_context.h"
#include "fxjs/cjs_eventhandler.h"
#include "fxjs/cjs_object.h"
diff --git a/fxjs/cjs_color.h b/fxjs/cjs_color.h
index b1bd211..4e28166 100644
--- a/fxjs/cjs_color.h
+++ b/fxjs/cjs_color.h
@@ -9,7 +9,6 @@
#include <vector>
-#include "fpdfsdk/pwl/cpwl_wnd.h"
#include "fxjs/js_define.h"
class CJS_Color final : public CJS_Object {
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index 35e2bb5..a736626 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -11,6 +11,7 @@
#include <utility>
#include "core/fpdfapi/font/cpdf_font.h"
+#include "core/fpdfdoc/cpdf_formcontrol.h"
#include "core/fpdfdoc/cpdf_formfield.h"
#include "core/fpdfdoc/cpdf_interactiveform.h"
#include "fpdfsdk/cpdfsdk_interactiveform.h"
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index 2e0603c..fb65cc4 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -17,8 +17,10 @@
#include <utility>
#include <vector>
+#include "core/fpdfdoc/cpdf_formcontrol.h"
#include "core/fpdfdoc/cpdf_interactiveform.h"
#include "core/fxcrt/fx_extension.h"
+#include "core/fxge/cfx_color.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_interactiveform.h"
#include "fxjs/cjs_color.h"
diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp
index 539594c..3bc8448 100644
--- a/fxjs/cjs_runtime.cpp
+++ b/fxjs/cjs_runtime.cpp
@@ -39,7 +39,6 @@
#include "fxjs/cjs_util.h"
#include "fxjs/cjs_zoomtype.h"
#include "fxjs/js_define.h"
-#include "public/fpdf_formfill.h"
#include "third_party/base/ptr_util.h"
#ifdef PDF_ENABLE_XFA
diff --git a/fxjs/ijs_runtime.cpp b/fxjs/ijs_runtime.cpp
index 50abd39..34a846e 100644
--- a/fxjs/ijs_runtime.cpp
+++ b/fxjs/ijs_runtime.cpp
@@ -4,7 +4,6 @@
#include "fxjs/ijs_runtime.h"
-#include "fpdfsdk/cpdfsdk_helpers.h"
#include "fxjs/cjs_runtimestub.h"
#include "third_party/base/ptr_util.h"
diff --git a/xfa/fxfa/BUILD.gn b/xfa/fxfa/BUILD.gn
index e87d772..d6417b7 100644
--- a/xfa/fxfa/BUILD.gn
+++ b/xfa/fxfa/BUILD.gn
@@ -117,6 +117,7 @@
"parser",
]
allow_circular_includes_from = [
+ "../../fxjs",
"../fgas",
"../fwl",
"parser",
diff --git a/xfa/fxfa/parser/BUILD.gn b/xfa/fxfa/parser/BUILD.gn
index e65428e..bd7446d 100644
--- a/xfa/fxfa/parser/BUILD.gn
+++ b/xfa/fxfa/parser/BUILD.gn
@@ -709,7 +709,10 @@
"../../fgas",
"../../fxgraphics",
]
- allow_circular_includes_from = [ "../../fgas" ]
+ allow_circular_includes_from = [
+ "../../fgas",
+ "../../../fxjs",
+ ]
configs += [
"../../../:pdfium_core_config",
"../../:xfa_warnings",