Forward declare CFX_TextRenderOptions when possible.
Remove cfx_textrenderoptions.h includes in headers and forward declare
instead. Then do IWYU for all the .cpp files that use
CFX_TextRenderOptions.
Change-Id: I6d56763b62015435f4356b7c3c02ebb00257d0c1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/72232
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp
index b89eea8..520bf85 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.cpp
+++ b/core/fpdfapi/render/cpdf_textrenderer.cpp
@@ -15,6 +15,7 @@
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/cfx_textrenderoptions.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/text_char_pos.h"
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index 80f4845..64fdbb7 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -15,7 +15,6 @@
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_memory_wrappers.h"
#include "core/fxge/cfx_face.h"
-#include "core/fxge/cfx_textrenderoptions.h"
#include "core/fxge/fx_freetype.h"
#include "third_party/base/span.h"
@@ -23,11 +22,12 @@
#include "core/fxge/fx_font.h"
#endif
-class CFX_GlyphCache;
class CFX_GlyphBitmap;
+class CFX_GlyphCache;
class CFX_PathData;
class CFX_SubstFont;
class IFX_SeekableReadStream;
+struct CFX_TextRenderOptions;
class CFX_Font {
public:
diff --git a/core/fxge/cfx_glyphcache.cpp b/core/fxge/cfx_glyphcache.cpp
index 5168547..928f28e 100644
--- a/core/fxge/cfx_glyphcache.cpp
+++ b/core/fxge/cfx_glyphcache.cpp
@@ -34,6 +34,10 @@
#endif
#endif
+#if defined(OS_APPLE)
+#include "core/fxge/cfx_textrenderoptions.h"
+#endif
+
namespace {
constexpr uint32_t kInvalidGlyphIndex = static_cast<uint32_t>(-1);
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 1662e81..ac1beef 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -22,6 +22,7 @@
#include "core/fxge/cfx_glyphcache.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
+#include "core/fxge/cfx_textrenderoptions.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/dib/cfx_imagerenderer.h"
#include "core/fxge/fx_font.h"
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index 12cf617..5f5c26d 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -33,6 +33,7 @@
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/cfx_textrenderoptions.h"
#include "core/fxge/cfx_unicodeencodingex.h"
#include "core/fxge/text_char_pos.h"
#include "fxbarcode/BC_Writer.h"
diff --git a/fxbarcode/oned/BC_OneDimWriter.h b/fxbarcode/oned/BC_OneDimWriter.h
index 98e8878..0f58556 100644
--- a/fxbarcode/oned/BC_OneDimWriter.h
+++ b/fxbarcode/oned/BC_OneDimWriter.h
@@ -11,7 +11,6 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/unowned_ptr.h"
-#include "core/fxge/cfx_textrenderoptions.h"
#include "fxbarcode/BC_Library.h"
#include "fxbarcode/BC_Writer.h"
#include "fxbarcode/utils.h"
@@ -20,6 +19,7 @@
class CFX_PathData;
class CFX_RenderDevice;
class TextCharPos;
+struct CFX_TextRenderOptions;
class CBC_OneDimWriter : public CBC_Writer {
public:
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index 0aaad35..e01d3bf 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -16,6 +16,7 @@
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/cfx_substfont.h"
+#include "core/fxge/cfx_textrenderoptions.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/text_char_pos.h"
#include "third_party/base/stl_util.h"