summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_widget.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-13 06:46:40 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-13 06:46:40 -0700
commit067990ccf96ae962392a2dbacbfd8348dc4c7676 (patch)
tree5e6a1d32d1b19bc2f7ff4197693d8612737342fc /fpdfsdk/cpdfsdk_widget.cpp
parentbb8935e9def5ad865be613eebea597a77fc7c547 (diff)
downloadpdfium-067990ccf96ae962392a2dbacbfd8348dc4c7676.tar.xz
Stop converting widestring -> c_str -> widestring in several places.
Avoids a needless alloc and copy. Review-Url: https://codereview.chromium.org/2338553002
Diffstat (limited to 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index a8ebef6e99..016e78a848 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -1391,9 +1391,9 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) {
} else {
int32_t nCurSel = pField->GetSelectedIndex(0);
if (nCurSel < 0)
- pEdit->SetText(pField->GetValue().c_str());
+ pEdit->SetText(pField->GetValue());
else
- pEdit->SetText(pField->GetOptionLabel(nCurSel).c_str());
+ pEdit->SetText(pField->GetOptionLabel(nCurSel));
}
CFX_FloatRect rcContent = pEdit->GetContentRect();
@@ -1462,7 +1462,7 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
}
}
- pEdit->SetText(pField->GetOptionLabel(i).c_str());
+ pEdit->SetText(pField->GetOptionLabel(i));
CFX_FloatRect rcContent = pEdit->GetContentRect();
FX_FLOAT fItemHeight = rcContent.Height();
@@ -1578,14 +1578,9 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) {
pEdit->SetFontSize(fFontSize);
pEdit->Initialize();
-
- if (sValue)
- pEdit->SetText(*sValue);
- else
- pEdit->SetText(pField->GetValue().c_str());
+ pEdit->SetText(sValue ? *sValue : pField->GetValue());
CFX_FloatRect rcContent = pEdit->GetContentRect();
-
CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(
pEdit.get(), CFX_FloatPoint(0.0f, 0.0f), nullptr, !bCharArray, subWord);