From e547e3428ac7242d12c996392c3008945c3e0f83 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 29 Feb 2016 13:09:52 -0500 Subject: Remove _XFA_LAYOUTITEM_* defines. The _XFA_LAYOUTITEM_ProcessCACHE_ define is always set and the _XFA_LAYOUTITEM_MAPCACHE_ define is never set. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1750623002 . --- xfa/src/fxfa/src/common/xfa_doclayout.h | 2 - .../fxfa/src/parser/xfa_document_layout_imp.cpp | 3 - xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp | 52 ------------- xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h | 4 - xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp | 89 +--------------------- xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.h | 5 -- 6 files changed, 2 insertions(+), 153 deletions(-) diff --git a/xfa/src/fxfa/src/common/xfa_doclayout.h b/xfa/src/fxfa/src/common/xfa_doclayout.h index 7460b7ba13..b115c81f7a 100644 --- a/xfa/src/fxfa/src/common/xfa_doclayout.h +++ b/xfa/src/fxfa/src/common/xfa_doclayout.h @@ -9,8 +9,6 @@ #include "xfa/src/fxfa/src/common/xfa_document.h" -#define _XFA_LAYOUTITEM_ProcessCACHE_ - class CXFA_ContainerLayoutItem; class CXFA_ContentLayoutItem; class IXFA_DocLayout; diff --git a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp index b9b37ad1e1..f0835df253 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp @@ -72,9 +72,6 @@ int32_t CXFA_LayoutProcessor::StartLayout(FX_BOOL bForceRestart) { } m_pRootItemLayoutProcessor = new CXFA_ItemLayoutProcessor(pFormRoot, m_pLayoutPageMgr); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - m_pRootItemLayoutProcessor->m_pPageMgrCreateItem = m_pLayoutPageMgr; -#endif m_nProgressCounter = 1; return 0; } diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp index 719c9dcf78..05fd16fb23 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp @@ -32,11 +32,7 @@ CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, m_pKeepTailNode(nullptr), m_pFormNode(pNode), m_pLayoutItem(nullptr), -#ifdef _XFA_LAYOUTITEM_ProcessCACHE_ m_pOldLayoutItem(nullptr), -#else - m_pPageMgrCreateItem(nullptr), -#endif m_pCurChildNode(XFA_LAYOUT_INVALIDNODE), m_pCurChildPreprocessor(nullptr), m_nCurChildNodeStage(XFA_ItemLayoutProcessorStages_None), @@ -51,10 +47,8 @@ CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, m_bHasAvailHeight(TRUE) { FXSYS_assert(m_pFormNode && (m_pFormNode->IsContainerNode() || m_pFormNode->GetClassID() == XFA_ELEMENT_Form)); -#ifdef _XFA_LAYOUTITEM_ProcessCACHE_ m_pOldLayoutItem = (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY); -#endif } CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( CXFA_Node* pFormNode) { @@ -62,7 +56,6 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( return NULL; } CXFA_ContentLayoutItem* pLayoutItem = NULL; -#ifdef _XFA_LAYOUTITEM_ProcessCACHE_ if (m_pOldLayoutItem) { pLayoutItem = m_pOldLayoutItem; m_pOldLayoutItem = m_pOldLayoutItem->m_pNext; @@ -72,11 +65,6 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( ->GetParser() ->GetNotify() ->OnCreateLayoutItem(pFormNode); -#else - pLayoutItem = - (CXFA_ContentLayoutItem*)m_pPageMgrCreateItem->FindOrCreateLayoutItem( - pFormNode); -#endif CXFA_ContentLayoutItem* pPrevLayoutItem = (CXFA_ContentLayoutItem*)pFormNode->GetUserData(XFA_LAYOUTITEMKEY); if (pPrevLayoutItem) { @@ -559,7 +547,6 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() { m_pLayoutItem = (CXFA_ContentLayoutItem*)pLayoutItem->m_pNextSibling; pLayoutItem->m_pNextSibling = NULL; } -#ifdef _XFA_LAYOUTITEM_ProcessCACHE_ if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done && ToContentLayoutItem(m_pOldLayoutItem)) { if (m_pOldLayoutItem->m_pPrev) { @@ -579,7 +566,6 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() { } m_pOldLayoutItem = NULL; } -#endif return pLayoutItem; } static FX_BOOL XFA_ItemLayoutProcessor_FindBreakNode( @@ -628,7 +614,6 @@ static FX_BOOL XFA_ItemLayoutProcessor_FindBreakNode( } return bFindRs; } -#ifdef _XFA_LAYOUTITEM_ProcessCACHE_ static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { IXFA_Notify* pNotify = pGenerateNode->GetDocument()->GetParser()->GetNotify(); IXFA_DocLayout* pDocLayout = pGenerateNode->GetDocument()->GetDocLayout(); @@ -649,7 +634,6 @@ static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { } pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode); } -#endif void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode( CXFA_Node*& pCurActionNode, XFA_ItemLayoutProcessorStages& nCurStage, @@ -759,11 +743,9 @@ void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode( CXFA_Node* pSaveNode = pNextChildContainer; pNextChildContainer = pNextChildContainer->GetNodeItem( XFA_NODEITEM_NextSibling, XFA_OBJECTTYPE_ContainerNode); -#ifdef _XFA_LAYOUTITEM_ProcessCACHE_ if (pSaveNode->HasFlag(XFA_NODEFLAG_UnusedNode)) { XFA_DeleteLayoutGeneratedNode(pSaveNode); } -#endif } if (!pNextChildContainer) { goto NoMoreChildContainer; @@ -1049,9 +1031,6 @@ void CXFA_ItemLayoutProcessor::DoLayoutPageArea( } CXFA_ItemLayoutProcessor* pProcessor = new CXFA_ItemLayoutProcessor(pCurChildNode, NULL); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pProcessor->m_pPageMgrCreateItem = m_pPageMgrCreateItem; -#endif pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); if (!pProcessor->HasLayoutItem()) { delete pProcessor; @@ -1124,9 +1103,6 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( } CXFA_ItemLayoutProcessor* pProcessor = new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pProcessor->m_pPageMgrCreateItem = m_pPageMgrCreateItem; -#endif if (pContext && pContext->m_prgSpecifiedColumnWidths) { int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan); if (iColSpan <= @@ -1433,9 +1409,6 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { } CXFA_ItemLayoutProcessor* pProcessor = new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pProcessor->m_pPageMgrCreateItem = m_pPageMgrCreateItem; -#endif pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, pLayoutContext); if (!pProcessor->HasLayoutItem()) { @@ -1770,9 +1743,6 @@ static FX_FLOAT XFA_ItemLayoutProcessor_InsertPendingItems( new CXFA_ItemLayoutProcessor(pProcessor->m_PendingNodes.front(), nullptr)); pProcessor->m_PendingNodes.pop_front(); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pPendingProcessor->m_pPageMgrCreateItem = pProcessor->m_pPageMgrCreateItem; -#endif pPendingProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); CXFA_ContentLayoutItem* pPendingLayoutItem = pPendingProcessor->HasLayoutItem() @@ -2025,10 +1995,6 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( if (pOverflowTrailerNode) { CXFA_ItemLayoutProcessor* pOverflowLeaderProcessor = new CXFA_ItemLayoutProcessor(pOverflowTrailerNode, NULL); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pOverflowLeaderProcessor->m_pPageMgrCreateItem = - pProcessor->m_pPageMgrCreateItem; -#endif pOverflowLeaderProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); pTrailerLayoutItem = pOverflowLeaderProcessor->HasLayoutItem() @@ -2484,9 +2450,6 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } else { CXFA_ItemLayoutProcessor* pProcessor = new CXFA_ItemLayoutProcessor(pTrailerNode, NULL); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pProcessor->m_pPageMgrCreateItem = m_pPageMgrCreateItem; -#endif XFA_ItemLayoutProcessor_InsertFlowedItem( this, pProcessor, bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, @@ -2517,9 +2480,6 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { CXFA_ItemLayoutProcessor* pProcessor = new CXFA_ItemLayoutProcessor(pTrailerNode, NULL); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pProcessor->m_pPageMgrCreateItem = m_pPageMgrCreateItem; -#endif XFA_ItemLayoutProcessor_InsertFlowedItem( this, pProcessor, bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, @@ -2541,9 +2501,6 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( rgCurLineLayoutItems->RemoveAll(); CXFA_ItemLayoutProcessor* pProcessor = new CXFA_ItemLayoutProcessor(pLeaderNode, NULL); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pProcessor->m_pPageMgrCreateItem = m_pPageMgrCreateItem; -#endif XFA_ItemLayoutProcessor_InsertFlowedItem( this, pProcessor, bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, @@ -2581,9 +2538,6 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( m_pPageMgr->ProcessBookendLeaderOrTrailer( m_pCurChildNode, TRUE, pLeaderNode)) { pProcessor = new CXFA_ItemLayoutProcessor(pLeaderNode, m_pPageMgr); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pProcessor->m_pPageMgrCreateItem = m_pPageMgrCreateItem; -#endif } if (pProcessor) { if (XFA_ItemLayoutProcessor_InsertFlowedItem( @@ -2610,9 +2564,6 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( m_pPageMgr->ProcessBookendLeaderOrTrailer( m_pCurChildNode, FALSE, pTrailerNode)) { pProcessor = new CXFA_ItemLayoutProcessor(pTrailerNode, m_pPageMgr); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pProcessor->m_pPageMgrCreateItem = m_pPageMgrCreateItem; -#endif } if (pProcessor) { if (XFA_ItemLayoutProcessor_InsertFlowedItem( @@ -2649,9 +2600,6 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } else { pProcessor = new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); -#ifndef _XFA_LAYOUTITEM_ProcessCACHE_ - pProcessor->m_pPageMgrCreateItem = m_pPageMgrCreateItem; -#endif } XFA_ItemLayoutProcessor_InsertPendingItems(pProcessor, m_pCurChildNode); diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h index caa48e215f..e2048bfc5a 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h +++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h @@ -172,11 +172,7 @@ class CXFA_ItemLayoutProcessor { CXFA_Node* m_pKeepTailNode; CXFA_Node* m_pFormNode; CXFA_ContentLayoutItem* m_pLayoutItem; -#ifdef _XFA_LAYOUTITEM_ProcessCACHE_ CXFA_ContentLayoutItem* m_pOldLayoutItem; -#else - CXFA_LayoutPageMgr* m_pPageMgrCreateItem; -#endif CXFA_Node* m_pCurChildNode; CXFA_ItemLayoutProcessor* m_pCurChildPreprocessor; XFA_ItemLayoutProcessorStages m_nCurChildNodeStage; diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp index 750bde0a87..6634962fb0 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp @@ -1491,55 +1491,9 @@ void CXFA_LayoutPageMgr::ClearRecordList() { } CXFA_LayoutItem* CXFA_LayoutPageMgr::FindOrCreateLayoutItem( CXFA_Node* pFormNode) { -#if defined(_XFA_LAYOUTITEM_MAPCACHE_) - if (m_NodeToContent.GetCount() > 0) { - CXFA_ContentLayoutItem* pLayoutItem = NULL; - if (m_NodeToContent.Lookup(pFormNode, (void*&)pLayoutItem)) { - if (pLayoutItem->m_pNext) { - m_NodeToContent.SetAt(pFormNode, pLayoutItem->m_pNext); - pLayoutItem->m_pNext->m_pPrev = NULL; - pLayoutItem->m_pNext = NULL; - } else { - m_NodeToContent.RemoveKey(pFormNode); - } - pLayoutItem->m_pFormNode = pFormNode; - return pLayoutItem; - } - } -#endif - return (CXFA_LayoutItem*)pFormNode->GetDocument() - ->GetParser() - ->GetNotify() - ->OnCreateLayoutItem(pFormNode); + return pFormNode->GetDocument()->GetParser()->GetNotify()->OnCreateLayoutItem( + pFormNode); } -#if defined(_XFA_LAYOUTITEM_MAPCACHE_) -void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { - CXFA_LayoutItem* pNextLayoutItem, - * pCurLayoutItem = pParentLayoutItem->m_pFirstChild; - while (pCurLayoutItem) { - pNextLayoutItem = pCurLayoutItem->m_pNextSibling; - if (pCurLayoutItem->m_pFirstChild) { - SaveLayoutItem(pCurLayoutItem); - } - if (pCurLayoutItem->IsContentLayoutItem()) { - if (m_NodeToContent.GetValueAt(pCurLayoutItem->m_pFormNode) == NULL) { - pCurLayoutItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, NULL); - m_NodeToContent.SetAt(pCurLayoutItem->m_pFormNode, pCurLayoutItem); - } - } else if (pCurLayoutItem->m_pFormNode->GetClassID() != - XFA_ELEMENT_PageArea) { - delete pCurLayoutItem; - pCurLayoutItem = NULL; - } - if (pCurLayoutItem) { - pCurLayoutItem->m_pParent = NULL; - pCurLayoutItem->m_pNextSibling = NULL; - pCurLayoutItem->m_pFirstChild = NULL; - } - pCurLayoutItem = pNextLayoutItem; - } -} -#elif defined(_XFA_LAYOUTITEM_ProcessCACHE_) static void XFA_SyncRemoveLayoutItem(CXFA_LayoutItem* pParentLayoutItem, IXFA_Notify* pNotify, IXFA_DocLayout* pDocLayout) { @@ -1599,7 +1553,6 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { pCurLayoutItem = pNextLayoutItem; } } -#endif CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( CXFA_Node* pFormNode, CXFA_LayoutContext* pLayoutContext) { @@ -1967,7 +1920,6 @@ void CXFA_LayoutPageMgr::PrepareLayout() { pPageSetFormNode = pNextPageSet; } } -#if defined(_XFA_LAYOUTITEM_MAPCACHE_) || defined(_XFA_LAYOUTITEM_ProcessCACHE_) pRootLayoutItem = m_pPageSetLayoutItemRoot; CXFA_ContainerLayoutItem* pNextLayout = NULL; for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { @@ -1976,41 +1928,4 @@ void CXFA_LayoutPageMgr::PrepareLayout() { delete pRootLayoutItem; } m_pPageSetLayoutItemRoot = NULL; -#else - IXFA_Notify* pNotify = - m_pLayoutProcessor->GetDocument()->GetParser()->GetNotify(); - pRootLayoutItem = m_pPageSetLayoutItemRoot; - for (; pRootLayoutItem; - pRootLayoutItem = - (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { - CXFA_NodeIteratorTemplate - iterator(pRootLayoutItem); - for (CXFA_ContainerLayoutItem* pContainerItem = iterator.GetCurrent(); - pContainerItem; pContainerItem = iterator.MoveToNext()) { - if (pContainerItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageArea) { - continue; - } - CXFA_NodeIteratorTemplate - iterator(pContainerItem); - for (CXFA_LayoutItem* pLayoutItem = iterator.GetCurrent(); pLayoutItem; - pLayoutItem = iterator.MoveToNext()) { - if (!pLayoutItem->IsContentLayoutItem()) { - continue; - } - pNotify->OnLayoutEvent(m_pLayoutProcessor, pLayoutItem, - XFA_LAYOUTEVENT_ItemRemoving); - } - pNotify->OnPageEvent(pContainerItem, XFA_PAGEEVENT_PageRemoved); - } - } - pRootLayoutItem = m_pPageSetLayoutItemRoot; - CXFA_ContainerLayoutItem* pNextLayout = NULL; - for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { - pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; - XFA_ReleaseLayoutItem_NoPageArea(pRootLayoutItem); - } - m_pPageSetLayoutItemRoot = NULL; -#endif } diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.h b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.h index 94da5a41ed..35f1827790 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.h +++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.h @@ -130,9 +130,7 @@ class CXFA_LayoutPageMgr { void MergePageSetContents(); void LayoutPageSetContents(); void PrepareLayout(); -#if defined(_XFA_LAYOUTITEM_MAPCACHE_) || defined(_XFA_LAYOUTITEM_ProcessCACHE_) void SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem); -#endif CXFA_LayoutProcessor* m_pLayoutProcessor; CXFA_Node* m_pTemplatePageSetRoot; CXFA_ContainerLayoutItem* m_pPageSetLayoutItemRoot; @@ -146,9 +144,6 @@ class CXFA_LayoutPageMgr { FX_BOOL m_bCreateOverFlowPage; CFX_MapPtrTemplate m_pPageSetMap; CFX_ArrayTemplate m_PageArray; -#ifdef _XFA_LAYOUTITEM_MAPCACHE_ - CFX_MapPtrToPtr m_NodeToContent; -#endif }; #endif // XFA_SRC_FXFA_SRC_PARSER_XFA_LAYOUT_PAGEMGR_NEW_H_ -- cgit v1.2.3