summaryrefslogtreecommitdiff
path: root/xfa/src
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src')
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp30
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h15
2 files changed, 25 insertions, 20 deletions
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
index f3b1276797..6f2a5010a1 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
@@ -5,6 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include <algorithm>
+#include <memory>
#include "xfa/src/foxitlib.h"
#include "xfa/src/fxfa/src/common/xfa_utils.h"
@@ -1752,14 +1753,14 @@ static void XFA_ItemLayoutProcessor_AddPendingNode(
CXFA_ItemLayoutProcessor* pProcessor,
CXFA_Node* pPendingNode,
FX_BOOL bBreakPending) {
- pProcessor->m_rgPendingNodes.AddTail(pPendingNode);
+ pProcessor->m_PendingNodes.push_back(pPendingNode);
pProcessor->m_bBreakPending = bBreakPending;
}
static FX_FLOAT XFA_ItemLayoutProcessor_InsertPendingItems(
CXFA_ItemLayoutProcessor* pProcessor,
CXFA_Node* pCurChildNode) {
FX_FLOAT fTotalHeight = 0;
- if (pProcessor->m_rgPendingNodes.GetCount() < 1) {
+ if (pProcessor->m_PendingNodes.empty()) {
return fTotalHeight;
}
if (pProcessor->m_pLayoutItem == NULL) {
@@ -1767,22 +1768,19 @@ static FX_FLOAT XFA_ItemLayoutProcessor_InsertPendingItems(
pProcessor->CreateContentLayoutItem(pCurChildNode);
pProcessor->m_pLayoutItem->m_sSize.Set(0, 0);
}
- while (pProcessor->m_rgPendingNodes.GetCount() > 0) {
- FX_POSITION pos = pProcessor->m_rgPendingNodes.GetHeadPosition();
- CXFA_Node* pPendingNode =
- reinterpret_cast<CXFA_Node*>(pProcessor->m_rgPendingNodes.GetAt(pos));
- pProcessor->m_rgPendingNodes.RemoveAt(pos);
- CXFA_ContentLayoutItem* pPendingLayoutItem = NULL;
- CXFA_ItemLayoutProcessor* pPendingProcessor =
- new CXFA_ItemLayoutProcessor(pPendingNode, NULL);
+ while (!pProcessor->m_PendingNodes.empty()) {
+ std::unique_ptr<CXFA_ItemLayoutProcessor> pPendingProcessor(
+ 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);
- pPendingLayoutItem = pPendingProcessor->HasLayoutItem()
- ? pPendingProcessor->ExtractLayoutItem()
- : NULL;
- delete pPendingProcessor;
+ CXFA_ContentLayoutItem* pPendingLayoutItem =
+ pPendingProcessor->HasLayoutItem()
+ ? pPendingProcessor->ExtractLayoutItem()
+ : nullptr;
if (pPendingLayoutItem) {
XFA_ItemLayoutProcessor_AddLeaderAfterSplit(pProcessor,
pPendingLayoutItem);
@@ -2715,8 +2713,8 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
}
}
FX_BOOL bRetValue =
- (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done &&
- m_rgPendingNodes.GetCount() == 0);
+ m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done &&
+ m_PendingNodes.empty();
if (bBreakDone) {
bRetValue = FALSE;
}
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h
index f53b19fe26..9ef40935a0 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h
+++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h
@@ -7,20 +7,27 @@
#ifndef XFA_SRC_FXFA_SRC_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_
#define XFA_SRC_FXFA_SRC_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_
+#include "float.h"
+
+#include <list>
+
#define XFA_LAYOUT_INVALIDNODE ((CXFA_Node*)(intptr_t)-1)
#define XFA_LAYOUT_FLOAT_PERCISION (0.0005f)
-#include "float.h"
#define XFA_LAYOUT_FLOAT_MAX FLT_MAX
-class CXFA_ItemLayoutProcessor;
-class CXFA_LayoutPageMgr;
+
class CXFA_ContainerLayoutItem;
class CXFA_ContentLayoutItem;
+class CXFA_ItemLayoutProcessor;
+class CXFA_LayoutPageMgr;
+class CXFA_Node;
+
enum XFA_ItemLayoutProcessorResult {
XFA_ItemLayoutProcessorResult_Done,
XFA_ItemLayoutProcessorResult_PageFullBreak,
XFA_ItemLayoutProcessorResult_RowFullBreak,
XFA_ItemLayoutProcessorResult_ManualBreak,
};
+
enum XFA_ItemLayoutProcessorStages {
XFA_ItemLayoutProcessorStages_None,
XFA_ItemLayoutProcessorStages_BookendLeader,
@@ -171,7 +178,7 @@ class CXFA_ItemLayoutProcessor {
XFA_ItemLayoutProcessorStages m_nCurChildNodeStage;
FX_FLOAT m_fUsedSize;
CXFA_LayoutPageMgr* m_pPageMgr;
- CFX_PtrList m_rgPendingNodes;
+ std::list<CXFA_Node*> m_PendingNodes;
FX_BOOL m_bBreakPending;
CFX_ArrayTemplate<FX_FLOAT> m_rgSpecifiedColumnWidths;
CFX_ArrayTemplate<CXFA_ContentLayoutItem*> m_arrayKeepItems;