diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-07-06 11:04:01 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-06 19:10:57 +0000 |
commit | 64667cd369e13529be606077429fe4524dba0b24 (patch) | |
tree | 0a89ab8dff2efdb174c4492d72507da806a2b591 | |
parent | bdb965338673ca2bcef831f20e98b7965b39b2fb (diff) | |
download | pdfium-64667cd369e13529be606077429fe4524dba0b24.tar.xz |
Cleanup more in-out params in CFFL_InteractiveFormFiller.
This CL removes some in-out params which are always initialized with the
same value and we only case if either is true afterwards.
Change-Id: If164b1b50963958b931fb64d0f62f9170b27475b
Reviewed-on: https://pdfium-review.googlesource.com/7330
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 127 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.h | 16 |
2 files changed, 40 insertions, 103 deletions
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 96e7645fb6..4d5ceb8d16 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -251,8 +251,7 @@ bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, if (!pAnnot || bExit) return true; #ifdef PDF_ENABLE_XFA - OnClick(pAnnot, pPageView, bReset, bExit, nFlags); - if (!pAnnot || bExit) + if (OnClick(pAnnot, pPageView, nFlags) || !pAnnot) return true; #endif // PDF_ENABLE_XFA return bRet; @@ -699,17 +698,15 @@ void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot, } #ifdef PDF_ENABLE_XFA -void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, +bool CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return false; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_Click)) - return; + return false; m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -721,37 +718,25 @@ void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); m_bNotifying = false; - if (!(*pAnnot)) { - bExit = true; - return; - } - - if (!IsValidAnnot(pPageView, pWidget)) { - bExit = true; - return; - } - + if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) + return true; if (nAge == pWidget->GetAppearanceAge()) - return; + return false; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); - } - - bReset = true; + return false; } -void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, +bool CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return false; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_Full)) - return; + return false; m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -763,24 +748,15 @@ void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); m_bNotifying = false; - if (!(*pAnnot)) { - bExit = true; - return; - } - - if (!IsValidAnnot(pPageView, pWidget)) { - bExit = true; - return; - } - + if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) + return true; if (nAge == pWidget->GetAppearanceAge()) - return; + return false; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); - } - bReset = true; + return true; } void CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData, @@ -790,11 +766,8 @@ void CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData, ASSERT(pData); ASSERT(pData->pWidget); - bool bTempReset = false; - bool bTempExit = false; CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget); - OnPreOpen(&pObserved, pData->pPageView, bTempReset, bTempExit, nFlag); - if (!pObserved || bTempReset || bTempExit) + if (OnPreOpen(&pObserved, pData->pPageView, nFlag) || !pObserved) bExit = true; } @@ -805,25 +778,20 @@ void CFFL_InteractiveFormFiller::OnPopupPostOpen(void* pPrivateData, ASSERT(pData); ASSERT(pData->pWidget); - bool bTempReset = false; - bool bTempExit = false; CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget); - OnPostOpen(&pObserved, pData->pPageView, bTempReset, bTempExit, nFlag); - if (!pObserved || bTempReset || bTempExit) + if (OnPostOpen(&pObserved, pData->pPageView, nFlag) || !pObserved) bExit = true; } -void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, +bool CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return false; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) - return; + return false; m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -835,37 +803,26 @@ void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView); m_bNotifying = false; - if (!(*pAnnot)) { - bExit = true; - return; - } - - if (!IsValidAnnot(pPageView, pWidget)) { - bExit = true; - return; - } - + if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) + return true; if (nAge == pWidget->GetAppearanceAge()) - return; + return false; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); - } - bReset = true; + return true; } -void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, +bool CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return false; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) - return; + return false; m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -877,24 +834,15 @@ void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView); m_bNotifying = false; - if (!(*pAnnot)) { - bExit = true; - return; - } - - if (!IsValidAnnot(pPageView, pWidget)) { - bExit = true; - return; - } - + if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) + return true; if (nAge == pWidget->GetAppearanceAge()) - return; + return false; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); - } - bReset = true; + return true; } #endif // PDF_ENABLE_XFA @@ -920,11 +868,8 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke( #ifdef PDF_ENABLE_XFA if (pFormFiller->IsFieldFull(pData->pPageView)) { - bool bFullExit = false; - bool bFullReset = false; CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget); - OnFull(&pObserved, pData->pPageView, bFullReset, bFullExit, nFlag); - if (!pObserved || bFullReset || bFullExit) { + if (OnFull(&pObserved, pData->pPageView, nFlag) || !pObserved) { bExit = true; return; } diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index 3b6bc7f1d3..7be39f7137 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -107,25 +107,17 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { bool& bExit, uint32_t nFlag); #ifdef PDF_ENABLE_XFA - void OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, + bool OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag); - void OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, + bool OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag); - void OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, + bool OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag); - void OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, + bool OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag); #endif // PDF_ENABLE_XFA |