summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-16 20:53:58 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-16 20:53:58 +0000
commitb2e6b4c44a38ea2ca9e021df31cd27eb67a45e35 (patch)
tree8e9392c73c3905d38d9e9e636adf8df9c7af072e /fxjs
parentaa987a9a895d42749c0f5e4092618fe7ded6667e (diff)
downloadpdfium-b2e6b4c44a38ea2ca9e021df31cd27eb67a45e35.tar.xz
Replace optional bool bNotify with enum type.
Adds clarity to the call sites. Change-Id: Id4deed9adda2ad79f0847d618792429044d4f7d6 Reviewed-on: https://pdfium-review.googlesource.com/40351 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cjs_document.cpp4
-rw-r--r--fxjs/cjs_field.cpp20
2 files changed, 13 insertions, 11 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 7e89e40230..a6d68c8d29 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -465,7 +465,7 @@ CJS_Return CJS_Document::resetForm(
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
if (params.empty()) {
- pPDFForm->ResetForm(true);
+ pPDFForm->ResetForm(NotificationOption::kNotify);
m_pFormFillEnv->SetChangeMark();
return CJS_Return();
}
@@ -487,7 +487,7 @@ CJS_Return CJS_Document::resetForm(
}
if (!aFields.empty()) {
- pPDFForm->ResetForm(aFields, true, true);
+ pPDFForm->ResetForm(aFields, true, NotificationOption::kNotify);
m_pFormFillEnv->SetChangeMark();
}
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index 45715e22a0..a14e16828a 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -254,13 +254,14 @@ void SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv,
continue;
uint32_t dwFieldFlags = pFormField->GetFieldFlags();
- pFormField->ClearSelection(true);
+ pFormField->ClearSelection(NotificationOption::kNotify);
for (size_t i = 0; i < array.size(); ++i) {
if (i != 0 && !(dwFieldFlags & (1 << 21)))
break;
if (array[i] < static_cast<uint32_t>(pFormField->CountOptions()) &&
!pFormField->IsItemSelected(array[i])) {
- pFormField->SetItemSelection(array[i], true);
+ pFormField->SetItemSelection(array[i], true,
+ NotificationOption::kDoNotNotify);
}
}
UpdateFormField(pFormFillEnv, pFormField, true, true, true);
@@ -427,14 +428,14 @@ void SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
case FormFieldType::kTextField:
case FormFieldType::kComboBox:
if (pFormField->GetValue() != strArray[0]) {
- pFormField->SetValue(strArray[0], true);
+ pFormField->SetValue(strArray[0], NotificationOption::kNotify);
UpdateFormField(pFormFillEnv, pFormField, true, false, true);
}
break;
case FormFieldType::kCheckBox:
case FormFieldType::kRadioButton:
if (pFormField->GetValue() != strArray[0]) {
- pFormField->SetValue(strArray[0], true);
+ pFormField->SetValue(strArray[0], NotificationOption::kNotify);
UpdateFormField(pFormFillEnv, pFormField, true, false, true);
}
break;
@@ -447,11 +448,12 @@ void SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
}
}
if (bModified) {
- pFormField->ClearSelection(true);
+ pFormField->ClearSelection(NotificationOption::kNotify);
for (const auto& str : strArray) {
int index = pFormField->FindOption(str);
if (!pFormField->IsItemSelected(index))
- pFormField->SetItemSelection(index, true, true);
+ pFormField->SetItemSelection(index, true,
+ NotificationOption::kNotify);
}
UpdateFormField(pFormFillEnv, pFormField, true, false, true);
}
@@ -2212,7 +2214,7 @@ CJS_Return CJS_Field::browseForFileToSubmit(
(pFormField->GetFieldType() == FormFieldType::kTextField)) {
WideString wsFileName = m_pFormFillEnv->JS_fieldBrowse();
if (!wsFileName.IsEmpty()) {
- pFormField->SetValue(wsFileName);
+ pFormField->SetValue(wsFileName, NotificationOption::kDoNotNotify);
UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true);
}
return CJS_Return();
@@ -2323,13 +2325,13 @@ CJS_Return CJS_Field::checkThisBox(
if (!IsCheckBoxOrRadioButton(pFormField))
return CJS_Return(JSMessage::kObjectTypeError);
+
if (nWidget < 0 || nWidget >= pFormField->CountControls())
return CJS_Return(JSMessage::kValueError);
// TODO(weili): Check whether anything special needed for radio button.
// (When pFormField->GetFieldType() == FormFieldType::kRadioButton.)
- pFormField->CheckControl(nWidget, bCheckit, true);
-
+ pFormField->CheckControl(nWidget, bCheckit, NotificationOption::kNotify);
UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true);
return CJS_Return();
}