Remove CPDF_FormField::GetForm()

No need to get a CPDF_InteractiveForm when it is only needed in a
constructor called by CPDF_InteractiveForm itself, so just pass it
directly.

Change-Id: Ic26c3b8f7e96ee3cb3d92c310fbe5fca527d2d14
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/100091
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 560d0b5..f725ec2 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -40,10 +40,9 @@
 }  // namespace
 
 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField,
-                                   RetainPtr<CPDF_Dictionary> pWidgetDict)
-    : m_pField(pField),
-      m_pWidgetDict(std::move(pWidgetDict)),
-      m_pForm(m_pField->GetForm()) {
+                                   RetainPtr<CPDF_Dictionary> pWidgetDict,
+                                   CPDF_InteractiveForm* pForm)
+    : m_pField(pField), m_pWidgetDict(std::move(pWidgetDict)), m_pForm(pForm) {
   DCHECK(m_pWidgetDict);
 }
 
diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h
index 6f276a0..daa5b53 100644
--- a/core/fpdfdoc/cpdf_formcontrol.h
+++ b/core/fpdfdoc/cpdf_formcontrol.h
@@ -36,7 +36,8 @@
   enum HighlightingMode { kNone = 0, kInvert, kOutline, kPush, kToggle };
 
   CPDF_FormControl(CPDF_FormField* pField,
-                   RetainPtr<CPDF_Dictionary> pWidgetDict);
+                   RetainPtr<CPDF_Dictionary> pWidgetDict,
+                   CPDF_InteractiveForm* pForm);
   ~CPDF_FormControl();
 
   CPDF_FormField::Type GetType() const { return m_pField->GetType(); }
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index a899776..b7e19af 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -139,8 +139,6 @@
   // entries are consistent with the value (/V) object.
   bool UseSelectedIndicesObject() const;
 
-  CPDF_InteractiveForm* GetForm() const { return m_pForm.Get(); }
-
   WideString GetCheckValue(bool bDefault) const;
 
  private:
diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp
index 5531367..b2bfe40 100644
--- a/core/fpdfdoc/cpdf_interactiveform.cpp
+++ b/core/fpdfdoc/cpdf_interactiveform.cpp
@@ -879,7 +879,7 @@
   if (it != m_ControlMap.end())
     return it->second.get();
 
-  auto pNew = std::make_unique<CPDF_FormControl>(pField, pWidgetDict);
+  auto pNew = std::make_unique<CPDF_FormControl>(pField, pWidgetDict, this);
   CPDF_FormControl* pControl = pNew.get();
   m_ControlMap[pWidgetDict] = std::move(pNew);
   m_ControlLists[pdfium::WrapUnowned(pField)].emplace_back(pControl);