summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-23 15:22:54 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-23 15:22:54 +0000
commit08915150a3fb64aa1ebf9bdf20d1158a20b4266f (patch)
tree4aaf0b9751cad22a499f3073900103995b62c0c5 /fpdfsdk
parent22a1bb99afe62a032ab1fbac9f594c5c182ca880 (diff)
downloadpdfium-08915150a3fb64aa1ebf9bdf20d1158a20b4266f.tar.xz
Convert CXFA_WidgetAccIterator to CXFA_ReadyNodeIterator
This CL converts the WidgetAcc iterator to return nodes in which the OnReady event has been fired. Change-Id: I5ec6809c1610ac3467019d8492121901d3845a37 Reviewed-on: https://pdfium-review.googlesource.com/23490 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfsave.cpp16
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp41
2 files changed, 27 insertions, 30 deletions
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp
index b4d4a4107a..b95850f7b6 100644
--- a/fpdfsdk/fpdfsave.cpp
+++ b/fpdfsdk/fpdfsave.cpp
@@ -31,8 +31,8 @@
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_readynodeiterator.h"
#include "xfa/fxfa/cxfa_widgetacc.h"
-#include "xfa/fxfa/cxfa_widgetacciterator.h"
#include "xfa/fxfa/parser/cxfa_object.h"
#endif
@@ -205,12 +205,11 @@ bool SendPostSaveToXFADoc(CPDFXFA_Context* pContext) {
return false;
CXFA_FFWidgetHandler* pWidgetHandler = pXFADocView->GetWidgetHandler();
- std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator =
- pXFADocView->CreateWidgetAccIterator();
- while (CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext()) {
+ auto it = pXFADocView->CreateReadyNodeIterator();
+ while (CXFA_Node* pNode = it->MoveToNext()) {
CXFA_EventParam preParam;
preParam.m_eType = XFA_EVENT_PostSave;
- pWidgetHandler->ProcessEvent(pWidgetAcc->GetNode(), &preParam);
+ pWidgetHandler->ProcessEvent(pNode, &preParam);
}
pXFADocView->UpdateDocView();
pContext->ClearChangeMark();
@@ -227,12 +226,11 @@ bool SendPreSaveToXFADoc(CPDFXFA_Context* pContext,
return true;
CXFA_FFWidgetHandler* pWidgetHandler = pXFADocView->GetWidgetHandler();
- std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator =
- pXFADocView->CreateWidgetAccIterator();
- while (CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext()) {
+ auto it = pXFADocView->CreateReadyNodeIterator();
+ while (CXFA_Node* pNode = it->MoveToNext()) {
CXFA_EventParam preParam;
preParam.m_eType = XFA_EVENT_PreSave;
- pWidgetHandler->ProcessEvent(pWidgetAcc->GetNode(), &preParam);
+ pWidgetHandler->ProcessEvent(pNode, &preParam);
}
pXFADocView->UpdateDocView();
return SaveXFADocumentData(pContext, fileList);
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 9735584369..f3acf5624c 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -21,8 +21,8 @@
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/cxfa_ffwidgethandler.h"
-#include "xfa/fxfa/cxfa_widgetacc.h"
-#include "xfa/fxfa/cxfa_widgetacciterator.h"
+#include "xfa/fxfa/cxfa_readynodeiterator.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_submit.h"
#define IDS_XFA_Validate_Input \
@@ -620,23 +620,23 @@ bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
if (!pWidgetHandler)
return true;
- std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator =
- docView->CreateWidgetAccIterator();
- if (pWidgetAccIterator) {
+ auto it = docView->CreateReadyNodeIterator();
+ if (it) {
CXFA_EventParam Param;
Param.m_eType = XFA_EVENT_PreSubmit;
- while (CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext())
- pWidgetHandler->ProcessEvent(pWidgetAcc->GetNode(), &Param);
+ while (CXFA_Node* pNode = it->MoveToNext())
+ pWidgetHandler->ProcessEvent(pNode, &Param);
}
- pWidgetAccIterator = docView->CreateWidgetAccIterator();
- if (!pWidgetAccIterator)
+ it = docView->CreateReadyNodeIterator();
+ if (!it)
return true;
- CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext();
- pWidgetAcc = pWidgetAccIterator->MoveToNext();
- while (pWidgetAcc) {
- int fRet = pWidgetAcc->GetNode()->ProcessValidate(docView, -1);
+ (void)it->MoveToNext();
+ CXFA_Node* pNode = it->MoveToNext();
+
+ while (pNode) {
+ int fRet = pNode->ProcessValidate(docView, -1);
if (fRet == XFA_EVENTERROR_Error) {
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
@@ -650,7 +650,7 @@ bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
bs.ReleaseBuffer(len);
return false;
}
- pWidgetAcc = pWidgetAccIterator->MoveToNext();
+ pNode = it->MoveToNext();
}
docView->UpdateDocView();
@@ -669,17 +669,16 @@ void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() {
if (!pWidgetHandler)
return;
- std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator =
- m_pContext->GetXFADocView()->CreateWidgetAccIterator();
- if (!pWidgetAccIterator)
+ auto it = m_pContext->GetXFADocView()->CreateReadyNodeIterator();
+ if (!it)
return;
CXFA_EventParam Param;
Param.m_eType = XFA_EVENT_PostSubmit;
- CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext();
- while (pWidgetAcc) {
- pWidgetHandler->ProcessEvent(pWidgetAcc->GetNode(), &Param);
- pWidgetAcc = pWidgetAccIterator->MoveToNext();
+ CXFA_Node* pNode = it->MoveToNext();
+ while (pNode) {
+ pWidgetHandler->ProcessEvent(pNode, &Param);
+ pNode = it->MoveToNext();
}
m_pContext->GetXFADocView()->UpdateDocView();
}