Move class TextCharPos into its own file.
Move it out of cfx_renderdevice.h, just like with TextGlyphPos.
Adjust #includes and forward declarations.
Change-Id: I875f34361a05ac779d6b13a4562a20b9969b795a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56650
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp
index 4405274..c14f14b 100644
--- a/core/fpdfapi/render/cpdf_charposlist.cpp
+++ b/core/fpdfapi/render/cpdf_charposlist.cpp
@@ -9,8 +9,8 @@
#include "build/build_config.h"
#include "core/fpdfapi/font/cpdf_cidfont.h"
#include "core/fpdfapi/font/cpdf_font.h"
-#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/cfx_substfont.h"
+#include "core/fxge/text_char_pos.h"
CPDF_CharPosList::CPDF_CharPosList(const std::vector<uint32_t>& charCodes,
const std::vector<float>& charPos,
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index e670544..696f842 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -60,10 +60,10 @@
#include "core/fxge/cfx_glyphbitmap.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
-#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/renderdevicedriver_iface.h"
+#include "core/fxge/text_char_pos.h"
#include "core/fxge/text_glyph_pos.h"
#include "third_party/base/compiler_specific.h"
#include "third_party/base/logging.h"
diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp
index 49cfcdf..29e2221 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.cpp
+++ b/core/fpdfapi/render/cpdf_textrenderer.cpp
@@ -15,6 +15,7 @@
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/fx_font.h"
+#include "core/fxge/text_char_pos.h"
namespace {
diff --git a/core/fxge/BUILD.gn b/core/fxge/BUILD.gn
index 3461a6b..c6a74d8 100644
--- a/core/fxge/BUILD.gn
+++ b/core/fxge/BUILD.gn
@@ -108,6 +108,8 @@
"scoped_font_transform.h",
"scoped_font_transform.h",
"systemfontinfo_iface.h",
+ "text_char_pos.cpp",
+ "text_char_pos.h",
"text_glyph_pos.cpp",
"text_glyph_pos.h",
]
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index 7b253a6..96adc88 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -19,6 +19,7 @@
#include "core/fxge/cfx_substfont.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_freetype.h"
+#include "core/fxge/text_char_pos.h"
#include "third_party/base/span.h"
#ifndef _SKIA_SUPPORT_
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 63582ed..133ebff 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -25,6 +25,7 @@
#include "core/fxge/dib/cfx_imagerenderer.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/renderdevicedriver_iface.h"
+#include "core/fxge/text_char_pos.h"
#include "core/fxge/text_glyph_pos.h"
#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
@@ -367,12 +368,6 @@
} // namespace
-TextCharPos::TextCharPos() = default;
-
-TextCharPos::TextCharPos(const TextCharPos&) = default;
-
-TextCharPos::~TextCharPos() = default;
-
CFX_RenderDevice::CFX_RenderDevice() = default;
CFX_RenderDevice::~CFX_RenderDevice() {
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index eeb3e1a..437d270 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -24,29 +24,11 @@
class CFX_ImageRenderer;
class CFX_PathData;
class PauseIndicatorIface;
+class TextCharPos;
struct CFX_Color;
enum class BorderStyle { SOLID, DASH, BEVELED, INSET, UNDERLINE };
-class TextCharPos {
- public:
- TextCharPos();
- TextCharPos(const TextCharPos&);
- ~TextCharPos();
-
- CFX_PointF m_Origin;
- uint32_t m_Unicode = 0;
- uint32_t m_GlyphIndex = 0;
- uint32_t m_FontCharWidth = 0;
-#if defined(OS_MACOSX)
- uint32_t m_ExtGID = 0;
-#endif
- int32_t m_FallbackFontPosition = 0;
- bool m_bGlyphAdjust = false;
- bool m_bFontStyle = false;
- float m_AdjustMatrix[4];
-};
-
class CFX_RenderDevice {
public:
class StateRestorer {
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 9f6b1b4..0f0e5d4 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -30,6 +30,7 @@
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/dib/cfx_imagerenderer.h"
#include "core/fxge/dib/cfx_imagestretcher.h"
+#include "core/fxge/text_char_pos.h"
#include "third_party/base/logging.h"
#include "third_party/base/ptr_util.h"
#include "third_party/skia/include/core/SkCanvas.h"
diff --git a/core/fxge/skia/fx_skia_device_embeddertest.cpp b/core/fxge/skia/fx_skia_device_embeddertest.cpp
index 6daea67..588cb96 100644
--- a/core/fxge/skia/fx_skia_device_embeddertest.cpp
+++ b/core/fxge/skia/fx_skia_device_embeddertest.cpp
@@ -8,6 +8,7 @@
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/skia/fx_skia_device.h"
+#include "core/fxge/text_char_pos.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "public/fpdfview.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/core/fxge/text_char_pos.cpp b/core/fxge/text_char_pos.cpp
new file mode 100644
index 0000000..cf88b96
--- /dev/null
+++ b/core/fxge/text_char_pos.cpp
@@ -0,0 +1,13 @@
+// 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
+
+#include "core/fxge/text_char_pos.h"
+
+TextCharPos::TextCharPos() = default;
+
+TextCharPos::TextCharPos(const TextCharPos&) = default;
+
+TextCharPos::~TextCharPos() = default;
diff --git a/core/fxge/text_char_pos.h b/core/fxge/text_char_pos.h
new file mode 100644
index 0000000..c211be8
--- /dev/null
+++ b/core/fxge/text_char_pos.h
@@ -0,0 +1,31 @@
+// 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_TEXT_CHAR_POS_H_
+#define CORE_FXGE_TEXT_CHAR_POS_H_
+
+#include "core/fxcrt/fx_coordinates.h"
+
+class TextCharPos {
+ public:
+ TextCharPos();
+ TextCharPos(const TextCharPos&);
+ ~TextCharPos();
+
+ CFX_PointF m_Origin;
+ uint32_t m_Unicode = 0;
+ uint32_t m_GlyphIndex = 0;
+ uint32_t m_FontCharWidth = 0;
+#if defined(OS_MACOSX)
+ uint32_t m_ExtGID = 0;
+#endif
+ int32_t m_FallbackFontPosition = 0;
+ bool m_bGlyphAdjust = false;
+ bool m_bFontStyle = false;
+ float m_AdjustMatrix[4];
+};
+
+#endif // CORE_FXGE_TEXT_CHAR_POS_H_
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index 6705437..d7594be 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -20,6 +20,7 @@
#include "core/fxge/dib/cfx_dibextractor.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
+#include "core/fxge/text_char_pos.h"
#include "core/fxge/win32/cpsoutput.h"
#include "third_party/base/ptr_util.h"
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index f0ad867..9ed2426 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -18,6 +18,7 @@
#include "core/fxge/dib/cfx_imagerenderer.h"
#include "core/fxge/dib/cstretchengine.h"
#include "core/fxge/fx_freetype.h"
+#include "core/fxge/text_char_pos.h"
#include "core/fxge/win32/cpsoutput.h"
#include "core/fxge/win32/win32_int.h"
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index 5655393..0accc51 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -33,6 +33,7 @@
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/cfx_unicodeencodingex.h"
+#include "core/fxge/text_char_pos.h"
#include "fxbarcode/BC_Writer.h"
CBC_OneDimWriter::CBC_OneDimWriter() = default;
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 1da7854..23a6c60 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -29,6 +29,7 @@
#include "core/fxcrt/fx_extension.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
+#include "core/fxge/text_char_pos.h"
#include "fxbarcode/BC_Writer.h"
#include "fxbarcode/oned/BC_OneDimWriter.h"
#include "fxbarcode/oned/BC_OnedEANChecksum.h"
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 0185e05..f0e8bb2 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -29,6 +29,7 @@
#include "core/fxcrt/fx_extension.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
+#include "core/fxge/text_char_pos.h"
#include "fxbarcode/BC_Writer.h"
#include "fxbarcode/common/BC_CommonBitMatrix.h"
#include "fxbarcode/oned/BC_OneDimWriter.h"
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index d2668ca..e807ca3 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -26,6 +26,7 @@
#include "core/fxcrt/fx_extension.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
+#include "core/fxge/text_char_pos.h"
#include "fxbarcode/BC_Writer.h"
#include "fxbarcode/oned/BC_OneDimWriter.h"
#include "fxbarcode/oned/BC_OnedEAN13Writer.h"
diff --git a/xfa/fde/BUILD.gn b/xfa/fde/BUILD.gn
index 3127003..e268a63 100644
--- a/xfa/fde/BUILD.gn
+++ b/xfa/fde/BUILD.gn
@@ -37,6 +37,7 @@
]
deps = [
":fde",
+ "../../core/fxge",
"../../testing:unit_test_support",
"../fgas",
]
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp
index 297724a..e67b7d7 100644
--- a/xfa/fde/cfde_texteditengine.cpp
+++ b/xfa/fde/cfde_texteditengine.cpp
@@ -10,6 +10,7 @@
#include <limits>
#include <utility>
+#include "core/fxge/text_char_pos.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fde/cfde_wordbreak_data.h"
diff --git a/xfa/fde/cfde_texteditengine.h b/xfa/fde/cfde_texteditengine.h
index c50c2aa..be89e36 100644
--- a/xfa/fde/cfde_texteditengine.h
+++ b/xfa/fde/cfde_texteditengine.h
@@ -18,6 +18,7 @@
#include "xfa/fgas/layout/cfx_txtbreak.h"
class CFGAS_GEFont;
+class TextCharPos;
struct FDE_TEXTEDITPIECE {
FDE_TEXTEDITPIECE();
diff --git a/xfa/fde/cfde_texteditengine_unittest.cpp b/xfa/fde/cfde_texteditengine_unittest.cpp
index c4d5eed..38c0532 100644
--- a/xfa/fde/cfde_texteditengine_unittest.cpp
+++ b/xfa/fde/cfde_texteditengine_unittest.cpp
@@ -4,6 +4,7 @@
#include "xfa/fde/cfde_texteditengine.h"
+#include "core/fxge/text_char_pos.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/xfa_unit_test_support.h"
#include "third_party/base/ptr_util.h"
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index eb21c93..2f1cc25 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_substfont.h"
#include "core/fxge/fx_font.h"
+#include "core/fxge/text_char_pos.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h
index 07403ca..1f39d1a 100644
--- a/xfa/fde/cfde_textout.h
+++ b/xfa/fde/cfde_textout.h
@@ -21,6 +21,7 @@
class CFGAS_GEFont;
class CFX_RenderDevice;
class CFX_TxtBreak;
+class TextCharPos;
struct FDE_TTOPIECE {
FDE_TTOPIECE();
diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp
index 3057bd3..81f0e1c 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfx_rtfbreak.cpp
@@ -10,7 +10,7 @@
#include "build/build_config.h"
#include "core/fxcrt/fx_safe_types.h"
-#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/text_char_pos.h"
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp
index bfd0202..ce722ed 100644
--- a/xfa/fgas/layout/cfx_txtbreak.cpp
+++ b/xfa/fgas/layout/cfx_txtbreak.cpp
@@ -10,7 +10,7 @@
#include "build/build_config.h"
#include "core/fxcrt/fx_safe_types.h"
-#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/text_char_pos.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/layout/cfx_char.h"
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index c879783..616240b 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -12,6 +12,7 @@
#include <vector>
#include "build/build_config.h"
+#include "core/fxge/text_char_pos.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_texteditengine.h"
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp
index 85d2db3..fd3f305 100644
--- a/xfa/fxfa/cxfa_textlayout.cpp
+++ b/xfa/fxfa/cxfa_textlayout.cpp
@@ -16,6 +16,7 @@
#include "core/fxcrt/xml/cfx_xmltext.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
+#include "core/fxge/text_char_pos.h"
#include "fxjs/xfa/cjx_object.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"