summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_widgetacc.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_widgetacc.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_widgetacc.cpp')
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index b019bf636c..6f852f3321 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -36,14 +36,6 @@ class CXFA_WidgetLayoutData {
namespace {
-void FFDeleteCalcData(void* pData) {
- if (pData)
- delete ((CXFA_CalcData*)pData);
-}
-
-static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteCalcData = {FFDeleteCalcData,
- nullptr};
-
class CXFA_TextLayoutData : public CXFA_WidgetLayoutData {
public:
CXFA_TextLayoutData() {}
@@ -644,12 +636,10 @@ std::pair<int32_t, bool> CXFA_WidgetAcc::ExecuteBoolScript(
if (static_cast<CXFA_WidgetAcc*>(pRefNode->GetWidgetData()) == this)
continue;
- auto* pGlobalData = static_cast<CXFA_CalcData*>(
- pRefNode->JSNode()->GetUserData(XFA_CalcData, false));
+ CXFA_CalcData* pGlobalData = pRefNode->JSNode()->GetCalcData();
if (!pGlobalData) {
- pGlobalData = new CXFA_CalcData;
- pRefNode->JSNode()->SetUserData(XFA_CalcData, pGlobalData,
- &gs_XFADeleteCalcData);
+ pRefNode->JSNode()->SetCalcData(pdfium::MakeUnique<CXFA_CalcData>());
+ pGlobalData = pRefNode->JSNode()->GetCalcData();
}
if (!pdfium::ContainsValue(pGlobalData->m_Globals, this))
pGlobalData->m_Globals.push_back(this);