Remove one circular .h inclusion from cba_fontmap.cpp.

Force the callers to provide simpler underlying objects rather than
the CPDFSDK_Annot which ought to be known only at higher layers.

Change-Id: I5e1415a7ffcbeca63c57ea0359fcf8b20876a4fc
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55532
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index a1f8fe1..4e2e100 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -26,15 +26,15 @@
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxge/cfx_substfont.h"
 #include "fpdfsdk/cfx_systemhandler.h"
-#include "fpdfsdk/cpdfsdk_annot.h"
 #include "third_party/base/ptr_util.h"
 #include "third_party/base/stl_util.h"
 
-CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot,
-                         CFX_SystemHandler* pSystemHandler)
+CBA_FontMap::CBA_FontMap(CFX_SystemHandler* pSystemHandler,
+                         CPDF_Document* pDocument,
+                         CPDF_Dictionary* pAnnotDict)
     : m_pSystemHandler(pSystemHandler),
-      m_pDocument(pAnnot->GetPDFPage()->GetDocument()),
-      m_pAnnotDict(pAnnot->GetPDFAnnot()->GetAnnotDict()) {
+      m_pDocument(pDocument),
+      m_pAnnotDict(pAnnotDict) {
   Initialize();
 }
 
diff --git a/fpdfsdk/formfiller/cba_fontmap.h b/fpdfsdk/formfiller/cba_fontmap.h
index 9bfced4..9912b38 100644
--- a/fpdfsdk/formfiller/cba_fontmap.h
+++ b/fpdfsdk/formfiller/cba_fontmap.h
@@ -16,13 +16,14 @@
 #include "public/fpdf_sysfontinfo.h"
 
 class CFX_SystemHandler;
-class CPDFSDK_Annot;
 class CPDF_Dictionary;
 class CPDF_Document;
 
 class CBA_FontMap final : public IPVT_FontMap {
  public:
-  CBA_FontMap(CPDFSDK_Annot* pAnnot, CFX_SystemHandler* pSystemHandler);
+  CBA_FontMap(CFX_SystemHandler* pSystemHandler,
+              CPDF_Document* pDocument,
+              CPDF_Dictionary* pAnnotDict);
   ~CBA_FontMap() override;
 
   // IPVT_FontMap
diff --git a/fpdfsdk/formfiller/cffl_textobject.cpp b/fpdfsdk/formfiller/cffl_textobject.cpp
index 1c44a4b..3beca7f 100644
--- a/fpdfsdk/formfiller/cffl_textobject.cpp
+++ b/fpdfsdk/formfiller/cffl_textobject.cpp
@@ -33,8 +33,9 @@
 
 CBA_FontMap* CFFL_TextObject::MaybeCreateFontMap() {
   if (!m_pFontMap) {
-    m_pFontMap =
-        pdfium::MakeUnique<CBA_FontMap>(m_pWidget.Get(), GetSystemHandler());
+    m_pFontMap = pdfium::MakeUnique<CBA_FontMap>(
+        GetSystemHandler(), m_pWidget->GetPDFPage()->GetDocument(),
+        m_pWidget->GetPDFAnnot()->GetAnnotDict());
   }
   return m_pFontMap.get();
 }
diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp
index 3087b3b..a431781 100644
--- a/fpdfsdk/pwl/cpwl_appstream.cpp
+++ b/fpdfsdk/pwl/cpwl_appstream.cpp
@@ -1233,8 +1233,10 @@
 
   CPDF_IconFit iconFit = pControl->GetIconFit();
   CBA_FontMap font_map(
-      widget_.Get(),
-      widget_->GetInteractiveForm()->GetFormFillEnv()->GetSysHandler());
+      widget_->GetInteractiveForm()->GetFormFillEnv()->GetSysHandler(),
+      widget_->GetPDFPage()->GetDocument(),
+      widget_->GetPDFAnnot()->GetAnnotDict());
+
   font_map.SetAPType("N");
 
   ByteString csAP =
@@ -1590,8 +1592,9 @@
 
   // Font map must outlive |pEdit|.
   CBA_FontMap font_map(
-      widget_.Get(),
-      widget_->GetInteractiveForm()->GetFormFillEnv()->GetSysHandler());
+      widget_->GetInteractiveForm()->GetFormFillEnv()->GetSysHandler(),
+      widget_->GetPDFPage()->GetDocument(),
+      widget_->GetPDFAnnot()->GetAnnotDict());
 
   auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>();
   pEdit->EnableRefresh(false);
@@ -1657,8 +1660,9 @@
 
   // Font map must outlive |pEdit|.
   CBA_FontMap font_map(
-      widget_.Get(),
-      widget_->GetInteractiveForm()->GetFormFillEnv()->GetSysHandler());
+      widget_->GetInteractiveForm()->GetFormFillEnv()->GetSysHandler(),
+      widget_->GetPDFPage()->GetDocument(),
+      widget_->GetPDFAnnot()->GetAnnotDict());
 
   auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>();
   pEdit->EnableRefresh(false);
@@ -1742,8 +1746,9 @@
 
   // Font map must outlive |pEdit|.
   CBA_FontMap font_map(
-      widget_.Get(),
-      widget_->GetInteractiveForm()->GetFormFillEnv()->GetSysHandler());
+      widget_->GetInteractiveForm()->GetFormFillEnv()->GetSysHandler(),
+      widget_->GetPDFPage()->GetDocument(),
+      widget_->GetPDFAnnot()->GetAnnotDict());
 
   auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>();
   pEdit->EnableRefresh(false);