Move #defines and an enum out of cfx_renderdevice.h.

- Move the #defines into core/fxge/render_defines.h.
- Move enum FXPT_TYPE to core/fxge/cfx_pathdata.h, so it is next to the
  struct that needs it.
- Remove cfx_renderdevice.h. from cfx_pathdata.h, and then do IWYU for
  everything that fails to build.

Change-Id: I671d9daed1084d706efbac550578d95a9447b357
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56631
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/edit/BUILD.gn b/core/fpdfapi/edit/BUILD.gn
index 26ab715..25dd663 100644
--- a/core/fpdfapi/edit/BUILD.gn
+++ b/core/fpdfapi/edit/BUILD.gn
@@ -24,6 +24,7 @@
     "../../../constants",
     "../../../third_party:skia_shared",
     "../../fxcrt",
+    "../../fxge",
     "../font",
     "../page",
     "../parser",
@@ -38,6 +39,7 @@
   deps = [
     ":edit",
     "../",
+    "../../fxge",
     "../font",
     "../page",
     "../parser",
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 0f1bc14..fea2fd2 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -34,6 +34,7 @@
 #include "core/fpdfapi/parser/cpdf_stream.h"
 #include "core/fpdfapi/parser/fpdf_parser_decode.h"
 #include "core/fpdfapi/parser/fpdf_parser_utility.h"
+#include "core/fxge/render_defines.h"
 #include "third_party/base/ptr_util.h"
 #include "third_party/base/stl_util.h"
 
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
index 4566e4a..5473041 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
@@ -22,6 +22,7 @@
 #include "core/fpdfapi/parser/cpdf_reference.h"
 #include "core/fpdfapi/parser/cpdf_stream.h"
 #include "core/fpdfapi/render/cpdf_docrenderdata.h"
+#include "core/fxge/render_defines.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/base/ptr_util.h"
 
diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp
index efc82e0..1b313ca 100644
--- a/core/fpdfapi/page/cpdf_contentparser.cpp
+++ b/core/fpdfapi/page/cpdf_contentparser.cpp
@@ -19,6 +19,7 @@
 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "core/fxcrt/pauseindicator_iface.h"
+#include "core/fxge/render_defines.h"
 #include "third_party/base/ptr_util.h"
 
 CPDF_ContentParser::CPDF_ContentParser(CPDF_Page* pPage)
diff --git a/core/fpdfapi/page/cpdf_contentparser.h b/core/fpdfapi/page/cpdf_contentparser.h
index 4576638..f87b015 100644
--- a/core/fpdfapi/page/cpdf_contentparser.h
+++ b/core/fpdfapi/page/cpdf_contentparser.h
@@ -23,6 +23,7 @@
 class CPDF_Stream;
 class CPDF_StreamAcc;
 class CPDF_Type3Char;
+class PauseIndicatorIface;
 
 class CPDF_ContentParser {
  public:
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index b3f36af..b72b2bc 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -36,6 +36,7 @@
 #include "core/fpdfapi/parser/fpdf_parser_utility.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "core/fxge/cfx_graphstatedata.h"
+#include "core/fxge/render_defines.h"
 #include "third_party/base/logging.h"
 #include "third_party/base/ptr_util.h"
 #include "third_party/base/span.h"
diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h
index 04af878..8208347 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.h
+++ b/core/fpdfapi/render/cpdf_renderstatus.h
@@ -17,6 +17,7 @@
 #include "core/fxcrt/unowned_ptr.h"
 #include "core/fxge/fx_dib.h"
 
+class CFX_DIBitmap;
 class CFX_PathData;
 class CFX_RenderDevice;
 class CPDF_Color;
@@ -38,6 +39,7 @@
 class CPDF_Type3Cache;
 class CPDF_Type3Char;
 class CPDF_Type3Font;
+class PauseIndicatorIface;
 
 class CPDF_RenderStatus {
  public:
diff --git a/core/fxge/BUILD.gn b/core/fxge/BUILD.gn
index 00db31c..3461a6b 100644
--- a/core/fxge/BUILD.gn
+++ b/core/fxge/BUILD.gn
@@ -101,6 +101,7 @@
     "fx_font.h",
     "fx_freetype.h",
     "fx_ge_fontmap.cpp",
+    "render_defines.h",
     "renderdevicedriver_iface.cpp",
     "renderdevicedriver_iface.h",
     "scoped_font_transform.cpp",
diff --git a/core/fxge/cfx_glyphcache.cpp b/core/fxge/cfx_glyphcache.cpp
index 80e33d4..f011a6b 100644
--- a/core/fxge/cfx_glyphcache.cpp
+++ b/core/fxge/cfx_glyphcache.cpp
@@ -21,6 +21,7 @@
 #include "core/fxge/cfx_substfont.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "core/fxge/fx_freetype.h"
+#include "core/fxge/render_defines.h"
 #include "core/fxge/scoped_font_transform.h"
 #include "third_party/base/numerics/safe_math.h"
 #include "third_party/base/ptr_util.h"
diff --git a/core/fxge/cfx_pathdata.h b/core/fxge/cfx_pathdata.h
index 1a1d915..fcbcabf 100644
--- a/core/fxge/cfx_pathdata.h
+++ b/core/fxge/cfx_pathdata.h
@@ -11,7 +11,9 @@
 
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/fx_system.h"
-#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxcrt/retain_ptr.h"
+
+enum class FXPT_TYPE : uint8_t { LineTo, BezierTo, MoveTo };
 
 class FX_PATHPOINT {
  public:
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index be845d3..eeb3e1a 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -14,47 +14,9 @@
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/unowned_ptr.h"
 #include "core/fxge/fx_dib.h"
+#include "core/fxge/render_defines.h"
 #include "core/fxge/renderdevicedriver_iface.h"
 
-#define FXDC_PIXEL_WIDTH 2
-#define FXDC_PIXEL_HEIGHT 3
-#define FXDC_BITS_PIXEL 4
-#define FXDC_HORZ_SIZE 5
-#define FXDC_VERT_SIZE 6
-#define FXDC_RENDER_CAPS 7
-
-#define FXRC_GET_BITS 0x01
-#define FXRC_BIT_MASK 0x02
-#define FXRC_ALPHA_PATH 0x10
-#define FXRC_ALPHA_IMAGE 0x20
-#define FXRC_ALPHA_OUTPUT 0x40
-#define FXRC_BLEND_MODE 0x80
-#define FXRC_SOFT_CLIP 0x100
-#define FXRC_CMYK_OUTPUT 0x200
-#define FXRC_BITMASK_OUTPUT 0x400
-#define FXRC_BYTEMASK_OUTPUT 0x800
-#define FXRENDER_IMAGE_LOSSY 0x1000
-#define FXRC_FILLSTROKE_PATH 0x2000
-#define FXRC_SHADING 0x4000
-
-#define FXFILL_ALTERNATE 1
-#define FXFILL_WINDING 2
-#define FXFILL_FULLCOVER 4
-#define FXFILL_RECT_AA 8
-#define FX_FILL_STROKE 16
-#define FX_STROKE_ADJUST 32
-#define FX_STROKE_TEXT_MODE 64
-#define FX_FILL_TEXT_MODE 128
-#define FX_ZEROAREA_FILL 256
-#define FXFILL_NOPATHSMOOTH 512
-
-#define FXTEXT_CLEARTYPE 0x01
-#define FXTEXT_BGR_STRIPE 0x02
-#define FXTEXT_PRINTGRAPHICTEXT 0x04
-#define FXTEXT_NO_NATIVETEXT 0x08
-#define FXTEXT_PRINTIMAGETEXT 0x10
-#define FXTEXT_NOSMOOTH 0x20
-
 class CFX_DIBBase;
 class CFX_DIBitmap;
 class CFX_Font;
@@ -66,8 +28,6 @@
 
 enum class BorderStyle { SOLID, DASH, BEVELED, INSET, UNDERLINE };
 
-enum class FXPT_TYPE : uint8_t { LineTo, BezierTo, MoveTo };
-
 class TextCharPos {
  public:
   TextCharPos();
diff --git a/core/fxge/render_defines.h b/core/fxge/render_defines.h
new file mode 100644
index 0000000..ff52b4e
--- /dev/null
+++ b/core/fxge/render_defines.h
@@ -0,0 +1,49 @@
+// Copyright 2019 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
+
+#ifndef CORE_FXGE_RENDER_DEFINES_H_
+#define CORE_FXGE_RENDER_DEFINES_H_
+
+#define FXDC_PIXEL_WIDTH 2
+#define FXDC_PIXEL_HEIGHT 3
+#define FXDC_BITS_PIXEL 4
+#define FXDC_HORZ_SIZE 5
+#define FXDC_VERT_SIZE 6
+#define FXDC_RENDER_CAPS 7
+
+#define FXRC_GET_BITS 0x01
+#define FXRC_BIT_MASK 0x02
+#define FXRC_ALPHA_PATH 0x10
+#define FXRC_ALPHA_IMAGE 0x20
+#define FXRC_ALPHA_OUTPUT 0x40
+#define FXRC_BLEND_MODE 0x80
+#define FXRC_SOFT_CLIP 0x100
+#define FXRC_CMYK_OUTPUT 0x200
+#define FXRC_BITMASK_OUTPUT 0x400
+#define FXRC_BYTEMASK_OUTPUT 0x800
+#define FXRENDER_IMAGE_LOSSY 0x1000
+#define FXRC_FILLSTROKE_PATH 0x2000
+#define FXRC_SHADING 0x4000
+
+#define FXFILL_ALTERNATE 1
+#define FXFILL_WINDING 2
+#define FXFILL_FULLCOVER 4
+#define FXFILL_RECT_AA 8
+#define FX_FILL_STROKE 16
+#define FX_STROKE_ADJUST 32
+#define FX_STROKE_TEXT_MODE 64
+#define FX_FILL_TEXT_MODE 128
+#define FX_ZEROAREA_FILL 256
+#define FXFILL_NOPATHSMOOTH 512
+
+#define FXTEXT_CLEARTYPE 0x01
+#define FXTEXT_BGR_STRIPE 0x02
+#define FXTEXT_PRINTGRAPHICTEXT 0x04
+#define FXTEXT_NO_NATIVETEXT 0x08
+#define FXTEXT_PRINTIMAGETEXT 0x10
+#define FXTEXT_NOSMOOTH 0x20
+
+#endif  // CORE_FXGE_RENDER_DEFINES_H_
diff --git a/fpdfsdk/fpdf_editpath.cpp b/fpdfsdk/fpdf_editpath.cpp
index 2274d6a..b89c470 100644
--- a/fpdfsdk/fpdf_editpath.cpp
+++ b/fpdfsdk/fpdf_editpath.cpp
@@ -10,6 +10,7 @@
 #include "core/fpdfapi/page/cpdf_path.h"
 #include "core/fpdfapi/page/cpdf_pathobject.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxge/render_defines.h"
 #include "fpdfsdk/cpdfsdk_helpers.h"
 #include "third_party/base/ptr_util.h"
 #include "third_party/base/stl_util.h"
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 1aa9d92..9ad5982 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -23,6 +23,7 @@
 #include "core/fpdfapi/parser/cpdf_reference.h"
 #include "core/fpdfapi/parser/cpdf_stream.h"
 #include "core/fxge/cfx_pathdata.h"
+#include "core/fxge/render_defines.h"
 #include "fpdfsdk/cpdfsdk_helpers.h"
 #include "third_party/base/ptr_util.h"
 
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp
index f6c84ba..8d32a37 100644
--- a/xfa/fwl/theme/cfwl_carettp.cpp
+++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -6,14 +6,16 @@
 
 #include "xfa/fwl/theme/cfwl_carettp.h"
 
+#include "core/fxge/render_defines.h"
 #include "xfa/fwl/cfwl_caret.h"
 #include "xfa/fwl/cfwl_themebackground.h"
 #include "xfa/fwl/cfwl_widget.h"
 #include "xfa/fxgraphics/cxfa_gecolor.h"
 #include "xfa/fxgraphics/cxfa_gepath.h"
 
-CFWL_CaretTP::CFWL_CaretTP() {}
-CFWL_CaretTP::~CFWL_CaretTP() {}
+CFWL_CaretTP::CFWL_CaretTP() = default;
+
+CFWL_CaretTP::~CFWL_CaretTP() = default;
 
 void CFWL_CaretTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
   switch (pParams.m_iPart) {
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 4191bd2..45144b4 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -6,6 +6,7 @@
 
 #include "xfa/fwl/theme/cfwl_pushbuttontp.h"
 
+#include "core/fxge/render_defines.h"
 #include "xfa/fwl/cfwl_pushbutton.h"
 #include "xfa/fwl/cfwl_themebackground.h"
 #include "xfa/fwl/cfwl_widget.h"
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 65eb989..55adc3e 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -6,6 +6,7 @@
 
 #include "xfa/fwl/theme/cfwl_scrollbartp.h"
 
+#include "core/fxge/render_defines.h"
 #include "xfa/fwl/cfwl_scrollbar.h"
 #include "xfa/fwl/cfwl_themebackground.h"
 #include "xfa/fwl/cfwl_widget.h"
diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp
index 6b09ff4..63d6d40 100644
--- a/xfa/fxfa/cxfa_ffpushbutton.cpp
+++ b/xfa/fxfa/cxfa_ffpushbutton.cpp
@@ -8,6 +8,7 @@
 
 #include <utility>
 
+#include "core/fxge/render_defines.h"
 #include "third_party/base/ptr_util.h"
 #include "xfa/fwl/cfwl_notedriver.h"
 #include "xfa/fwl/cfwl_pushbutton.h"
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index d658141..eb50185 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -16,6 +16,7 @@
 #include "core/fxcodec/progressivedecoder.h"
 #include "core/fxcrt/maybe_owned.h"
 #include "core/fxge/cfx_pathdata.h"
+#include "core/fxge/cfx_renderdevice.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
 #include "xfa/fwl/fwl_widgethit.h"
 #include "xfa/fxfa/cxfa_eventparam.h"
diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp
index f075c3d..5bc8b02 100644
--- a/xfa/fxfa/parser/cxfa_fill.cpp
+++ b/xfa/fxfa/parser/cxfa_fill.cpp
@@ -6,6 +6,7 @@
 
 #include "xfa/fxfa/parser/cxfa_fill.h"
 
+#include "core/fxge/render_defines.h"
 #include "fxjs/xfa/cjx_node.h"
 #include "third_party/base/ptr_util.h"
 #include "xfa/fxfa/parser/cxfa_color.h"
diff --git a/xfa/fxfa/parser/cxfa_linear.cpp b/xfa/fxfa/parser/cxfa_linear.cpp
index b8a544a..b482d27 100644
--- a/xfa/fxfa/parser/cxfa_linear.cpp
+++ b/xfa/fxfa/parser/cxfa_linear.cpp
@@ -6,6 +6,7 @@
 
 #include "xfa/fxfa/parser/cxfa_linear.h"
 
+#include "core/fxge/render_defines.h"
 #include "fxjs/xfa/cjx_node.h"
 #include "third_party/base/ptr_util.h"
 #include "xfa/fxfa/parser/cxfa_color.h"
diff --git a/xfa/fxfa/parser/cxfa_pattern.cpp b/xfa/fxfa/parser/cxfa_pattern.cpp
index 80e05f3..e6f38aa 100644
--- a/xfa/fxfa/parser/cxfa_pattern.cpp
+++ b/xfa/fxfa/parser/cxfa_pattern.cpp
@@ -6,6 +6,7 @@
 
 #include "xfa/fxfa/parser/cxfa_pattern.h"
 
+#include "core/fxge/render_defines.h"
 #include "fxjs/xfa/cjx_node.h"
 #include "third_party/base/ptr_util.h"
 #include "xfa/fxfa/parser/cxfa_color.h"
diff --git a/xfa/fxfa/parser/cxfa_radial.cpp b/xfa/fxfa/parser/cxfa_radial.cpp
index cb21bc3..4eb944f 100644
--- a/xfa/fxfa/parser/cxfa_radial.cpp
+++ b/xfa/fxfa/parser/cxfa_radial.cpp
@@ -8,6 +8,7 @@
 
 #include <utility>
 
+#include "core/fxge/render_defines.h"
 #include "fxjs/xfa/cjx_node.h"
 #include "third_party/base/ptr_util.h"
 #include "xfa/fxfa/parser/cxfa_color.h"
diff --git a/xfa/fxfa/parser/cxfa_rectangle.cpp b/xfa/fxfa/parser/cxfa_rectangle.cpp
index 0cd5a1f..632141d 100644
--- a/xfa/fxfa/parser/cxfa_rectangle.cpp
+++ b/xfa/fxfa/parser/cxfa_rectangle.cpp
@@ -8,6 +8,7 @@
 
 #include <utility>
 
+#include "core/fxge/render_defines.h"
 #include "fxjs/xfa/cjx_node.h"
 #include "third_party/base/ptr_util.h"
 #include "xfa/fxfa/parser/cxfa_corner.h"
diff --git a/xfa/fxfa/parser/cxfa_stipple.cpp b/xfa/fxfa/parser/cxfa_stipple.cpp
index 912d24f..024d111 100644
--- a/xfa/fxfa/parser/cxfa_stipple.cpp
+++ b/xfa/fxfa/parser/cxfa_stipple.cpp
@@ -6,6 +6,7 @@
 
 #include "xfa/fxfa/parser/cxfa_stipple.h"
 
+#include "core/fxge/render_defines.h"
 #include "fxjs/xfa/cjx_node.h"
 #include "third_party/base/ptr_util.h"
 #include "xfa/fxfa/parser/cxfa_color.h"