Remove pageview arguments from some CFFL methods.
They are not required.
Change-Id: I4421bb4ed62b784bbdfc1ea3d1c75fec08f9b9b6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85031
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/formfiller/cffl_formfield.cpp b/fpdfsdk/formfiller/cffl_formfield.cpp
index 90196e2..5885d8f 100644
--- a/fpdfsdk/formfiller/cffl_formfield.cpp
+++ b/fpdfsdk/formfiller/cffl_formfield.cpp
@@ -495,11 +495,11 @@
if (!pObserved)
return false;
- pInteractiveFormFiller->OnCalculate(&pObserved, pPageView, nFlag);
+ pInteractiveFormFiller->OnCalculate(&pObserved);
if (!pObserved)
return false;
- pInteractiveFormFiller->OnFormat(&pObserved, pPageView, nFlag);
+ pInteractiveFormFiller->OnFormat(&pObserved);
if (!pObserved)
return false;
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 209c4c5..69b4613 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -35,8 +35,7 @@
CFFL_InteractiveFormFiller::~CFFL_InteractiveFormFiller() = default;
-bool CFFL_InteractiveFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+bool CFFL_InteractiveFormFiller::Annot_HitTest(const CPDFSDK_Annot* pAnnot,
const CFX_PointF& point) {
return pAnnot->GetRect().Contains(point);
}
@@ -173,7 +172,7 @@
CPDF_Annot::Subtype::WIDGET);
if (!m_bNotifying) {
CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
- if (Annot_HitTest(pPageView, pAnnot->Get(), point) &&
+ if (Annot_HitTest(pAnnot->Get(), point) &&
pWidget->GetAAction(CPDF_AAction::kButtonDown).GetDict()) {
m_bNotifying = true;
@@ -707,35 +706,27 @@
return fa.bRC;
}
-void CFFL_InteractiveFormFiller::OnCalculate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
- const CPDFSDK_PageView* pPageView,
- Mask<FWL_EVENTFLAG> nFlag) {
+void CFFL_InteractiveFormFiller::OnCalculate(
+ ObservedPtr<CPDFSDK_Annot>* pAnnot) {
if (m_bNotifying)
return;
CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
if (pWidget) {
- CPDFSDK_FormFillEnvironment* pOtherEnv = pPageView->GetFormFillEnv();
- CHECK_EQ(pOtherEnv, m_pFormFillEnv);
- CPDFSDK_InteractiveForm* pForm = pOtherEnv->GetInteractiveForm();
+ CPDFSDK_InteractiveForm* pForm = m_pFormFillEnv->GetInteractiveForm();
pForm->OnCalculate(pWidget->GetFormField());
}
m_bNotifying = false;
}
-void CFFL_InteractiveFormFiller::OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot,
- const CPDFSDK_PageView* pPageView,
- Mask<FWL_EVENTFLAG> nFlag) {
+void CFFL_InteractiveFormFiller::OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot) {
if (m_bNotifying)
return;
CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
DCHECK(pWidget);
- CPDFSDK_FormFillEnvironment* pOtherEnv = pPageView->GetFormFillEnv();
- CHECK_EQ(pOtherEnv, m_pFormFillEnv);
- CPDFSDK_InteractiveForm* pForm = pOtherEnv->GetInteractiveForm();
-
+ CPDFSDK_InteractiveForm* pForm = m_pFormFillEnv->GetInteractiveForm();
Optional<WideString> sValue = pForm->OnFormat(pWidget->GetFormField());
if (!pAnnot->HasObservable())
return;
@@ -744,7 +735,6 @@
pForm->ResetFieldAppearance(pWidget->GetFormField(), sValue);
pForm->UpdateField(pWidget->GetFormField());
}
-
m_bNotifying = false;
}
@@ -914,8 +904,6 @@
uint32_t nAge = pWidget->GetAppearanceAge();
uint32_t nValueAge = pWidget->GetValueAge();
- CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv();
- CHECK_EQ(pFormFillEnv, m_pFormFillEnv);
CFFL_FieldAction fa;
fa.bModifier = CPWL_Wnd::IsCTRLKeyDown(nFlag);
@@ -957,7 +945,7 @@
} else {
pFormField->RecreatePWLWindowFromSavedState(pPageView);
}
- if (pFormFillEnv->GetFocusAnnot() == pWidget)
+ if (m_pFormFillEnv->GetFocusAnnot() == pWidget)
return {false, bExit};
pFormField->CommitData(pPageView, nFlag);
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 9a282df..b614525 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -30,15 +30,13 @@
CPDFSDK_FormFillEnvironment* pFormFillEnv);
~CFFL_InteractiveFormFiller() override;
- bool Annot_HitTest(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- const CFX_PointF& point);
+ bool Annot_HitTest(const CPDFSDK_Annot* pAnnot, const CFX_PointF& point);
FX_RECT GetViewBBox(const CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
+
void OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device);
-
void OnDelete(CPDFSDK_Annot* pAnnot);
void OnMouseEnter(CPDFSDK_PageView* pPageView,
@@ -114,12 +112,8 @@
bool OnValidate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
const CPDFSDK_PageView* pPageView,
Mask<FWL_EVENTFLAG> nFlag);
- void OnCalculate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
- const CPDFSDK_PageView* pPageView,
- Mask<FWL_EVENTFLAG> nFlag);
- void OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot,
- const CPDFSDK_PageView* pPageView,
- Mask<FWL_EVENTFLAG> nFlag);
+ void OnCalculate(ObservedPtr<CPDFSDK_Annot>* pAnnot);
+ void OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot);
bool OnButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
const CPDFSDK_PageView* pPageView,
Mask<FWL_EVENTFLAG> nFlag);