Remove always-kNotify argument from ResetForm() / ResetField().
Change-Id: Ib35430f821263a8c93ddd0c972d825493d75f0ab
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79512
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index eb58655..f4bc700 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -145,7 +145,7 @@
return GetFullNameForDict(m_pDict.Get());
}
-bool CPDF_FormField::ResetField(NotificationOption notify) {
+bool CPDF_FormField::ResetField() {
switch (m_Type) {
case kCheckBox:
case kRadioButton: {
@@ -156,7 +156,7 @@
CheckControl(i, GetControl(i)->IsDefaultChecked(),
NotificationOption::kDoNotNotify);
}
- if (notify == NotificationOption::kNotify && m_pForm->GetFormNotify())
+ if (m_pForm->GetFormNotify())
m_pForm->GetFormNotify()->AfterCheckedStatusChange(this);
break;
}
@@ -167,13 +167,11 @@
int iIndex = GetDefaultSelectedItem();
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
- if (notify == NotificationOption::kNotify &&
- !NotifyListOrComboBoxBeforeChange(csValue)) {
+ if (!NotifyListOrComboBoxBeforeChange(csValue)) {
return false;
}
SetItemSelection(iIndex, NotificationOption::kDoNotNotify);
- if (notify == NotificationOption::kNotify)
- NotifyListOrComboBoxAfterChange();
+ NotifyListOrComboBoxAfterChange();
break;
}
case kText:
@@ -197,8 +195,7 @@
if (!bHasRV && (csDValue == csValue))
return false;
- if (notify == NotificationOption::kNotify &&
- !NotifyBeforeValueChange(csDValue)) {
+ if (!NotifyBeforeValueChange(csDValue)) {
return false;
}
if (pDV) {
@@ -214,8 +211,7 @@
m_pDict->RemoveFor(pdfium::form_fields::kV);
m_pDict->RemoveFor("RV");
}
- if (notify == NotificationOption::kNotify)
- NotifyAfterValueChange();
+ NotifyAfterValueChange();
break;
}
}
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index cd2c823..727c556 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -85,7 +85,7 @@
Type GetType() const { return m_Type; }
CPDF_Dictionary* GetFieldDict() const { return m_pDict.Get(); }
- bool ResetField(NotificationOption notify);
+ bool ResetField();
int CountControls() const;
CPDF_FormControl* GetControl(int index) const;
diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp
index c33549a..4a4c69b 100644
--- a/core/fpdfdoc/cpdf_interactiveform.cpp
+++ b/core/fpdfdoc/cpdf_interactiveform.cpp
@@ -741,8 +741,7 @@
}
void CPDF_InteractiveForm::ResetForm(const std::vector<CPDF_FormField*>& fields,
- bool bIncludeOrExclude,
- NotificationOption notify) {
+ bool bIncludeOrExclude) {
size_t nCount = m_pFieldTree->m_Root.CountFields();
for (size_t i = 0; i < nCount; ++i) {
CPDF_FormField* pField = m_pFieldTree->m_Root.GetFieldAtIndex(i);
@@ -750,22 +749,22 @@
continue;
if (bIncludeOrExclude == pdfium::Contains(fields, pField))
- pField->ResetField(notify);
+ pField->ResetField();
}
- if (notify == NotificationOption::kNotify && m_pFormNotify)
+ if (m_pFormNotify)
m_pFormNotify->AfterFormReset(this);
}
-void CPDF_InteractiveForm::ResetForm(NotificationOption notify) {
+void CPDF_InteractiveForm::ResetForm() {
size_t nCount = m_pFieldTree->m_Root.CountFields();
for (size_t i = 0; i < nCount; ++i) {
CPDF_FormField* pField = m_pFieldTree->m_Root.GetFieldAtIndex(i);
if (!pField)
continue;
- pField->ResetField(notify);
+ pField->ResetField();
}
- if (notify == NotificationOption::kNotify && m_pFormNotify)
+ if (m_pFormNotify)
m_pFormNotify->AfterFormReset(this);
}
diff --git a/core/fpdfdoc/cpdf_interactiveform.h b/core/fpdfdoc/cpdf_interactiveform.h
index c299f52..f27ac32 100644
--- a/core/fpdfdoc/cpdf_interactiveform.h
+++ b/core/fpdfdoc/cpdf_interactiveform.h
@@ -84,12 +84,11 @@
bool bIncludeOrExclude,
bool bSimpleFileSpec) const;
- void ResetForm(NotificationOption notify);
+ void ResetForm();
// TODO(tsepez): Use a span.
void ResetForm(const std::vector<CPDF_FormField*>& fields,
- bool bIncludeOrExclude,
- NotificationOption notify);
+ bool bIncludeOrExclude);
void SetNotifierIface(NotifierIface* pNotify);
void FixPageFields(CPDF_Page* pPage);
diff --git a/fpdfsdk/cpdfsdk_interactiveform.cpp b/fpdfsdk/cpdfsdk_interactiveform.cpp
index 47c2f28..d6d23b1 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.cpp
+++ b/fpdfsdk/cpdfsdk_interactiveform.cpp
@@ -493,14 +493,13 @@
DCHECK(action.GetDict());
const CPDF_Dictionary* pActionDict = action.GetDict();
if (!pActionDict->KeyExist("Fields")) {
- m_pInteractiveForm->ResetForm(NotificationOption::kNotify);
+ m_pInteractiveForm->ResetForm();
return;
}
uint32_t dwFlags = action.GetFlags();
std::vector<CPDF_FormField*> fields =
GetFieldFromObjects(action.GetAllFields());
- m_pInteractiveForm->ResetForm(fields, !(dwFlags & 0x01),
- NotificationOption::kNotify);
+ m_pInteractiveForm->ResetForm(fields, !(dwFlags & 0x01));
}
std::vector<CPDF_FormField*> CPDFSDK_InteractiveForm::GetFieldFromObjects(
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 91f6eb5..ccfdc36 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -523,7 +523,7 @@
CPDF_InteractiveForm* pPDFForm = GetCoreInteractiveForm();
if (params.empty()) {
- pPDFForm->ResetForm(NotificationOption::kNotify);
+ pPDFForm->ResetForm();
m_pFormFillEnv->SetChangeMark();
return CJS_Result::Success();
}
@@ -545,7 +545,7 @@
}
if (!aFields.empty()) {
- pPDFForm->ResetForm(aFields, true, NotificationOption::kNotify);
+ pPDFForm->ResetForm(aFields, true);
m_pFormFillEnv->SetChangeMark();
}