summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_widget.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-10 18:44:45 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-10 18:44:45 +0000
commit4f261fffddddd97602e88fe462fef1a18a0b4782 (patch)
treee3a93a859d189a5fe46791d7954396b2b394cbd4 /fpdfsdk/cpdfsdk_widget.cpp
parentb353f8c32b2d17cbea5ace6eb5f7edb8663e37be (diff)
downloadpdfium-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 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index c2a4754edc..fc848d5014 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -585,19 +585,17 @@ void CPDFSDK_Widget::ResetAppearance(bool bValueChanged) {
switch (GetFieldType()) {
case FormFieldType::kTextField:
case FormFieldType::kComboBox: {
- bool bFormatted = false;
- WideString sValue = OnFormat(bFormatted);
- ResetAppearance(bFormatted ? &sValue : nullptr, true);
+ ResetAppearance(OnFormat(), true);
break;
}
default:
- ResetAppearance(nullptr, false);
+ ResetAppearance(pdfium::nullopt, false);
break;
}
}
#endif // PDF_ENABLE_XFA
-void CPDFSDK_Widget::ResetAppearance(const WideString* sValue,
+void CPDFSDK_Widget::ResetAppearance(Optional<WideString> sValue,
bool bValueChanged) {
SetAppModified();
@@ -632,16 +630,17 @@ void CPDFSDK_Widget::ResetAppearance(const WideString* sValue,
m_pAnnot->ClearCachedAP();
}
-WideString CPDFSDK_Widget::OnFormat(bool& bFormatted) {
+Optional<WideString> CPDFSDK_Widget::OnFormat() {
CPDF_FormField* pFormField = GetFormField();
ASSERT(pFormField);
- return m_pInterForm->OnFormat(pFormField, bFormatted);
+ return m_pInterForm->OnFormat(pFormField);
}
void CPDFSDK_Widget::ResetFieldAppearance(bool bValueChanged) {
CPDF_FormField* pFormField = GetFormField();
ASSERT(pFormField);
- m_pInterForm->ResetFieldAppearance(pFormField, nullptr, bValueChanged);
+ m_pInterForm->ResetFieldAppearance(pFormField, pdfium::nullopt,
+ bValueChanged);
}
void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice,
@@ -700,7 +699,7 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice,
CFX_FloatRect CPDFSDK_Widget::GetClientRect() const {
CFX_FloatRect rcWindow = GetRotatedRect();
- float fBorderWidth = (float)GetBorderWidth();
+ float fBorderWidth = GetBorderWidth();
switch (GetBorderStyle()) {
case BorderStyle::BEVELED:
case BorderStyle::INSET: