diff options
author | Lei Zhang <thestig@chromium.org> | 2018-10-10 18:44:45 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-10 18:44:45 +0000 |
commit | 4f261fffddddd97602e88fe462fef1a18a0b4782 (patch) | |
tree | e3a93a859d189a5fe46791d7954396b2b394cbd4 /fxjs | |
parent | b353f8c32b2d17cbea5ace6eb5f7edb8663e37be (diff) | |
download | pdfium-4f261fffddddd97602e88fe462fef1a18a0b4782.tar.xz |
Get rid of non-const ref parameter in CPDFSDK_InterForm::OnFormat().
Return Optional<WideString> instead. Change the call stack to accept
Optional<WideString>.
Change-Id: I020589fac8a1de4974070268a19b4acad64c4092
Reviewed-on: https://pdfium-review.googlesource.com/c/43601
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/cjs_field.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp index 9c47e7033d..ef2a252b42 100644 --- a/fxjs/cjs_field.cpp +++ b/fxjs/cjs_field.cpp @@ -54,19 +54,17 @@ void UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv, if (IsComboBoxOrTextField(pFormField)) { for (auto& pObserved : widgets) { if (pObserved) { - bool bFormatted = false; - WideString sValue = - ToCPDFSDKWidget(pObserved.Get())->OnFormat(bFormatted); + Optional<WideString> sValue = + ToCPDFSDKWidget(pObserved.Get())->OnFormat(); if (pObserved) { // Not redundant, may be clobbered by OnFormat. - ToCPDFSDKWidget(pObserved.Get())->ResetAppearance( - bFormatted ? &sValue : nullptr, false); + ToCPDFSDKWidget(pObserved.Get())->ResetAppearance(sValue, false); } } } } else { for (auto& pObserved : widgets) { if (pObserved) - ToCPDFSDKWidget(pObserved.Get())->ResetAppearance(nullptr, false); + ToCPDFSDKWidget(pObserved.Get())->ResetAppearance({}, false); } } } @@ -110,13 +108,12 @@ void UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv, FormFieldType fieldType = pWidget->GetFieldType(); if (fieldType == FormFieldType::kComboBox || fieldType == FormFieldType::kTextField) { - bool bFormatted = false; - WideString sValue = pWidget->OnFormat(bFormatted); + Optional<WideString> sValue = pWidget->OnFormat(); if (!observed_widget) return; - pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, false); + pWidget->ResetAppearance(sValue, false); } else { - pWidget->ResetAppearance(nullptr, false); + pWidget->ResetAppearance({}, false); } if (!observed_widget) return; |