summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-07-06 13:56:04 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-06 21:25:37 +0000
commitd97f2eee71036c09823dea18b2c5f74731317fe9 (patch)
tree9005cf83e67dad2a0e690772f2a345ba3f7e022d /fpdfsdk/formfiller
parent1f9d2338feb75d62bb28e116df7243dd567fded8 (diff)
downloadpdfium-d97f2eee71036c09823dea18b2c5f74731317fe9.tar.xz
Convert OnBeforeKeyStoke to remove in-out param
This CL removes the in-out params from OnBeforeKeyStroke and instead returns a std::pair<bool, bool>. Change-Id: I246cf51652da7e05ea71f582b523aa428cbbd3b8 Reviewed-on: https://pdfium-review.googlesource.com/7337 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp33
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.h18
2 files changed, 23 insertions, 28 deletions
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index d318111ee6..d718e7ca40 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -839,16 +839,16 @@ bool CFFL_InteractiveFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView,
return pPageView && pPageView->IsValidAnnot(pAnnot->GetPDFAnnot());
}
-void CFFL_InteractiveFormFiller::OnBeforeKeyStroke(
+std::pair<bool, bool> CFFL_InteractiveFormFiller::OnBeforeKeyStroke(
void* pPrivateData,
CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
int nSelStart,
int nSelEnd,
bool bKeyDown,
- bool& bRC,
- bool& bExit,
uint32_t nFlag) {
+ bool bRC = true;
+ bool bExit = false;
CFFL_PrivateData* pData = reinterpret_cast<CFFL_PrivateData*>(pPrivateData);
ASSERT(pData->pWidget);
@@ -857,18 +857,15 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke(
#ifdef PDF_ENABLE_XFA
if (pFormFiller->IsFieldFull(pData->pPageView)) {
CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget);
- if (OnFull(&pObserved, pData->pPageView, nFlag) || !pObserved) {
- bExit = true;
- return;
- }
+ if (OnFull(&pObserved, pData->pPageView, nFlag) || !pObserved)
+ return {bRC, true};
}
#endif // PDF_ENABLE_XFA
- if (m_bNotifying)
- return;
-
- if (!pData->pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict())
- return;
+ if (m_bNotifying ||
+ !pData->pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) {
+ return {bRC, bExit};
+ }
CFX_AutoRestorer<bool> restorer(&m_bNotifying);
m_bNotifying = true;
@@ -897,13 +894,11 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke(
pData->pPageView)) {
if (!IsValidAnnot(pData->pPageView, pData->pWidget))
bExit = true;
- return;
+ return {bRC, bExit};
}
- if (!pObserved || !IsValidAnnot(pData->pPageView, pData->pWidget)) {
- bExit = true;
- return;
- }
+ if (!pObserved || !IsValidAnnot(pData->pPageView, pData->pWidget))
+ return {bRC, true};
if (nAge != pData->pWidget->GetAppearanceAge()) {
CPWL_Wnd* pWnd = pFormFiller->ResetPDFWindow(
@@ -919,8 +914,8 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke(
bRC = false;
if (pFormFillEnv->GetFocusAnnot() == pData->pWidget)
- return;
+ return {bRC, bExit};
pFormFiller->CommitData(pData->pPageView, nFlag);
- bExit = true;
+ return {bRC, true};
}
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 05fdf0d6c7..fb141e17a4 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -9,6 +9,7 @@
#include <map>
#include <memory>
+#include <utility>
#include "core/fxcrt/cfx_unowned_ptr.h"
#include "fpdfsdk/cpdfsdk_annot.h"
@@ -129,15 +130,14 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify {
float fPopupMax,
bool* bBottom,
float* fPopupRet) override;
- void OnBeforeKeyStroke(void* pPrivateData,
- CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
- int nSelStart,
- int nSelEnd,
- bool bKeyDown,
- bool& bRC,
- bool& bExit,
- uint32_t nFlag) override;
+ // Returns {bRC, bExit}.
+ std::pair<bool, bool> OnBeforeKeyStroke(void* pPrivateData,
+ CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ int nSelStart,
+ int nSelEnd,
+ bool bKeyDown,
+ uint32_t nFlag) override;
#ifdef PDF_ENABLE_XFA
bool OnPopupPreOpen(void* pPrivateData, uint32_t nFlag) override;
bool OnPopupPostOpen(void* pPrivateData, uint32_t nFlag) override;