diff options
author | tsepez <tsepez@chromium.org> | 2016-09-13 06:46:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-13 06:46:40 -0700 |
commit | 067990ccf96ae962392a2dbacbfd8348dc4c7676 (patch) | |
tree | 5e6a1d32d1b19bc2f7ff4197693d8612737342fc /fpdfsdk/pdfwindow/PWL_Edit.cpp | |
parent | bb8935e9def5ad865be613eebea597a77fc7c547 (diff) | |
download | pdfium-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/pdfwindow/PWL_Edit.cpp')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index 1aa7b5eb5a..c85993b9cb 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -38,12 +38,10 @@ CFX_ByteString CPWL_Edit::GetClassName() const { void CPWL_Edit::OnDestroy() {} -void CPWL_Edit::SetText(const FX_WCHAR* csText) { +void CPWL_Edit::SetText(const CFX_WideString& csText) { CFX_WideString swText = csText; - if (HasFlag(PES_RICH)) { CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText); - if (CXML_Element* pXML = CXML_Element::Parse(sValue.c_str(), sValue.GetLength())) { int32_t nCount = pXML->CountChildren(); @@ -74,7 +72,7 @@ void CPWL_Edit::SetText(const FX_WCHAR* csText) { } } - m_pEdit->SetText(swText.c_str()); + m_pEdit->SetText(swText); } void CPWL_Edit::RePosChildWnd() { @@ -571,9 +569,9 @@ void CPWL_Edit::SetLimitChar(int32_t nLimitChar) { m_pEdit->SetLimitChar(nLimitChar); } -void CPWL_Edit::ReplaceSel(const FX_WCHAR* csText) { +void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) { m_pEdit->Clear(); - m_pEdit->InsertText(csText, DEFAULT_CHARSET); + m_pEdit->InsertText(wsText, DEFAULT_CHARSET); } CFX_FloatRect CPWL_Edit::GetFocusRect() const { |