Use better names for CFFL_FormField::SaveState() and RestoreState().
Specify that it is information about the PWL window that is
being acted upon.
Change-Id: Idf509c0618b091ded3b6868ae54c1f253a39f9a1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/81233
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 030f65f..bf83b41 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -166,7 +166,7 @@
}
}
-void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView) {
+void CFFL_ComboBox::SavePWLWindowState(CPDFSDK_PageView* pPageView) {
CPWL_ComboBox* pComboBox = GetComboBox(pPageView);
if (!pComboBox)
return;
@@ -181,7 +181,8 @@
m_State.sValue = pEdit->GetText();
}
-void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) {
+void CFFL_ComboBox::RecreatePWLWindowFromSavedState(
+ CPDFSDK_PageView* pPageView) {
CPWL_ComboBox* pComboBox = CreateOrUpdateComboBox(pPageView);
if (!pComboBox)
return;
diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h
index 02ba37c..50f0c14 100644
--- a/fpdfsdk/formfiller/cffl_combobox.h
+++ b/fpdfsdk/formfiller/cffl_combobox.h
@@ -42,8 +42,8 @@
void SetActionData(CPDFSDK_PageView* pPageView,
CPDF_AAction::AActionType type,
const CPDFSDK_FieldAction& fa) override;
- void SaveState(CPDFSDK_PageView* pPageView) override;
- void RestoreState(CPDFSDK_PageView* pPageView) override;
+ void SavePWLWindowState(CPDFSDK_PageView* pPageView) override;
+ void RecreatePWLWindowFromSavedState(CPDFSDK_PageView* pPageView) override;
bool SetIndexSelected(int index, bool selected) override;
bool IsIndexSelected(int index) override;
#ifdef PDF_ENABLE_XFA
diff --git a/fpdfsdk/formfiller/cffl_formfield.cpp b/fpdfsdk/formfiller/cffl_formfield.cpp
index c87e31c..263e8ec 100644
--- a/fpdfsdk/formfiller/cffl_formfield.cpp
+++ b/fpdfsdk/formfiller/cffl_formfield.cpp
@@ -525,9 +525,10 @@
CPDF_AAction::AActionType type,
const CPDFSDK_FieldAction& fa) {}
-void CFFL_FormField::SaveState(CPDFSDK_PageView* pPageView) {}
+void CFFL_FormField::SavePWLWindowState(CPDFSDK_PageView* pPageView) {}
-void CFFL_FormField::RestoreState(CPDFSDK_PageView* pPageView) {}
+void CFFL_FormField::RecreatePWLWindowFromSavedState(
+ CPDFSDK_PageView* pPageView) {}
CPWL_Wnd* CFFL_FormField::ResetPWLWindowForValueAge(CPDFSDK_PageView* pPageView,
CPDFSDK_Widget* pWidget,
diff --git a/fpdfsdk/formfiller/cffl_formfield.h b/fpdfsdk/formfiller/cffl_formfield.h
index e7e6b88..a33107c 100644
--- a/fpdfsdk/formfiller/cffl_formfield.h
+++ b/fpdfsdk/formfiller/cffl_formfield.h
@@ -103,8 +103,8 @@
virtual std::unique_ptr<CPWL_Wnd> NewPWLWindow(
const CPWL_Wnd::CreateParams& cp,
std::unique_ptr<IPWL_SystemHandler::PerWindowData> pAttachedData) = 0;
- virtual void SaveState(CPDFSDK_PageView* pPageView);
- virtual void RestoreState(CPDFSDK_PageView* pPageView);
+ virtual void SavePWLWindowState(CPDFSDK_PageView* pPageView);
+ virtual void RecreatePWLWindowFromSavedState(CPDFSDK_PageView* pPageView);
virtual bool IsDataChanged(CPDFSDK_PageView* pPageView);
virtual void SaveData(CPDFSDK_PageView* pPageView);
#ifdef PDF_ENABLE_XFA
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 5728bdb..702238c 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -665,7 +665,7 @@
CFFL_FormField* pFormField = GetFormField(pWidget);
pFormField->GetActionData(pPageView, CPDF_AAction::kKeyStroke, fa);
- pFormField->SaveState(pPageView);
+ pFormField->SavePWLWindowState(pPageView);
pWidget->OnAAction(CPDF_AAction::kKeyStroke, &fa, pPageView);
if (!pAnnot->HasObservable())
return true;
@@ -696,7 +696,7 @@
CFFL_FormField* pFormField = GetFormField(pWidget);
pFormField->GetActionData(pPageView, CPDF_AAction::kValidate, fa);
- pFormField->SaveState(pPageView);
+ pFormField->SavePWLWindowState(pPageView);
pWidget->OnAAction(CPDF_AAction::kValidate, &fa, pPageView);
if (!pAnnot->HasObservable())
return true;
@@ -921,7 +921,7 @@
fa.nSelStart = nSelStart;
fa.nSelEnd = nSelEnd;
pFormField->GetActionData(pPageView, CPDF_AAction::kKeyStroke, fa);
- pFormField->SaveState(pPageView);
+ pFormField->SavePWLWindowState(pPageView);
bool action_status =
pWidget->OnAAction(CPDF_AAction::kKeyStroke, &fa, pPageView);
@@ -948,7 +948,7 @@
if (fa.bRC) {
pFormField->SetActionData(pPageView, CPDF_AAction::kKeyStroke, fa);
} else {
- pFormField->RestoreState(pPageView);
+ pFormField->RecreatePWLWindowFromSavedState(pPageView);
}
if (pFormFillEnv->GetFocusAnnot() == pWidget)
return {false, bExit};
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index ac9362c..7185fa3 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -167,7 +167,7 @@
}
}
-void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView) {
+void CFFL_ListBox::SavePWLWindowState(CPDFSDK_PageView* pPageView) {
CPWL_ListBox* pListBox = GetListBox(pPageView);
if (!pListBox)
return;
@@ -178,7 +178,8 @@
}
}
-void CFFL_ListBox::RestoreState(CPDFSDK_PageView* pPageView) {
+void CFFL_ListBox::RecreatePWLWindowFromSavedState(
+ CPDFSDK_PageView* pPageView) {
CPWL_ListBox* pListBox = GetListBox(pPageView);
if (!pListBox)
return;
diff --git a/fpdfsdk/formfiller/cffl_listbox.h b/fpdfsdk/formfiller/cffl_listbox.h
index 7553de4..855915d 100644
--- a/fpdfsdk/formfiller/cffl_listbox.h
+++ b/fpdfsdk/formfiller/cffl_listbox.h
@@ -32,8 +32,8 @@
void GetActionData(CPDFSDK_PageView* pPageView,
CPDF_AAction::AActionType type,
CPDFSDK_FieldAction& fa) override;
- void SaveState(CPDFSDK_PageView* pPageView) override;
- void RestoreState(CPDFSDK_PageView* pPageView) override;
+ void SavePWLWindowState(CPDFSDK_PageView* pPageView) override;
+ void RecreatePWLWindowFromSavedState(CPDFSDK_PageView* pPageView) override;
bool SetIndexSelected(int index, bool selected) override;
bool IsIndexSelected(int index) override;
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 5f5a84f..73ec7b5 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -216,7 +216,7 @@
}
}
-void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) {
+void CFFL_TextField::SavePWLWindowState(CPDFSDK_PageView* pPageView) {
CPWL_Edit* pWnd = GetEdit(pPageView);
if (!pWnd)
return;
@@ -225,7 +225,8 @@
m_State.sValue = pWnd->GetText();
}
-void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) {
+void CFFL_TextField::RecreatePWLWindowFromSavedState(
+ CPDFSDK_PageView* pPageView) {
CPWL_Edit* pWnd = CreateOrUpdateEdit(pPageView);
if (!pWnd)
return;
diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h
index 4ae5b2a..827a715 100644
--- a/fpdfsdk/formfiller/cffl_textfield.h
+++ b/fpdfsdk/formfiller/cffl_textfield.h
@@ -40,8 +40,8 @@
void SetActionData(CPDFSDK_PageView* pPageView,
CPDF_AAction::AActionType type,
const CPDFSDK_FieldAction& fa) override;
- void SaveState(CPDFSDK_PageView* pPageView) override;
- void RestoreState(CPDFSDK_PageView* pPageView) override;
+ void SavePWLWindowState(CPDFSDK_PageView* pPageView) override;
+ void RecreatePWLWindowFromSavedState(CPDFSDK_PageView* pPageView) override;
#ifdef PDF_ENABLE_XFA
bool IsFieldFull(CPDFSDK_PageView* pPageView) override;
#endif
diff --git a/fpdfsdk/formfiller/cffl_textobject.cpp b/fpdfsdk/formfiller/cffl_textobject.cpp
index 2f76f65..a2e7a2e 100644
--- a/fpdfsdk/formfiller/cffl_textobject.cpp
+++ b/fpdfsdk/formfiller/cffl_textobject.cpp
@@ -27,9 +27,9 @@
}
CPWL_Wnd* CFFL_TextObject::RestorePWLWindow(CPDFSDK_PageView* pPageView) {
- SaveState(pPageView);
+ SavePWLWindowState(pPageView);
DestroyPWLWindow(pPageView);
- RestoreState(pPageView);
+ RecreatePWLWindowFromSavedState(pPageView);
ObservedPtr<CPWL_Wnd> pRet(GetPWLWindow(pPageView));
m_pWidget->UpdateField(); // May invoke JS, invalidating |pRet|.
return pRet.Get();