Mark CPDFSDK_PageView* as const in CFFL classes.

The CPDFSDK_PageView* pointers used all over the place in CFFL classes
are only used as the keys into a map. Since the pointers themselves are
never dereferenced, store them and pass them around as const pointers.

Change-Id: I7fe938c8a7b4232bf96cdad68eb2c948df4dac5a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/81532
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index be05111..efc56df 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -206,7 +206,7 @@
 
 bool CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
                                   CPDFSDK_FieldAction* data,
-                                  CPDFSDK_PageView* pPageView) {
+                                  const CPDFSDK_PageView* pPageView) {
   auto* pContext = static_cast<CPDFXFA_Context*>(
       m_pPageView->GetFormFillEnv()->GetDocExtension());
   if (!pContext)
@@ -795,7 +795,7 @@
 
 bool CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
                                CPDFSDK_FieldAction* data,
-                               CPDFSDK_PageView* pPageView) {
+                               const CPDFSDK_PageView* pPageView) {
   CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv();
 
 #ifdef PDF_ENABLE_XFA
diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h
index 467b2b4..c9ca6e7 100644
--- a/fpdfsdk/cpdfsdk_widget.h
+++ b/fpdfsdk/cpdfsdk_widget.h
@@ -88,7 +88,7 @@
   bool HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) const;
   bool OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
                     CPDFSDK_FieldAction* data,
-                    CPDFSDK_PageView* pPageView);
+                    const CPDFSDK_PageView* pPageView);
   void Synchronize(bool bSynchronizeElse);
   // TODO(thestig): Figure out if the parameter should be used or removed.
   void ResetXFAAppearance(ValueChanged bValueChanged);
@@ -101,7 +101,7 @@
 
   bool OnAAction(CPDF_AAction::AActionType type,
                  CPDFSDK_FieldAction* data,
-                 CPDFSDK_PageView* pPageView);
+                 const CPDFSDK_PageView* pPageView);
 
   CPDFSDK_InteractiveForm* GetInteractiveForm() const {
     return m_pInteractiveForm.Get();
diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp
index ff280eb..38c7876 100644
--- a/fpdfsdk/formfiller/cffl_checkbox.cpp
+++ b/fpdfsdk/formfiller/cffl_checkbox.cpp
@@ -94,12 +94,12 @@
   return CommitData(pPageView, nFlags);
 }
 
-bool CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
+bool CFFL_CheckBox::IsDataChanged(const CPDFSDK_PageView* pPageView) {
   CPWL_CheckBox* pWnd = GetCheckBox(pPageView);
   return pWnd && pWnd->IsChecked() != m_pWidget->IsChecked();
 }
 
-void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) {
+void CFFL_CheckBox::SaveData(const CPDFSDK_PageView* pPageView) {
   CPWL_CheckBox* pWnd = GetCheckBox(pPageView);
   if (!pWnd)
     return;
@@ -128,11 +128,12 @@
   SetChangeMark();
 }
 
-CPWL_CheckBox* CFFL_CheckBox::GetCheckBox(CPDFSDK_PageView* pPageView) const {
+CPWL_CheckBox* CFFL_CheckBox::GetCheckBox(
+    const CPDFSDK_PageView* pPageView) const {
   return static_cast<CPWL_CheckBox*>(GetPWLWindow(pPageView));
 }
 
 CPWL_CheckBox* CFFL_CheckBox::CreateOrUpdateCheckBox(
-    CPDFSDK_PageView* pPageView) {
+    const CPDFSDK_PageView* pPageView) {
   return static_cast<CPWL_CheckBox*>(CreateOrUpdatePWLWindow(pPageView));
 }
diff --git a/fpdfsdk/formfiller/cffl_checkbox.h b/fpdfsdk/formfiller/cffl_checkbox.h
index fbf4a9a..3470554 100644
--- a/fpdfsdk/formfiller/cffl_checkbox.h
+++ b/fpdfsdk/formfiller/cffl_checkbox.h
@@ -29,12 +29,12 @@
                    CPDFSDK_Annot* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
-  bool IsDataChanged(CPDFSDK_PageView* pPageView) override;
-  void SaveData(CPDFSDK_PageView* pPageView) override;
+  bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
+  void SaveData(const CPDFSDK_PageView* pPageView) override;
 
  private:
-  CPWL_CheckBox* GetCheckBox(CPDFSDK_PageView* pPageView) const;
-  CPWL_CheckBox* CreateOrUpdateCheckBox(CPDFSDK_PageView* pPageView);
+  CPWL_CheckBox* GetCheckBox(const CPDFSDK_PageView* pPageView) const;
+  CPWL_CheckBox* CreateOrUpdateCheckBox(const CPDFSDK_PageView* pPageView);
 };
 
 #endif  // FPDFSDK_FORMFILLER_CFFL_CHECKBOX_H_
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index bf83b41..fa40a5f 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -69,7 +69,7 @@
   return CFFL_TextObject::OnChar(pAnnot, nChar, nFlags);
 }
 
-bool CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
+bool CFFL_ComboBox::IsDataChanged(const CPDFSDK_PageView* pPageView) {
   auto* pWnd = GetComboBox(pPageView);
   if (!pWnd)
     return false;
@@ -84,7 +84,7 @@
   return pWnd->GetText() != m_pWidget->GetValue();
 }
 
-void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) {
+void CFFL_ComboBox::SaveData(const CPDFSDK_PageView* pPageView) {
   CPWL_ComboBox* pWnd = GetComboBox(pPageView);
   if (!pWnd)
     return;
@@ -114,7 +114,7 @@
   SetChangeMark();
 }
 
-void CFFL_ComboBox::GetActionData(CPDFSDK_PageView* pPageView,
+void CFFL_ComboBox::GetActionData(const CPDFSDK_PageView* pPageView,
                                   CPDF_AAction::AActionType type,
                                   CPDFSDK_FieldAction& fa) {
   switch (type) {
@@ -149,7 +149,7 @@
   }
 }
 
-void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView,
+void CFFL_ComboBox::SetActionData(const CPDFSDK_PageView* pPageView,
                                   CPDF_AAction::AActionType type,
                                   const CPDFSDK_FieldAction& fa) {
   switch (type) {
@@ -166,7 +166,7 @@
   }
 }
 
-void CFFL_ComboBox::SavePWLWindowState(CPDFSDK_PageView* pPageView) {
+void CFFL_ComboBox::SavePWLWindowState(const CPDFSDK_PageView* pPageView) {
   CPWL_ComboBox* pComboBox = GetComboBox(pPageView);
   if (!pComboBox)
     return;
@@ -182,7 +182,7 @@
 }
 
 void CFFL_ComboBox::RecreatePWLWindowFromSavedState(
-    CPDFSDK_PageView* pPageView) {
+    const CPDFSDK_PageView* pPageView) {
   CPWL_ComboBox* pComboBox = CreateOrUpdateComboBox(pPageView);
   if (!pComboBox)
     return;
@@ -227,7 +227,7 @@
 }
 
 #ifdef PDF_ENABLE_XFA
-bool CFFL_ComboBox::IsFieldFull(CPDFSDK_PageView* pPageView) {
+bool CFFL_ComboBox::IsFieldFull(const CPDFSDK_PageView* pPageView) {
   CPWL_ComboBox* pComboBox = GetComboBox(pPageView);
   if (!pComboBox)
     return false;
@@ -265,11 +265,12 @@
   return swRet;
 }
 
-CPWL_ComboBox* CFFL_ComboBox::GetComboBox(CPDFSDK_PageView* pPageView) const {
+CPWL_ComboBox* CFFL_ComboBox::GetComboBox(
+    const CPDFSDK_PageView* pPageView) const {
   return static_cast<CPWL_ComboBox*>(GetPWLWindow(pPageView));
 }
 
 CPWL_ComboBox* CFFL_ComboBox::CreateOrUpdateComboBox(
-    CPDFSDK_PageView* pPageView) {
+    const CPDFSDK_PageView* pPageView) {
   return static_cast<CPWL_ComboBox*>(CreateOrUpdatePWLWindow(pPageView));
 }
diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h
index 50f0c14..5ef3ff6 100644
--- a/fpdfsdk/formfiller/cffl_combobox.h
+++ b/fpdfsdk/formfiller/cffl_combobox.h
@@ -34,20 +34,21 @@
       std::unique_ptr<IPWL_SystemHandler::PerWindowData> pAttachedData)
       override;
   bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
-  bool IsDataChanged(CPDFSDK_PageView* pPageView) override;
-  void SaveData(CPDFSDK_PageView* pPageView) override;
-  void GetActionData(CPDFSDK_PageView* pPageView,
+  bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
+  void SaveData(const CPDFSDK_PageView* pPageView) override;
+  void GetActionData(const CPDFSDK_PageView* pPageView,
                      CPDF_AAction::AActionType type,
                      CPDFSDK_FieldAction& fa) override;
-  void SetActionData(CPDFSDK_PageView* pPageView,
+  void SetActionData(const CPDFSDK_PageView* pPageView,
                      CPDF_AAction::AActionType type,
                      const CPDFSDK_FieldAction& fa) override;
-  void SavePWLWindowState(CPDFSDK_PageView* pPageView) override;
-  void RecreatePWLWindowFromSavedState(CPDFSDK_PageView* pPageView) override;
+  void SavePWLWindowState(const CPDFSDK_PageView* pPageView) override;
+  void RecreatePWLWindowFromSavedState(
+      const CPDFSDK_PageView* pPageView) override;
   bool SetIndexSelected(int index, bool selected) override;
   bool IsIndexSelected(int index) override;
 #ifdef PDF_ENABLE_XFA
-  bool IsFieldFull(CPDFSDK_PageView* pPageView) override;
+  bool IsFieldFull(const CPDFSDK_PageView* pPageView) override;
 #endif
 
   // CPWL_Wnd::FocusHandlerIface:
@@ -55,8 +56,8 @@
 
  private:
   WideString GetSelectExportText();
-  CPWL_ComboBox* GetComboBox(CPDFSDK_PageView* pPageView) const;
-  CPWL_ComboBox* CreateOrUpdateComboBox(CPDFSDK_PageView* pPageView);
+  CPWL_ComboBox* GetComboBox(const CPDFSDK_PageView* pPageView) const;
+  CPWL_ComboBox* CreateOrUpdateComboBox(const CPDFSDK_PageView* pPageView);
 
   FFL_ComboBoxState m_State;
 };
diff --git a/fpdfsdk/formfiller/cffl_formfield.cpp b/fpdfsdk/formfiller/cffl_formfield.cpp
index 187ec43..b79077f 100644
--- a/fpdfsdk/formfiller/cffl_formfield.cpp
+++ b/fpdfsdk/formfiller/cffl_formfield.cpp
@@ -37,7 +37,7 @@
   }
 }
 
-FX_RECT CFFL_FormField::GetViewBBox(CPDFSDK_PageView* pPageView) {
+FX_RECT CFFL_FormField::GetViewBBox(const CPDFSDK_PageView* pPageView) {
   CPWL_Wnd* pWnd = GetPWLWindow(pPageView);
   CFX_FloatRect rcAnnot =
       pWnd ? PWLtoFFL(pWnd->GetWindowRect()) : m_pWidget->GetRect();
@@ -344,13 +344,15 @@
   return cp;
 }
 
-CPWL_Wnd* CFFL_FormField::GetPWLWindow(CPDFSDK_PageView* pPageView) const {
+CPWL_Wnd* CFFL_FormField::GetPWLWindow(
+    const CPDFSDK_PageView* pPageView) const {
   DCHECK(pPageView);
   auto it = m_Maps.find(pPageView);
   return it != m_Maps.end() ? it->second.get() : nullptr;
 }
 
-CPWL_Wnd* CFFL_FormField::CreateOrUpdatePWLWindow(CPDFSDK_PageView* pPageView) {
+CPWL_Wnd* CFFL_FormField::CreateOrUpdatePWLWindow(
+    const CPDFSDK_PageView* pPageView) {
   DCHECK(pPageView);
   CPWL_Wnd* pWnd = GetPWLWindow(pPageView);
   if (!pWnd) {
@@ -370,7 +372,7 @@
                                    pPrivateData->GetValueAge());
 }
 
-void CFFL_FormField::DestroyPWLWindow(CPDFSDK_PageView* pPageView) {
+void CFFL_FormField::DestroyPWLWindow(const CPDFSDK_PageView* pPageView) {
   auto it = m_Maps.find(pPageView);
   if (it == m_Maps.end())
     return;
@@ -386,7 +388,7 @@
   if (!pPrivateData)
     return CFX_Matrix();
 
-  CPDFSDK_PageView* pPageView = pPrivateData->GetPageView();
+  const CPDFSDK_PageView* pPageView = pPrivateData->GetPageView();
   if (!pPageView)
     return CFX_Matrix();
 
@@ -432,7 +434,7 @@
   return m_pFormFillEnv->GetOrCreatePageView(pPage);
 }
 
-CFX_FloatRect CFFL_FormField::GetFocusBox(CPDFSDK_PageView* pPageView) {
+CFX_FloatRect CFFL_FormField::GetFocusBox(const CPDFSDK_PageView* pPageView) {
   CPWL_Wnd* pWnd = GetPWLWindow(pPageView);
   if (!pWnd)
     return CFX_FloatRect();
@@ -458,7 +460,8 @@
   return GetCurMatrix().Transform(point);
 }
 
-bool CFFL_FormField::CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag) {
+bool CFFL_FormField::CommitData(const CPDFSDK_PageView* pPageView,
+                                uint32_t nFlag) {
   if (!IsDataChanged(pPageView))
     return true;
 
@@ -500,14 +503,14 @@
   return true;
 }
 
-bool CFFL_FormField::IsDataChanged(CPDFSDK_PageView* pPageView) {
+bool CFFL_FormField::IsDataChanged(const CPDFSDK_PageView* pPageView) {
   return false;
 }
 
-void CFFL_FormField::SaveData(CPDFSDK_PageView* pPageView) {}
+void CFFL_FormField::SaveData(const CPDFSDK_PageView* pPageView) {}
 
 #ifdef PDF_ENABLE_XFA
-bool CFFL_FormField::IsFieldFull(CPDFSDK_PageView* pPageView) {
+bool CFFL_FormField::IsFieldFull(const CPDFSDK_PageView* pPageView) {
   return false;
 }
 #endif  // PDF_ENABLE_XFA
@@ -516,33 +519,34 @@
   m_pFormFillEnv->OnChange();
 }
 
-void CFFL_FormField::GetActionData(CPDFSDK_PageView* pPageView,
+void CFFL_FormField::GetActionData(const CPDFSDK_PageView* pPageView,
                                    CPDF_AAction::AActionType type,
                                    CPDFSDK_FieldAction& fa) {
   fa.sValue = m_pWidget->GetValue();
 }
 
-void CFFL_FormField::SetActionData(CPDFSDK_PageView* pPageView,
+void CFFL_FormField::SetActionData(const CPDFSDK_PageView* pPageView,
                                    CPDF_AAction::AActionType type,
                                    const CPDFSDK_FieldAction& fa) {}
 
-void CFFL_FormField::SavePWLWindowState(CPDFSDK_PageView* pPageView) {}
+void CFFL_FormField::SavePWLWindowState(const CPDFSDK_PageView* pPageView) {}
 
 void CFFL_FormField::RecreatePWLWindowFromSavedState(
-    CPDFSDK_PageView* pPageView) {}
+    const CPDFSDK_PageView* pPageView) {}
 
-CPWL_Wnd* CFFL_FormField::ResetPWLWindowForValueAge(CPDFSDK_PageView* pPageView,
-                                                    CPDFSDK_Widget* pWidget,
-                                                    uint32_t nValueAge) {
+CPWL_Wnd* CFFL_FormField::ResetPWLWindowForValueAge(
+    const CPDFSDK_PageView* pPageView,
+    CPDFSDK_Widget* pWidget,
+    uint32_t nValueAge) {
   return nValueAge == pWidget->GetValueAge() ? RestorePWLWindow(pPageView)
                                              : ResetPWLWindow(pPageView);
 }
 
-CPWL_Wnd* CFFL_FormField::ResetPWLWindow(CPDFSDK_PageView* pPageView) {
+CPWL_Wnd* CFFL_FormField::ResetPWLWindow(const CPDFSDK_PageView* pPageView) {
   return GetPWLWindow(pPageView);
 }
 
-CPWL_Wnd* CFFL_FormField::RestorePWLWindow(CPDFSDK_PageView* pPageView) {
+CPWL_Wnd* CFFL_FormField::RestorePWLWindow(const CPDFSDK_PageView* pPageView) {
   return GetPWLWindow(pPageView);
 }
 
diff --git a/fpdfsdk/formfiller/cffl_formfield.h b/fpdfsdk/formfiller/cffl_formfield.h
index a33107c..0a84d37 100644
--- a/fpdfsdk/formfiller/cffl_formfield.h
+++ b/fpdfsdk/formfiller/cffl_formfield.h
@@ -71,7 +71,7 @@
   virtual bool SetIndexSelected(int index, bool selected);
   virtual bool IsIndexSelected(int index);
 
-  FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView);
+  FX_RECT GetViewBBox(const CPDFSDK_PageView* pPageView);
 
   WideString GetText();
   WideString GetSelectedText();
@@ -93,37 +93,38 @@
   CFX_Matrix GetWindowMatrix(
       const IPWL_SystemHandler::PerWindowData* pAttached) override;
 
-  virtual void GetActionData(CPDFSDK_PageView* pPageView,
+  virtual void GetActionData(const CPDFSDK_PageView* pPageView,
                              CPDF_AAction::AActionType type,
                              CPDFSDK_FieldAction& fa);
-  virtual void SetActionData(CPDFSDK_PageView* pPageView,
+  virtual void SetActionData(const CPDFSDK_PageView* pPageView,
                              CPDF_AAction::AActionType type,
                              const CPDFSDK_FieldAction& fa);
   virtual CPWL_Wnd::CreateParams GetCreateParam();
   virtual std::unique_ptr<CPWL_Wnd> NewPWLWindow(
       const CPWL_Wnd::CreateParams& cp,
       std::unique_ptr<IPWL_SystemHandler::PerWindowData> pAttachedData) = 0;
-  virtual void SavePWLWindowState(CPDFSDK_PageView* pPageView);
-  virtual void RecreatePWLWindowFromSavedState(CPDFSDK_PageView* pPageView);
-  virtual bool IsDataChanged(CPDFSDK_PageView* pPageView);
-  virtual void SaveData(CPDFSDK_PageView* pPageView);
+  virtual void SavePWLWindowState(const CPDFSDK_PageView* pPageView);
+  virtual void RecreatePWLWindowFromSavedState(
+      const CPDFSDK_PageView* pPageView);
+  virtual bool IsDataChanged(const CPDFSDK_PageView* pPageView);
+  virtual void SaveData(const CPDFSDK_PageView* pPageView);
 #ifdef PDF_ENABLE_XFA
-  virtual bool IsFieldFull(CPDFSDK_PageView* pPageView);
+  virtual bool IsFieldFull(const CPDFSDK_PageView* pPageView);
 #endif  // PDF_ENABLE_XFA
 
   CFX_Matrix GetCurMatrix();
-  CFX_FloatRect GetFocusBox(CPDFSDK_PageView* pPageView);
+  CFX_FloatRect GetFocusBox(const CPDFSDK_PageView* pPageView);
   CFX_FloatRect FFLtoPWL(const CFX_FloatRect& rect);
   CFX_FloatRect PWLtoFFL(const CFX_FloatRect& rect);
   CFX_PointF FFLtoPWL(const CFX_PointF& point);
   CFX_PointF PWLtoFFL(const CFX_PointF& point);
-  bool CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag);
-  CPWL_Wnd* ResetPWLWindowForValueAge(CPDFSDK_PageView* pPageView,
+  bool CommitData(const CPDFSDK_PageView* pPageView, uint32_t nFlag);
+  CPWL_Wnd* ResetPWLWindowForValueAge(const CPDFSDK_PageView* pPageView,
                                       CPDFSDK_Widget* pWidget,
                                       uint32_t nValueAge);
-  CPWL_Wnd* GetPWLWindow(CPDFSDK_PageView* pPageView) const;
-  CPWL_Wnd* CreateOrUpdatePWLWindow(CPDFSDK_PageView* pPageView);
-  void DestroyPWLWindow(CPDFSDK_PageView* pPageView);
+  CPWL_Wnd* GetPWLWindow(const CPDFSDK_PageView* pPageView) const;
+  CPWL_Wnd* CreateOrUpdatePWLWindow(const CPDFSDK_PageView* pPageView);
+  void DestroyPWLWindow(const CPDFSDK_PageView* pPageView);
   void EscapeFiller(CPDFSDK_PageView* pPageView, bool bDestroyPWLWindow);
 
   bool IsValid() const;
@@ -135,8 +136,8 @@
   CPDFSDK_Annot* GetSDKAnnot() const { return m_pWidget.Get(); }
 
  protected:
-  virtual CPWL_Wnd* ResetPWLWindow(CPDFSDK_PageView* pPageView);
-  virtual CPWL_Wnd* RestorePWLWindow(CPDFSDK_PageView* pPageView);
+  virtual CPWL_Wnd* ResetPWLWindow(const CPDFSDK_PageView* pPageView);
+  virtual CPWL_Wnd* RestorePWLWindow(const CPDFSDK_PageView* pPageView);
 
   // If the inheriting widget has its own fontmap and a PWL_Edit widget that
   // access that fontmap then you have to call DestroyWindows before destroying
@@ -152,7 +153,7 @@
   UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
   UnownedPtr<CPDFSDK_Widget> m_pWidget;
   std::unique_ptr<CFX_Timer> m_pTimer;
-  std::map<CPDFSDK_PageView*, std::unique_ptr<CPWL_Wnd>> m_Maps;
+  std::map<const CPDFSDK_PageView*, std::unique_ptr<CPWL_Wnd>> m_Maps;
 };
 
 #endif  // FPDFSDK_FORMFILLER_CFFL_FORMFIELD_H_
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 702238c..b5e1643 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -40,8 +40,9 @@
   return pAnnot->GetRect().Contains(point);
 }
 
-FX_RECT CFFL_InteractiveFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
-                                                CPDFSDK_Annot* pAnnot) {
+FX_RECT CFFL_InteractiveFormFiller::GetViewBBox(
+    const CPDFSDK_PageView* pPageView,
+    CPDFSDK_Annot* pAnnot) {
   if (CFFL_FormField* pFormField = GetFormField(pAnnot))
     return pFormField->GetViewBBox(pPageView);
 
@@ -242,7 +243,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::OnButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                                            CPDFSDK_PageView* pPageView,
+                                            const CPDFSDK_PageView* pPageView,
                                             uint32_t nFlag) {
   if (m_bNotifying)
     return false;
@@ -643,7 +644,7 @@
 
 bool CFFL_InteractiveFormFiller::OnKeyStrokeCommit(
     ObservedPtr<CPDFSDK_Annot>* pAnnot,
-    CPDFSDK_PageView* pPageView,
+    const CPDFSDK_PageView* pPageView,
     uint32_t nFlag) {
   if (m_bNotifying)
     return true;
@@ -675,7 +676,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::OnValidate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                                            CPDFSDK_PageView* pPageView,
+                                            const CPDFSDK_PageView* pPageView,
                                             uint32_t nFlag) {
   if (m_bNotifying)
     return true;
@@ -706,7 +707,7 @@
 }
 
 void CFFL_InteractiveFormFiller::OnCalculate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                                             CPDFSDK_PageView* pPageView,
+                                             const CPDFSDK_PageView* pPageView,
                                              uint32_t nFlag) {
   if (m_bNotifying)
     return;
@@ -721,7 +722,7 @@
 }
 
 void CFFL_InteractiveFormFiller::OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                                          CPDFSDK_PageView* pPageView,
+                                          const CPDFSDK_PageView* pPageView,
                                           uint32_t nFlag) {
   if (m_bNotifying)
     return;
@@ -745,7 +746,7 @@
 
 #ifdef PDF_ENABLE_XFA
 bool CFFL_InteractiveFormFiller::OnClick(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                                         CPDFSDK_PageView* pPageView,
+                                         const CPDFSDK_PageView* pPageView,
                                          uint32_t nFlag) {
   if (m_bNotifying)
     return false;
@@ -776,7 +777,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::OnFull(ObservedPtr<CPDFSDK_Widget>* pAnnot,
-                                        CPDFSDK_PageView* pPageView,
+                                        const CPDFSDK_PageView* pPageView,
                                         uint32_t nFlag) {
   if (m_bNotifying)
     return false;
@@ -807,7 +808,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::OnPreOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                                           CPDFSDK_PageView* pPageView,
+                                           const CPDFSDK_PageView* pPageView,
                                            uint32_t nFlag) {
   if (m_bNotifying)
     return false;
@@ -838,7 +839,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::OnPostOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                                            CPDFSDK_PageView* pPageView,
+                                            const CPDFSDK_PageView* pPageView,
                                             uint32_t nFlag) {
   if (m_bNotifying)
     return false;
@@ -870,7 +871,8 @@
 }
 #endif  // PDF_ENABLE_XFA
 
-bool CFFL_InteractiveFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView,
+// static
+bool CFFL_InteractiveFormFiller::IsValidAnnot(const CPDFSDK_PageView* pPageView,
                                               CPDFSDK_Annot* pAnnot) {
   return pPageView && pPageView->IsValidAnnot(pAnnot->GetPDFAnnot());
 }
@@ -885,7 +887,7 @@
     uint32_t nFlag) {
   // Copy out of private data since the window owning it may not survive.
   auto* pPrivateData = static_cast<const CFFL_PrivateData*>(pAttached);
-  CPDFSDK_PageView* pPageView = pPrivateData->GetPageView();
+  const CPDFSDK_PageView* pPageView = pPrivateData->GetPageView();
   ObservedPtr<CPDFSDK_Widget> pWidget(pPrivateData->GetWidget());
   DCHECK(pWidget);
 
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 40b84f8..bbd3ebe 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -31,7 +31,7 @@
   bool Annot_HitTest(CPDFSDK_PageView* pPageView,
                      CPDFSDK_Annot* pAnnot,
                      const CFX_PointF& point);
-  FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
+  FX_RECT GetViewBBox(const CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
   void OnDraw(CPDFSDK_PageView* pPageView,
               CPDFSDK_Annot* pAnnot,
               CFX_RenderDevice* pDevice,
@@ -97,22 +97,23 @@
 
   static bool IsVisible(CPDFSDK_Widget* pWidget);
   static bool IsReadOnly(CPDFSDK_Widget* pWidget);
-  static bool IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
+  static bool IsValidAnnot(const CPDFSDK_PageView* pPageView,
+                           CPDFSDK_Annot* pAnnot);
 
   bool OnKeyStrokeCommit(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                         CPDFSDK_PageView* pPageView,
+                         const CPDFSDK_PageView* pPageView,
                          uint32_t nFlag);
   bool OnValidate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                  CPDFSDK_PageView* pPageView,
+                  const CPDFSDK_PageView* pPageView,
                   uint32_t nFlag);
   void OnCalculate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                   CPDFSDK_PageView* pPageView,
+                   const CPDFSDK_PageView* pPageView,
                    uint32_t nFlag);
   void OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                CPDFSDK_PageView* pPageView,
+                const CPDFSDK_PageView* pPageView,
                 uint32_t nFlag);
   bool OnButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                  CPDFSDK_PageView* pPageView,
+                  const CPDFSDK_PageView* pPageView,
                   uint32_t nFlag);
 
   bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
@@ -147,16 +148,16 @@
 #ifdef PDF_ENABLE_XFA
   void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, bool bSameField, bool bNext);
   bool OnClick(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-               CPDFSDK_PageView* pPageView,
+               const CPDFSDK_PageView* pPageView,
                uint32_t nFlag);
   bool OnFull(ObservedPtr<CPDFSDK_Widget>* pAnnot,
-              CPDFSDK_PageView* pPageView,
+              const CPDFSDK_PageView* pPageView,
               uint32_t nFlag);
   bool OnPreOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                 CPDFSDK_PageView* pPageView,
+                 const CPDFSDK_PageView* pPageView,
                  uint32_t nFlag);
   bool OnPostOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
-                  CPDFSDK_PageView* pPageView,
+                  const CPDFSDK_PageView* pPageView,
                   uint32_t nFlag);
 #endif  // PDF_ENABLE_XFA
 
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index ec67e0e..791d638 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -83,7 +83,7 @@
   return CFFL_TextObject::OnChar(pAnnot, nChar, nFlags);
 }
 
-bool CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
+bool CFFL_ListBox::IsDataChanged(const CPDFSDK_PageView* pPageView) {
   CPWL_ListBox* pListBox = GetListBox(pPageView);
   if (!pListBox)
     return false;
@@ -104,7 +104,7 @@
   return pListBox->GetCurSel() != m_pWidget->GetSelectedIndex(0);
 }
 
-void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) {
+void CFFL_ListBox::SaveData(const CPDFSDK_PageView* pPageView) {
   CPWL_ListBox* pListBox = GetListBox(pPageView);
   if (!pListBox)
     return;
@@ -136,7 +136,7 @@
   SetChangeMark();
 }
 
-void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView,
+void CFFL_ListBox::GetActionData(const CPDFSDK_PageView* pPageView,
                                  CPDF_AAction::AActionType type,
                                  CPDFSDK_FieldAction& fa) {
   switch (type) {
@@ -167,7 +167,7 @@
   }
 }
 
-void CFFL_ListBox::SavePWLWindowState(CPDFSDK_PageView* pPageView) {
+void CFFL_ListBox::SavePWLWindowState(const CPDFSDK_PageView* pPageView) {
   CPWL_ListBox* pListBox = GetListBox(pPageView);
   if (!pListBox)
     return;
@@ -179,7 +179,7 @@
 }
 
 void CFFL_ListBox::RecreatePWLWindowFromSavedState(
-    CPDFSDK_PageView* pPageView) {
+    const CPDFSDK_PageView* pPageView) {
   CPWL_ListBox* pListBox = CreateOrUpdateListBox(pPageView);
   if (!pListBox)
     return;
@@ -221,10 +221,12 @@
   return pListBox && pListBox->IsItemSelected(index);
 }
 
-CPWL_ListBox* CFFL_ListBox::GetListBox(CPDFSDK_PageView* pPageView) const {
+CPWL_ListBox* CFFL_ListBox::GetListBox(
+    const CPDFSDK_PageView* pPageView) const {
   return static_cast<CPWL_ListBox*>(GetPWLWindow(pPageView));
 }
 
-CPWL_ListBox* CFFL_ListBox::CreateOrUpdateListBox(CPDFSDK_PageView* pPageView) {
+CPWL_ListBox* CFFL_ListBox::CreateOrUpdateListBox(
+    const CPDFSDK_PageView* pPageView) {
   return static_cast<CPWL_ListBox*>(CreateOrUpdatePWLWindow(pPageView));
 }
diff --git a/fpdfsdk/formfiller/cffl_listbox.h b/fpdfsdk/formfiller/cffl_listbox.h
index 2c0a88e..2dbba24 100644
--- a/fpdfsdk/formfiller/cffl_listbox.h
+++ b/fpdfsdk/formfiller/cffl_listbox.h
@@ -27,19 +27,20 @@
       std::unique_ptr<IPWL_SystemHandler::PerWindowData> pAttachedData)
       override;
   bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
-  bool IsDataChanged(CPDFSDK_PageView* pPageView) override;
-  void SaveData(CPDFSDK_PageView* pPageView) override;
-  void GetActionData(CPDFSDK_PageView* pPageView,
+  bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
+  void SaveData(const CPDFSDK_PageView* pPageView) override;
+  void GetActionData(const CPDFSDK_PageView* pPageView,
                      CPDF_AAction::AActionType type,
                      CPDFSDK_FieldAction& fa) override;
-  void SavePWLWindowState(CPDFSDK_PageView* pPageView) override;
-  void RecreatePWLWindowFromSavedState(CPDFSDK_PageView* pPageView) override;
+  void SavePWLWindowState(const CPDFSDK_PageView* pPageView) override;
+  void RecreatePWLWindowFromSavedState(
+      const CPDFSDK_PageView* pPageView) override;
   bool SetIndexSelected(int index, bool selected) override;
   bool IsIndexSelected(int index) override;
 
  private:
-  CPWL_ListBox* GetListBox(CPDFSDK_PageView* pPageView) const;
-  CPWL_ListBox* CreateOrUpdateListBox(CPDFSDK_PageView* pPageView);
+  CPWL_ListBox* GetListBox(const CPDFSDK_PageView* pPageView) const;
+  CPWL_ListBox* CreateOrUpdateListBox(const CPDFSDK_PageView* pPageView);
 
   std::set<int> m_OriginSelections;
   std::vector<int> m_State;
diff --git a/fpdfsdk/formfiller/cffl_privatedata.cpp b/fpdfsdk/formfiller/cffl_privatedata.cpp
index 2f4c0d8..779ac17 100644
--- a/fpdfsdk/formfiller/cffl_privatedata.cpp
+++ b/fpdfsdk/formfiller/cffl_privatedata.cpp
@@ -10,7 +10,7 @@
 #include "third_party/base/ptr_util.h"
 
 CFFL_PrivateData::CFFL_PrivateData(CPDFSDK_Widget* pWidget,
-                                   CPDFSDK_PageView* pPageView,
+                                   const CPDFSDK_PageView* pPageView,
                                    uint32_t nAppearanceAge,
                                    uint32_t nValueAge)
     : m_pWidget(pWidget),
diff --git a/fpdfsdk/formfiller/cffl_privatedata.h b/fpdfsdk/formfiller/cffl_privatedata.h
index e6e17f0..5e32a71 100644
--- a/fpdfsdk/formfiller/cffl_privatedata.h
+++ b/fpdfsdk/formfiller/cffl_privatedata.h
@@ -19,7 +19,7 @@
 class CFFL_PrivateData final : public IPWL_SystemHandler::PerWindowData {
  public:
   CFFL_PrivateData(CPDFSDK_Widget* pWidget,
-                   CPDFSDK_PageView* pPageView,
+                   const CPDFSDK_PageView* pPageView,
                    uint32_t nAppearanceAge,
                    uint32_t nValueAge);
   CFFL_PrivateData& operator=(const CFFL_PrivateData& that) = delete;
@@ -29,7 +29,7 @@
   std::unique_ptr<IPWL_SystemHandler::PerWindowData> Clone() const override;
 
   CPDFSDK_Widget* GetWidget() const { return m_pWidget.Get(); }
-  CPDFSDK_PageView* GetPageView() const { return m_pPageView; }
+  const CPDFSDK_PageView* GetPageView() const { return m_pPageView; }
   bool AppearanceAgeEquals(uint32_t age) const {
     return age == m_nAppearanceAge;
   }
@@ -39,7 +39,7 @@
   CFFL_PrivateData(const CFFL_PrivateData& that);
 
   ObservedPtr<CPDFSDK_Widget> m_pWidget;
-  UnownedPtr<CPDFSDK_PageView> const m_pPageView;
+  UnownedPtr<const CPDFSDK_PageView> const m_pPageView;
   const uint32_t m_nAppearanceAge;
   const uint32_t m_nValueAge;
 };
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp
index 52fc5ec..bd37d9e 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.cpp
+++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp
@@ -84,12 +84,12 @@
   return CommitData(pPageView, nFlags);
 }
 
-bool CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) {
+bool CFFL_RadioButton::IsDataChanged(const CPDFSDK_PageView* pPageView) {
   CPWL_RadioButton* pWnd = GetRadioButton(pPageView);
   return pWnd && pWnd->IsChecked() != m_pWidget->IsChecked();
 }
 
-void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) {
+void CFFL_RadioButton::SaveData(const CPDFSDK_PageView* pPageView) {
   CPWL_RadioButton* pWnd = GetRadioButton(pPageView);
   if (!pWnd)
     return;
@@ -118,11 +118,11 @@
 }
 
 CPWL_RadioButton* CFFL_RadioButton::GetRadioButton(
-    CPDFSDK_PageView* pPageView) const {
+    const CPDFSDK_PageView* pPageView) const {
   return static_cast<CPWL_RadioButton*>(GetPWLWindow(pPageView));
 }
 
 CPWL_RadioButton* CFFL_RadioButton::CreateOrUpdateRadioButton(
-    CPDFSDK_PageView* pPageView) {
+    const CPDFSDK_PageView* pPageView) {
   return static_cast<CPWL_RadioButton*>(CreateOrUpdatePWLWindow(pPageView));
 }
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.h b/fpdfsdk/formfiller/cffl_radiobutton.h
index c077208..0c670af 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.h
+++ b/fpdfsdk/formfiller/cffl_radiobutton.h
@@ -29,12 +29,13 @@
                    CPDFSDK_Annot* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
-  bool IsDataChanged(CPDFSDK_PageView* pPageView) override;
-  void SaveData(CPDFSDK_PageView* pPageView) override;
+  bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
+  void SaveData(const CPDFSDK_PageView* pPageView) override;
 
  private:
-  CPWL_RadioButton* GetRadioButton(CPDFSDK_PageView* pPageView) const;
-  CPWL_RadioButton* CreateOrUpdateRadioButton(CPDFSDK_PageView* pPageView);
+  CPWL_RadioButton* GetRadioButton(const CPDFSDK_PageView* pPageView) const;
+  CPWL_RadioButton* CreateOrUpdateRadioButton(
+      const CPDFSDK_PageView* pPageView);
 };
 
 #endif  // FPDFSDK_FORMFILLER_CFFL_RADIOBUTTON_H_
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 73ec7b5..de6e70c 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -141,12 +141,12 @@
   return CFFL_TextObject::OnChar(pAnnot, nChar, nFlags);
 }
 
-bool CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) {
+bool CFFL_TextField::IsDataChanged(const CPDFSDK_PageView* pPageView) {
   CPWL_Edit* pEdit = GetEdit(pPageView);
   return pEdit && pEdit->GetText() != m_pWidget->GetValue();
 }
 
-void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) {
+void CFFL_TextField::SaveData(const CPDFSDK_PageView* pPageView) {
   CPWL_Edit* pWnd = GetEdit(pPageView);
   if (!pWnd)
     return;
@@ -170,7 +170,7 @@
   SetChangeMark();
 }
 
-void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView,
+void CFFL_TextField::GetActionData(const CPDFSDK_PageView* pPageView,
                                    CPDF_AAction::AActionType type,
                                    CPDFSDK_FieldAction& fa) {
   switch (type) {
@@ -200,7 +200,7 @@
   }
 }
 
-void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView,
+void CFFL_TextField::SetActionData(const CPDFSDK_PageView* pPageView,
                                    CPDF_AAction::AActionType type,
                                    const CPDFSDK_FieldAction& fa) {
   switch (type) {
@@ -216,7 +216,7 @@
   }
 }
 
-void CFFL_TextField::SavePWLWindowState(CPDFSDK_PageView* pPageView) {
+void CFFL_TextField::SavePWLWindowState(const CPDFSDK_PageView* pPageView) {
   CPWL_Edit* pWnd = GetEdit(pPageView);
   if (!pWnd)
     return;
@@ -226,7 +226,7 @@
 }
 
 void CFFL_TextField::RecreatePWLWindowFromSavedState(
-    CPDFSDK_PageView* pPageView) {
+    const CPDFSDK_PageView* pPageView) {
   CPWL_Edit* pWnd = CreateOrUpdateEdit(pPageView);
   if (!pWnd)
     return;
@@ -236,7 +236,7 @@
 }
 
 #ifdef PDF_ENABLE_XFA
-bool CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) {
+bool CFFL_TextField::IsFieldFull(const CPDFSDK_PageView* pPageView) {
   CPWL_Edit* pWnd = GetEdit(pPageView);
   return pWnd && pWnd->IsTextFull();
 }
@@ -253,10 +253,11 @@
   m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
 }
 
-CPWL_Edit* CFFL_TextField::GetEdit(CPDFSDK_PageView* pPageView) const {
+CPWL_Edit* CFFL_TextField::GetEdit(const CPDFSDK_PageView* pPageView) const {
   return static_cast<CPWL_Edit*>(GetPWLWindow(pPageView));
 }
 
-CPWL_Edit* CFFL_TextField::CreateOrUpdateEdit(CPDFSDK_PageView* pPageView) {
+CPWL_Edit* CFFL_TextField::CreateOrUpdateEdit(
+    const CPDFSDK_PageView* pPageView) {
   return static_cast<CPWL_Edit*>(CreateOrUpdatePWLWindow(pPageView));
 }
diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h
index 827a715..5d845be 100644
--- a/fpdfsdk/formfiller/cffl_textfield.h
+++ b/fpdfsdk/formfiller/cffl_textfield.h
@@ -32,26 +32,27 @@
       std::unique_ptr<IPWL_SystemHandler::PerWindowData> pAttachedData)
       override;
   bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
-  bool IsDataChanged(CPDFSDK_PageView* pPageView) override;
-  void SaveData(CPDFSDK_PageView* pPageView) override;
-  void GetActionData(CPDFSDK_PageView* pPageView,
+  bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
+  void SaveData(const CPDFSDK_PageView* pPageView) override;
+  void GetActionData(const CPDFSDK_PageView* pPageView,
                      CPDF_AAction::AActionType type,
                      CPDFSDK_FieldAction& fa) override;
-  void SetActionData(CPDFSDK_PageView* pPageView,
+  void SetActionData(const CPDFSDK_PageView* pPageView,
                      CPDF_AAction::AActionType type,
                      const CPDFSDK_FieldAction& fa) override;
-  void SavePWLWindowState(CPDFSDK_PageView* pPageView) override;
-  void RecreatePWLWindowFromSavedState(CPDFSDK_PageView* pPageView) override;
+  void SavePWLWindowState(const CPDFSDK_PageView* pPageView) override;
+  void RecreatePWLWindowFromSavedState(
+      const CPDFSDK_PageView* pPageView) override;
 #ifdef PDF_ENABLE_XFA
-  bool IsFieldFull(CPDFSDK_PageView* pPageView) override;
+  bool IsFieldFull(const CPDFSDK_PageView* pPageView) override;
 #endif
 
   // CPWL_Wnd::FocusHandlerIface:
   void OnSetFocus(CPWL_Edit* pEdit) override;
 
  private:
-  CPWL_Edit* GetEdit(CPDFSDK_PageView* pPageView) const;
-  CPWL_Edit* CreateOrUpdateEdit(CPDFSDK_PageView* pPageView);
+  CPWL_Edit* GetEdit(const CPDFSDK_PageView* pPageView) const;
+  CPWL_Edit* CreateOrUpdateEdit(const CPDFSDK_PageView* pPageView);
 
   FFL_TextFieldState m_State;
 };
diff --git a/fpdfsdk/formfiller/cffl_textobject.cpp b/fpdfsdk/formfiller/cffl_textobject.cpp
index a2e7a2e..66aff7c 100644
--- a/fpdfsdk/formfiller/cffl_textobject.cpp
+++ b/fpdfsdk/formfiller/cffl_textobject.cpp
@@ -19,14 +19,14 @@
   DestroyWindows();
 }
 
-CPWL_Wnd* CFFL_TextObject::ResetPWLWindow(CPDFSDK_PageView* pPageView) {
+CPWL_Wnd* CFFL_TextObject::ResetPWLWindow(const CPDFSDK_PageView* pPageView) {
   DestroyPWLWindow(pPageView);
   ObservedPtr<CPWL_Wnd> pRet(CreateOrUpdatePWLWindow(pPageView));
   m_pWidget->UpdateField();  // May invoke JS, invalidating |pRet|.
   return pRet.Get();
 }
 
-CPWL_Wnd* CFFL_TextObject::RestorePWLWindow(CPDFSDK_PageView* pPageView) {
+CPWL_Wnd* CFFL_TextObject::RestorePWLWindow(const CPDFSDK_PageView* pPageView) {
   SavePWLWindowState(pPageView);
   DestroyPWLWindow(pPageView);
   RecreatePWLWindowFromSavedState(pPageView);
diff --git a/fpdfsdk/formfiller/cffl_textobject.h b/fpdfsdk/formfiller/cffl_textobject.h
index f564886..7ea0809 100644
--- a/fpdfsdk/formfiller/cffl_textobject.h
+++ b/fpdfsdk/formfiller/cffl_textobject.h
@@ -18,8 +18,8 @@
 class CFFL_TextObject : public CFFL_FormField {
  public:
   // CFFL_FormField:
-  CPWL_Wnd* ResetPWLWindow(CPDFSDK_PageView* pPageView) override;
-  CPWL_Wnd* RestorePWLWindow(CPDFSDK_PageView* pPageView) override;
+  CPWL_Wnd* ResetPWLWindow(const CPDFSDK_PageView* pPageView) override;
+  CPWL_Wnd* RestorePWLWindow(const CPDFSDK_PageView* pPageView) override;
 
  protected:
   CFFL_TextObject(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget);