From e74ae8c02f6b5efa37ba11bcad6b714046cfc7b0 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 20 Nov 2017 20:28:23 +0000 Subject: 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 Reviewed-by: Tom Sepez --- xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp') diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp index bf63a2a56c..ec610293ce 100644 --- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -612,8 +612,7 @@ void DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; pNode = sIterator.MoveToNext()) { CXFA_ContentLayoutItem* pCurLayoutItem = - (CXFA_ContentLayoutItem*)pNode->JSNode()->GetUserData(XFA_LAYOUTITEMKEY, - false); + static_cast(pNode->JSNode()->GetLayoutItem()); CXFA_ContentLayoutItem* pNextLayoutItem = nullptr; while (pCurLayoutItem) { pNextLayoutItem = pCurLayoutItem->m_pNext; @@ -1156,9 +1155,8 @@ CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, m_bHasAvailHeight(true) { ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() || m_pFormNode->GetElementType() == XFA_Element::Form)); - m_pOldLayoutItem = - (CXFA_ContentLayoutItem*)m_pFormNode->JSNode()->GetUserData( - XFA_LAYOUTITEMKEY, false); + m_pOldLayoutItem = static_cast( + m_pFormNode->JSNode()->GetLayoutItem()); } CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} @@ -1178,8 +1176,8 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( ->GetNotify() ->OnCreateLayoutItem(pFormNode); CXFA_ContentLayoutItem* pPrevLayoutItem = - (CXFA_ContentLayoutItem*)pFormNode->JSNode()->GetUserData( - XFA_LAYOUTITEMKEY, false); + static_cast( + pFormNode->JSNode()->GetLayoutItem()); if (pPrevLayoutItem) { while (pPrevLayoutItem->m_pNext) pPrevLayoutItem = pPrevLayoutItem->m_pNext; @@ -1187,7 +1185,7 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( pPrevLayoutItem->m_pNext = pLayoutItem; pLayoutItem->m_pPrev = pPrevLayoutItem; } else { - pFormNode->JSNode()->SetUserData(XFA_LAYOUTITEMKEY, pLayoutItem, nullptr); + pFormNode->JSNode()->SetLayoutItem(pLayoutItem); } return pLayoutItem; } -- cgit v1.2.3