Remove some cross-component include directives.

Part of the circular inclusion problem. Most are stray includes,
but one required introducing a new constant to make a method
definition self-consistent within the header defining it.

Change-Id: Id623231f81082f8b45b0283d02e0e0cffce26bcd
Reviewed-on: https://pdfium-review.googlesource.com/c/49590
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/BUILD.gn b/core/fpdfapi/BUILD.gn
index b18815c..e59ae17 100644
--- a/core/fpdfapi/BUILD.gn
+++ b/core/fpdfapi/BUILD.gn
@@ -26,7 +26,6 @@
     "render",
   ]
   allow_circular_includes_from = [
-    "../fxge",
     "cmaps",
     "font",
     "page",
@@ -34,4 +33,7 @@
     "render",
   ]
   visibility = [ "../../*" ]
+  if (is_win) {
+    allow_circular_includes_from += [ "../fxge" ]
+  }
 }
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index 421af48..d0cf638 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -10,7 +10,6 @@
 #include <sstream>
 #include <utility>
 
-#include "core/fpdfapi/edit/cpdf_creator.h"
 #include "core/fpdfapi/parser/cpdf_dictionary.h"
 #include "core/fpdfapi/parser/cpdf_syntax_parser.h"
 #include "core/fpdfapi/parser/fpdf_parser_utility.h"
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index 4783e40..ead94cb 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -13,8 +13,6 @@
 #include <utility>
 
 #include "core/fdrm/fx_crypt.h"
-#include "core/fpdfapi/edit/cpdf_encryptor.h"
-#include "core/fpdfapi/edit/cpdf_flateencoder.h"
 #include "core/fpdfapi/parser/cpdf_dictionary.h"
 #include "core/fpdfapi/parser/cpdf_number.h"
 #include "core/fpdfapi/parser/cpdf_object_walker.h"
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index bc411d2..b686d26 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -12,7 +12,6 @@
 #include <utility>
 #include <vector>
 
-#include "core/fpdfapi/font/cpdf_font.h"
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxcrt/fx_stream.h"
 #include "core/fxge/cfx_facecache.h"
diff --git a/core/fxge/cfx_unicodeencodingex.cpp b/core/fxge/cfx_unicodeencodingex.cpp
index 2f5eaf7..138f9d1 100644
--- a/core/fxge/cfx_unicodeencodingex.cpp
+++ b/core/fxge/cfx_unicodeencodingex.cpp
@@ -8,7 +8,7 @@
 
 #include <memory>
 
-#include "core/fpdfapi/font/cpdf_font.h"
+#include "core/fxge/cfx_font.h"
 #include "core/fxge/fx_font.h"
 #include "core/fxge/fx_freetype.h"
 #include "third_party/base/ptr_util.h"
@@ -81,7 +81,7 @@
       return Unicode;
     }
   }
-  return CPDF_Font::kInvalidCharCode;
+  return kInvalidCharCode;
 }
 
 std::unique_ptr<CFX_UnicodeEncodingEx> FX_CreateFontEncodingEx(
diff --git a/core/fxge/cfx_unicodeencodingex.h b/core/fxge/cfx_unicodeencodingex.h
index ab624b9..a9c1f58 100644
--- a/core/fxge/cfx_unicodeencodingex.h
+++ b/core/fxge/cfx_unicodeencodingex.h
@@ -14,12 +14,15 @@
 
 class CFX_UnicodeEncodingEx final : public CFX_UnicodeEncoding {
  public:
+  static constexpr uint32_t kInvalidCharCode = static_cast<uint32_t>(-1);
+
   CFX_UnicodeEncodingEx(CFX_Font* pFont, uint32_t EncodingID);
   ~CFX_UnicodeEncodingEx() override;
 
   // CFX_UnicodeEncoding:
   uint32_t GlyphFromCharCode(uint32_t charcode) override;
 
+  // Returns |kInvalidCharCode| on error.
   uint32_t CharCodeFromUnicode(wchar_t Unicode) const;
 
  private: