summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffdocview.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-20 20:28:23 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-20 20:28:23 +0000
commite74ae8c02f6b5efa37ba11bcad6b714046cfc7b0 (patch)
tree1c5353b26b58732e5bda616ba5d9fc8f414a7037 /xfa/fxfa/cxfa_ffdocview.cpp
parent68c77592f25f9173d2166fa01fb34b4155f4cfcb (diff)
downloadpdfium-e74ae8c02f6b5efa37ba11bcad6b714046cfc7b0.tar.xz
Convert calc data and layout item to store in CJX_Node
This CL moves the XFA_CalcData and XFA_LayoutItem out of the map'd data for a CJX_Node and stores directly on the node. This makes the object a bit bigger but makes the code a lot more understandable. Change-Id: I8897a52d61d37595181960c23928984aa5d67efc Reviewed-on: https://pdfium-review.googlesource.com/18590 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffdocview.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 3895d54569..928bc1e0d4 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -33,8 +33,6 @@
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
-#define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R')
-
const XFA_ATTRIBUTEENUM gs_EventActivity[] = {
XFA_ATTRIBUTEENUM_Click, XFA_ATTRIBUTEENUM_Change,
XFA_ATTRIBUTEENUM_DocClose, XFA_ATTRIBUTEENUM_DocReady,
@@ -616,8 +614,7 @@ void CXFA_FFDocView::AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
}
void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) {
- auto* pGlobalData = static_cast<CXFA_CalcData*>(
- pNodeChange->JSNode()->GetUserData(XFA_CalcData, false));
+ CXFA_CalcData* pGlobalData = pNodeChange->JSNode()->GetCalcData();
if (!pGlobalData)
return;
@@ -631,13 +628,9 @@ size_t CXFA_FFDocView::RunCalculateRecursive(size_t index) {
while (index < m_CalculateAccs.size()) {
CXFA_WidgetAcc* pCurAcc = m_CalculateAccs[index];
AddCalculateNodeNotify(pCurAcc->GetNode());
- int32_t iRefCount =
- (int32_t)(uintptr_t)pCurAcc->GetNode()->JSNode()->GetUserData(
- XFA_CalcRefCount, false);
- iRefCount++;
- pCurAcc->GetNode()->JSNode()->SetUserData(
- XFA_CalcRefCount, (void*)(uintptr_t)iRefCount, nullptr);
- if (iRefCount > 11)
+ size_t recurse = pCurAcc->GetNode()->JSNode()->GetCalcRecursionCount() + 1;
+ pCurAcc->GetNode()->JSNode()->SetCalcRecursionCount(recurse);
+ if (recurse > 11)
break;
if (pCurAcc->ProcessCalculate() == XFA_EVENTERROR_Success)
AddValidateWidget(pCurAcc);
@@ -654,8 +647,7 @@ int32_t CXFA_FFDocView::RunCalculateWidgets() {
RunCalculateRecursive(0);
for (CXFA_WidgetAcc* pCurAcc : m_CalculateAccs)
- pCurAcc->GetNode()->JSNode()->SetUserData(XFA_CalcRefCount, nullptr,
- nullptr);
+ pCurAcc->GetNode()->JSNode()->SetCalcRecursionCount(0);
m_CalculateAccs.clear();
return XFA_EVENTERROR_Success;