summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-08-16 16:37:56 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-17 15:55:34 +0000
commit022b4397f98e7bb6d283918c836a4d1d386ac9cc (patch)
tree645644fa307060b6b2729c6fbac7c53054cc61ba /xfa/fwl
parente30e9cc05b62b046e5299ecc058957d93d2c68ea (diff)
downloadpdfium-022b4397f98e7bb6d283918c836a4d1d386ac9cc.tar.xz
Cleanup CFDE_TxtEdtEngine Insert and Delete methods
This CL cleans up CFDE_TxtEdtEngine::{Insert|Delete} to cleanup return values, input params and other unused bits. Change-Id: I53c4475ce3dc6518058bc130e9710842df841032 Reviewed-on: https://pdfium-review.googlesource.com/11273 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/cfwl_edit.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 7dd8baded8..38f8f70498 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -347,14 +347,12 @@ bool CFWL_Edit::Cut(CFX_WideString& wsCut) {
wsCut += wsTemp;
wsTemp.clear();
}
- m_EdtEngine.Delete(0, false);
+ m_EdtEngine.Delete(false);
return true;
}
bool CFWL_Edit::Paste(const CFX_WideString& wsPaste) {
- int32_t nCaret = m_EdtEngine.GetCaretPos();
- int32_t iError =
- m_EdtEngine.Insert(nCaret, wsPaste.c_str(), wsPaste.GetLength());
+ int32_t iError = m_EdtEngine.Insert(wsPaste);
if (iError < 0) {
ProcessInsertError(iError);
return false;
@@ -1195,6 +1193,9 @@ void CFWL_Edit::ClearRecord() {
}
void CFWL_Edit::ProcessInsertError(int32_t iError) {
+ // TODO(dsinclair): This should probably also send events for Validation
+ // failure ....
+
if (iError != -2)
return;
@@ -1422,11 +1423,11 @@ void CFWL_Edit::OnKeyDown(CFWL_MessageKey* pMsg) {
(m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) {
break;
}
- int32_t nCaret = m_EdtEngine.GetCaretPos();
+
#if (_FX_OS_ == _FX_MACOSX_)
- m_EdtEngine.Delete(nCaret, true);
+ m_EdtEngine.Delete(true);
#else
- m_EdtEngine.Delete(nCaret, false);
+ m_EdtEngine.Delete(false);
#endif
break;
}
@@ -1447,21 +1448,20 @@ void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) {
int32_t iError = 0;
wchar_t c = static_cast<wchar_t>(pMsg->m_dwKeyCode);
- int32_t nCaret = m_EdtEngine.GetCaretPos();
switch (c) {
case FWL_VKEY_Back:
- m_EdtEngine.Delete(nCaret, true);
+ m_EdtEngine.Delete(true);
break;
case FWL_VKEY_NewLine:
case FWL_VKEY_Escape:
break;
case FWL_VKEY_Tab: {
- iError = m_EdtEngine.Insert(nCaret, L"\t", 1);
+ iError = m_EdtEngine.Insert(L"\t");
break;
}
case FWL_VKEY_Return: {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_WantReturn) {
- iError = m_EdtEngine.Insert(nCaret, L"\n", 1);
+ iError = m_EdtEngine.Insert(L"\n");
}
break;
}
@@ -1485,7 +1485,7 @@ void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) {
{
break;
}
- iError = m_EdtEngine.Insert(nCaret, &c, 1);
+ iError = m_EdtEngine.Insert(CFX_WideString(c));
break;
}
}