Rename CXFA_LayoutPageMgr to CXFA_ViewLayoutProcessor
Also rename CXFA_ItemLayoutProcessor to CXFA_ContentLayoutProcessor.
CXFA_LayoutItem has two sub-classes, CXFA_ViewLayoutItem (pages) and
CXFA_ContentLayoutItem (widgets on a page). These are currently managed
by a CXFA_LayoutProcessor which has two subclass-specific helpers
called CXFA_LayoutPageMgr (which manages CXFA_ViewLayoutItem) and
CXFA_ItemLayoutProcessor (which manages CXFA_ContentLayoutItem). The
change makes the naming consistent so that CFXA_ViewLayoutProcessor
manages CXFA_ViewLayoutItems and CXFA_ContentLayoutProcessor manages
CXFA_ContentLayoutItems.
No functional change.
- Rename members and locals to match
Change-Id: I3210d6bcf9b7d5021a51df98c9aa340f4bc10b8a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/57130
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/layout/BUILD.gn b/xfa/fxfa/layout/BUILD.gn
index e50869c..9fe47c2 100644
--- a/xfa/fxfa/layout/BUILD.gn
+++ b/xfa/fxfa/layout/BUILD.gn
@@ -12,19 +12,19 @@
sources = [
"cxfa_contentlayoutitem.cpp",
"cxfa_contentlayoutitem.h",
- "cxfa_itemlayoutprocessor.cpp",
- "cxfa_itemlayoutprocessor.h",
+ "cxfa_contentlayoutprocessor.cpp",
+ "cxfa_contentlayoutprocessor.h",
"cxfa_layoutcontext.cpp",
"cxfa_layoutcontext.h",
"cxfa_layoutitem.cpp",
"cxfa_layoutitem.h",
- "cxfa_layoutpagemgr.cpp",
- "cxfa_layoutpagemgr.h",
"cxfa_layoutprocessor.cpp",
"cxfa_layoutprocessor.h",
"cxfa_traversestrategy_layoutitem.h",
"cxfa_viewlayoutitem.cpp",
"cxfa_viewlayoutitem.h",
+ "cxfa_viewlayoutprocessor.cpp",
+ "cxfa_viewlayoutprocessor.h",
]
deps = [
"../../../core/fxcrt",
diff --git a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
similarity index 92%
rename from xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp
rename to xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
index df6792b..43c1be8 100644
--- a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/layout/cxfa_itemlayoutprocessor.h"
+#include "xfa/fxfa/layout/cxfa_contentlayoutprocessor.h"
#include <algorithm>
#include <memory>
@@ -21,9 +21,9 @@
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/layout/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/layout/cxfa_layoutcontext.h"
-#include "xfa/fxfa/layout/cxfa_layoutpagemgr.h"
#include "xfa/fxfa/layout/cxfa_layoutprocessor.h"
#include "xfa/fxfa/layout/cxfa_viewlayoutitem.h"
+#include "xfa/fxfa/layout/cxfa_viewlayoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_keep.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
@@ -390,7 +390,7 @@
return false;
}
-Optional<CXFA_ItemLayoutProcessor::Stage> FindBreakNode(
+Optional<CXFA_ContentLayoutProcessor::Stage> FindBreakNode(
CXFA_Node* pContainerNode,
bool bBreakBefore,
CXFA_Node** pCurActionNode) {
@@ -405,14 +405,14 @@
break;
*pCurActionNode = pBreakNode;
- return CXFA_ItemLayoutProcessor::Stage::kBreakBefore;
+ return CXFA_ContentLayoutProcessor::Stage::kBreakBefore;
}
case XFA_Element::BreakAfter: {
if (bBreakBefore)
break;
*pCurActionNode = pBreakNode;
- return CXFA_ItemLayoutProcessor::Stage::kBreakAfter;
+ return CXFA_ContentLayoutProcessor::Stage::kBreakAfter;
}
case XFA_Element::Break:
if (pBreakNode->JSObject()->GetEnum(eAttributeType) ==
@@ -421,8 +421,8 @@
}
*pCurActionNode = pBreakNode;
- return bBreakBefore ? CXFA_ItemLayoutProcessor::Stage::kBreakBefore
- : CXFA_ItemLayoutProcessor::Stage::kBreakAfter;
+ return bBreakBefore ? CXFA_ContentLayoutProcessor::Stage::kBreakBefore
+ : CXFA_ContentLayoutProcessor::Stage::kBreakAfter;
default:
break;
}
@@ -618,9 +618,10 @@
} // namespace
-CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode,
- CXFA_LayoutPageMgr* pPageMgr)
- : m_pFormNode(pNode), m_pPageMgr(pPageMgr) {
+CXFA_ContentLayoutProcessor::CXFA_ContentLayoutProcessor(
+ CXFA_Node* pNode,
+ CXFA_ViewLayoutProcessor* pViewLayoutProcessor)
+ : m_pFormNode(pNode), m_pViewLayoutProcessor(pViewLayoutProcessor) {
ASSERT(GetFormNode());
ASSERT(GetFormNode()->IsContainerNode() ||
GetFormNode()->GetElementType() == XFA_Element::Form);
@@ -628,9 +629,9 @@
ToContentLayoutItem(GetFormNode()->JSObject()->GetLayoutItem());
}
-CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {}
+CXFA_ContentLayoutProcessor::~CXFA_ContentLayoutProcessor() {}
-CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem(
+CXFA_ContentLayoutItem* CXFA_ContentLayoutProcessor::CreateContentLayoutItem(
CXFA_Node* pFormNode) {
if (!pFormNode)
return nullptr;
@@ -655,7 +656,7 @@
return pLayoutItem;
}
-float CXFA_ItemLayoutProcessor::FindSplitPos(float fProposedSplitPos) {
+float CXFA_ContentLayoutProcessor::FindSplitPos(float fProposedSplitPos) {
ASSERT(m_pLayoutItem);
auto value = GetFormNode()->JSObject()->TryEnum(XFA_Attribute::Layout, true);
XFA_AttributeValue eLayout = value.value_or(XFA_AttributeValue::Position);
@@ -670,7 +671,7 @@
return fProposedSplitPos;
}
-void CXFA_ItemLayoutProcessor::SplitLayoutItem(
+void CXFA_ContentLayoutProcessor::SplitLayoutItem(
CXFA_ContentLayoutItem* pLayoutItem,
CXFA_ContentLayoutItem* pSecondParent,
float fSplitPos) {
@@ -796,12 +797,12 @@
pLayoutItem->AppendLastChild(pSecondLayoutItem);
}
-void CXFA_ItemLayoutProcessor::SplitLayoutItem(float fSplitPos) {
+void CXFA_ContentLayoutProcessor::SplitLayoutItem(float fSplitPos) {
ASSERT(m_pLayoutItem);
SplitLayoutItem(m_pLayoutItem, nullptr, fSplitPos);
}
-CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() {
+CXFA_ContentLayoutItem* CXFA_ContentLayoutProcessor::ExtractLayoutItem() {
CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem;
if (pLayoutItem) {
m_pLayoutItem = ToContentLayoutItem(pLayoutItem->GetNextSibling());
@@ -827,16 +828,17 @@
return pLayoutItem;
}
-void CXFA_ItemLayoutProcessor::GotoNextContainerNodeSimple(bool bUsePageBreak) {
+void CXFA_ContentLayoutProcessor::GotoNextContainerNodeSimple(
+ bool bUsePageBreak) {
m_nCurChildNodeStage = GotoNextContainerNode(
m_nCurChildNodeStage, bUsePageBreak, GetFormNode(), &m_pCurChildNode);
}
-CXFA_ItemLayoutProcessor::Stage CXFA_ItemLayoutProcessor::GotoNextContainerNode(
- Stage nCurStage,
- bool bUsePageBreak,
- CXFA_Node* pParentContainer,
- CXFA_Node** pCurActionNode) {
+CXFA_ContentLayoutProcessor::Stage
+CXFA_ContentLayoutProcessor::GotoNextContainerNode(Stage nCurStage,
+ bool bUsePageBreak,
+ CXFA_Node* pParentContainer,
+ CXFA_Node** pCurActionNode) {
CXFA_Node* pChildContainer = nullptr;
switch (nCurStage) {
case Stage::kBreakBefore:
@@ -914,8 +916,8 @@
return Stage::kDone;
}
-Optional<CXFA_ItemLayoutProcessor::Stage>
-CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext(
+Optional<CXFA_ContentLayoutProcessor::Stage>
+CXFA_ContentLayoutProcessor::ProcessKeepNodesForCheckNext(
CXFA_Node** pCurActionNode,
CXFA_Node** pNextContainer,
bool* pLastKeepNode) {
@@ -956,8 +958,8 @@
return ret;
}
-Optional<CXFA_ItemLayoutProcessor::Stage>
-CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore(
+Optional<CXFA_ContentLayoutProcessor::Stage>
+CXFA_ContentLayoutProcessor::ProcessKeepNodesForBreakBefore(
CXFA_Node** pCurActionNode,
CXFA_Node* pContainerNode) {
if (m_pKeepTailNode == pContainerNode) {
@@ -970,7 +972,7 @@
return FindBreakNode(pBreakAfterNode, false, pCurActionNode);
}
-void CXFA_ItemLayoutProcessor::DoLayoutPageArea(
+void CXFA_ContentLayoutProcessor::DoLayoutPageArea(
CXFA_ViewLayoutItem* pPageAreaLayoutItem) {
CXFA_Node* pFormNode = pPageAreaLayoutItem->GetFormNode();
CXFA_Node* pCurChildNode = nullptr;
@@ -986,7 +988,7 @@
continue;
auto pProcessor =
- pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pCurChildNode, nullptr);
+ pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(pCurChildNode, nullptr);
pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr);
if (!pProcessor->HasLayoutItem())
continue;
@@ -1025,7 +1027,7 @@
}
}
-void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer(
+void CXFA_ContentLayoutProcessor::DoLayoutPositionedContainer(
CXFA_LayoutContext* pContext) {
if (m_pLayoutItem)
return;
@@ -1053,8 +1055,8 @@
if (m_pCurChildNode->GetElementType() == XFA_Element::Variables)
continue;
- auto pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- m_pCurChildNode, m_pPageMgr.Get());
+ auto pProcessor = pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(
+ m_pCurChildNode, m_pViewLayoutProcessor.Get());
if (pContext && pContext->m_prgSpecifiedColumnWidths) {
int32_t iColSpan =
m_pCurChildNode->JSObject()->GetInteger(XFA_Attribute::ColSpan);
@@ -1131,7 +1133,8 @@
SetCurrentComponentSize(containerSize);
}
-void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
+void CXFA_ContentLayoutProcessor::DoLayoutTableContainer(
+ CXFA_Node* pLayoutNode) {
if (m_pLayoutItem)
return;
if (!pLayoutNode)
@@ -1187,8 +1190,8 @@
if (m_nCurChildNodeStage != Stage::kContainer)
continue;
- auto pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- m_pCurChildNode, m_pPageMgr.Get());
+ auto pProcessor = pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(
+ m_pCurChildNode, m_pViewLayoutProcessor.Get());
pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, pLayoutContext);
if (!pProcessor->HasLayoutItem())
continue;
@@ -1357,7 +1360,7 @@
SetCurrentComponentSize(containerSize);
}
-bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer(
+bool CXFA_ContentLayoutProcessor::IsAddNewRowForTrailer(
CXFA_ContentLayoutItem* pTrailerItem) {
if (!pTrailerItem)
return false;
@@ -1368,7 +1371,7 @@
return eLayout == XFA_AttributeValue::Tb || m_fWidthLimit <= fWidth;
}
-float CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() {
+float CXFA_ContentLayoutProcessor::InsertKeepLayoutItems() {
if (m_arrayKeepItems.empty())
return 0;
@@ -1388,8 +1391,8 @@
return fTotalHeight;
}
-bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit(
- CXFA_ItemLayoutProcessor* pChildProcessor,
+bool CXFA_ContentLayoutProcessor::ProcessKeepForSplit(
+ CXFA_ContentLayoutProcessor* pChildProcessor,
Result eRetValue,
std::vector<CXFA_ContentLayoutItem*>* rgCurLineLayoutItem,
float* fContentCurRowAvailWidth,
@@ -1432,7 +1435,7 @@
return true;
}
-bool CXFA_ItemLayoutProcessor::JudgePutNextPage(
+bool CXFA_ContentLayoutProcessor::JudgePutNextPage(
CXFA_ContentLayoutItem* pParentLayoutItem,
float fChildHeight,
std::vector<CXFA_ContentLayoutItem*>* pKeepItems) {
@@ -1455,10 +1458,10 @@
}
}
fItemsHeight += fChildHeight;
- return m_pPageMgr->GetNextAvailContentHeight(fItemsHeight);
+ return m_pViewLayoutProcessor->GetNextAvailContentHeight(fItemsHeight);
}
-void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) {
+void CXFA_ContentLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) {
if (!pFormNode)
return;
@@ -1476,7 +1479,7 @@
}
}
-void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow(
+void CXFA_ContentLayoutProcessor::ProcessUnUseOverFlow(
CXFA_Node* pLeaderNode,
CXFA_Node* pTrailerNode,
CXFA_ContentLayoutItem* pTrailerItem,
@@ -1498,8 +1501,8 @@
XFA_ReleaseLayoutItem(pTrailerItem);
}
-CXFA_ItemLayoutProcessor::Result
-CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
+CXFA_ContentLayoutProcessor::Result
+CXFA_ContentLayoutProcessor::DoLayoutFlowedContainer(
bool bUseBreakControl,
XFA_AttributeValue eFlowStrategy,
float fHeightLimit,
@@ -1604,7 +1607,7 @@
}
while (m_pCurChildNode) {
- std::unique_ptr<CXFA_ItemLayoutProcessor> pProcessor;
+ std::unique_ptr<CXFA_ContentLayoutProcessor> pProcessor;
bool bAddedItemInRow = false;
fContentCurRowY += InsertPendingItems(GetFormNode());
switch (m_nCurChildNodeStage) {
@@ -1617,11 +1620,11 @@
calculated_size.height -= item->m_sSize.height;
}
- if (!bUseBreakControl || !m_pPageMgr)
+ if (!bUseBreakControl || !m_pViewLayoutProcessor)
break;
- Optional<CXFA_LayoutPageMgr::BreakData> break_data =
- m_pPageMgr->ProcessBreakBefore(m_pCurChildNode);
+ Optional<CXFA_ViewLayoutProcessor::BreakData> break_data =
+ m_pViewLayoutProcessor->ProcessBreakBefore(m_pCurChildNode);
if (!break_data.has_value() || !break_data.value().bCreatePage ||
GetFormNode()->GetElementType() == XFA_Element::Form) {
break;
@@ -1639,8 +1642,8 @@
AddPendingNode(pTrailerNode, true);
} else {
auto pTempProcessor =
- pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pTrailerNode,
- nullptr);
+ pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(pTrailerNode,
+ nullptr);
InsertFlowedItem(
pTempProcessor.get(), bContainerWidthAutoSize,
bContainerHeightAutoSize, container_size.height,
@@ -1656,11 +1659,11 @@
goto SuspendAndCreateNewRow;
}
case Stage::kBreakAfter: {
- if (!bUseBreakControl || !m_pPageMgr)
+ if (!bUseBreakControl || !m_pViewLayoutProcessor)
break;
- Optional<CXFA_LayoutPageMgr::BreakData> break_data =
- m_pPageMgr->ProcessBreakAfter(m_pCurChildNode);
+ Optional<CXFA_ViewLayoutProcessor::BreakData> break_data =
+ m_pViewLayoutProcessor->ProcessBreakAfter(m_pCurChildNode);
if (!break_data.has_value() ||
GetFormNode()->GetElementType() == XFA_Element::Form) {
break;
@@ -1670,8 +1673,9 @@
CXFA_Node* pTrailerNode = break_data.value().pTrailer;
bool bCreatePage = break_data.value().bCreatePage;
if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) {
- auto pTempProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- pTrailerNode, nullptr);
+ auto pTempProcessor =
+ pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(pTrailerNode,
+ nullptr);
InsertFlowedItem(pTempProcessor.get(), bContainerWidthAutoSize,
bContainerHeightAutoSize, container_size.height,
eFlowStrategy, &uCurHAlignState,
@@ -1689,8 +1693,8 @@
fContentCurRowHeight, fContentWidthLimit, false);
rgCurLineLayoutItems->clear();
auto pTempProcessor =
- pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pLeaderNode,
- nullptr);
+ pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(pLeaderNode,
+ nullptr);
InsertFlowedItem(
pTempProcessor.get(), bContainerWidthAutoSize,
bContainerHeightAutoSize, container_size.height,
@@ -1716,12 +1720,12 @@
case Stage::kBookendLeader: {
if (m_pCurChildPreprocessor) {
pProcessor = std::move(m_pCurChildPreprocessor);
- } else if (m_pPageMgr) {
+ } else if (m_pViewLayoutProcessor) {
CXFA_Node* pLeaderNode =
- m_pPageMgr->ProcessBookendLeader(m_pCurChildNode);
+ m_pViewLayoutProcessor->ProcessBookendLeader(m_pCurChildNode);
if (pLeaderNode) {
- pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- pLeaderNode, m_pPageMgr.Get());
+ pProcessor = pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(
+ pLeaderNode, m_pViewLayoutProcessor.Get());
}
}
@@ -1744,12 +1748,12 @@
case Stage::kBookendTrailer: {
if (m_pCurChildPreprocessor) {
pProcessor = std::move(m_pCurChildPreprocessor);
- } else if (m_pPageMgr) {
+ } else if (m_pViewLayoutProcessor) {
CXFA_Node* pTrailerNode =
- m_pPageMgr->ProcessBookendTrailer(m_pCurChildNode);
+ m_pViewLayoutProcessor->ProcessBookendTrailer(m_pCurChildNode);
if (pTrailerNode) {
- pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- pTrailerNode, m_pPageMgr.Get());
+ pProcessor = pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(
+ pTrailerNode, m_pViewLayoutProcessor.Get());
}
}
if (pProcessor) {
@@ -1785,8 +1789,8 @@
pProcessor = std::move(m_pCurChildPreprocessor);
bNewRow = true;
} else {
- pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- m_pCurChildNode, m_pPageMgr.Get());
+ pProcessor = pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(
+ m_pCurChildNode, m_pViewLayoutProcessor.Get());
}
pProcessor->InsertPendingItems(m_pCurChildNode);
@@ -1867,7 +1871,7 @@
return bIsManualBreak ? Result::kManualBreak : Result::kPageFullBreak;
}
-bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
+bool CXFA_ContentLayoutProcessor::CalculateRowChildPosition(
std::vector<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3],
XFA_AttributeValue eFlowStrategy,
bool bContainerHeightAutoSize,
@@ -2001,7 +2005,7 @@
return true;
}
-CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent(
+CXFA_Node* CXFA_ContentLayoutProcessor::GetSubformSetParent(
CXFA_Node* pSubformSet) {
if (pSubformSet && pSubformSet->GetElementType() == XFA_Element::SubformSet) {
CXFA_Node* pParent = pSubformSet->GetParent();
@@ -2014,7 +2018,7 @@
return pSubformSet;
}
-void CXFA_ItemLayoutProcessor::DoLayoutField() {
+void CXFA_ContentLayoutProcessor::DoLayoutField() {
if (m_pLayoutItem)
return;
@@ -2036,7 +2040,7 @@
SetCurrentComponentSize(size);
}
-CXFA_ItemLayoutProcessor::Result CXFA_ItemLayoutProcessor::DoLayout(
+CXFA_ContentLayoutProcessor::Result CXFA_ContentLayoutProcessor::DoLayout(
bool bUseBreakControl,
float fHeightLimit,
float fRealHeight,
@@ -2081,19 +2085,21 @@
}
}
-CFX_SizeF CXFA_ItemLayoutProcessor::GetCurrentComponentSize() {
+CFX_SizeF CXFA_ContentLayoutProcessor::GetCurrentComponentSize() {
return CFX_SizeF(m_pLayoutItem->m_sSize.width, m_pLayoutItem->m_sSize.height);
}
-void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(const CFX_PointF& pos) {
+void CXFA_ContentLayoutProcessor::SetCurrentComponentPos(
+ const CFX_PointF& pos) {
m_pLayoutItem->m_sPos = pos;
}
-void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(const CFX_SizeF& size) {
+void CXFA_ContentLayoutProcessor::SetCurrentComponentSize(
+ const CFX_SizeF& size) {
m_pLayoutItem->m_sSize = size;
}
-bool CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur(
+bool CXFA_ContentLayoutProcessor::JudgeLeaderOrTrailerForOccur(
CXFA_Node* pFormNode) {
if (!pFormNode)
return false;
@@ -2119,7 +2125,7 @@
return true;
}
-void CXFA_ItemLayoutProcessor::UpdatePendingItemLayout(
+void CXFA_ContentLayoutProcessor::UpdatePendingItemLayout(
CXFA_ContentLayoutItem* pLayoutItem) {
XFA_AttributeValue eLayout =
pLayoutItem->GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout);
@@ -2133,7 +2139,7 @@
}
}
-void CXFA_ItemLayoutProcessor::AddTrailerBeforeSplit(
+void CXFA_ContentLayoutProcessor::AddTrailerBeforeSplit(
float fSplitPos,
CXFA_ContentLayoutItem* pTrailerLayoutItem,
bool bUseInherited) {
@@ -2195,7 +2201,7 @@
m_pLayoutItem->AppendLastChild(pTrailerLayoutItem);
}
-void CXFA_ItemLayoutProcessor::AddLeaderAfterSplit(
+void CXFA_ContentLayoutProcessor::AddLeaderAfterSplit(
CXFA_ContentLayoutItem* pLeaderLayoutItem) {
UpdatePendingItemLayout(pLeaderLayoutItem);
@@ -2242,13 +2248,14 @@
m_pLayoutItem->AppendLastChild(pLeaderLayoutItem);
}
-void CXFA_ItemLayoutProcessor::AddPendingNode(CXFA_Node* pPendingNode,
- bool bBreakPending) {
+void CXFA_ContentLayoutProcessor::AddPendingNode(CXFA_Node* pPendingNode,
+ bool bBreakPending) {
m_PendingNodes.push_back(pPendingNode);
m_bBreakPending = bBreakPending;
}
-float CXFA_ItemLayoutProcessor::InsertPendingItems(CXFA_Node* pCurChildNode) {
+float CXFA_ContentLayoutProcessor::InsertPendingItems(
+ CXFA_Node* pCurChildNode) {
float fTotalHeight = 0;
if (m_PendingNodes.empty())
return fTotalHeight;
@@ -2259,7 +2266,7 @@
}
while (!m_PendingNodes.empty()) {
- auto pPendingProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
+ auto pPendingProcessor = pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(
m_PendingNodes.front(), nullptr);
m_PendingNodes.pop_front();
pPendingProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr);
@@ -2276,8 +2283,9 @@
return fTotalHeight;
}
-CXFA_ItemLayoutProcessor::Result CXFA_ItemLayoutProcessor::InsertFlowedItem(
- CXFA_ItemLayoutProcessor* pProcessor,
+CXFA_ContentLayoutProcessor::Result
+CXFA_ContentLayoutProcessor::InsertFlowedItem(
+ CXFA_ContentLayoutProcessor* pProcessor,
bool bContainerWidthAutoSize,
bool bContainerHeightAutoSize,
float fContainerHeight,
@@ -2327,8 +2335,9 @@
bool bUseInherited = false;
CXFA_LayoutContext layoutContext;
- if (m_pPageMgr) {
- CXFA_Node* pOverflowNode = m_pPageMgr->QueryOverflow(GetFormNode());
+ if (m_pViewLayoutProcessor) {
+ CXFA_Node* pOverflowNode =
+ m_pViewLayoutProcessor->QueryOverflow(GetFormNode());
if (pOverflowNode) {
layoutContext.m_pOverflowNode = pOverflowNode;
layoutContext.m_pOverflowProcessor = this;
@@ -2367,23 +2376,24 @@
CXFA_Node* pFormNode = nullptr;
CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr;
bool bIsAddTrailerHeight = false;
- if (m_pPageMgr &&
+ if (m_pViewLayoutProcessor &&
pProcessor->GetFormNode()->GetIntact() == XFA_AttributeValue::None) {
- pFormNode = m_pPageMgr->QueryOverflow(pProcessor->GetFormNode());
+ pFormNode =
+ m_pViewLayoutProcessor->QueryOverflow(pProcessor->GetFormNode());
if (!pFormNode && pLayoutContext && pLayoutContext->m_pOverflowProcessor) {
pFormNode = pLayoutContext->m_pOverflowNode.Get();
bUseInherited = true;
}
- Optional<CXFA_LayoutPageMgr::OverflowData> overflow_data =
- m_pPageMgr->ProcessOverflow(pFormNode, false);
+ Optional<CXFA_ViewLayoutProcessor::OverflowData> overflow_data =
+ m_pViewLayoutProcessor->ProcessOverflow(pFormNode, false);
if (overflow_data.has_value()) {
pOverflowLeaderNode = overflow_data.value().pLeader;
pOverflowTrailerNode = overflow_data.value().pTrailer;
if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowTrailerNode)) {
if (pOverflowTrailerNode) {
auto pOverflowLeaderProcessor =
- pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pOverflowTrailerNode,
- nullptr);
+ pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(
+ pOverflowTrailerNode, nullptr);
pOverflowLeaderProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr);
pTrailerLayoutItem =
pOverflowLeaderProcessor->HasLayoutItem()
@@ -2497,9 +2507,9 @@
return Result::kPageFullBreak;
}
- if (m_pPageMgr && !pProcessor->m_bUseInherited &&
+ if (m_pViewLayoutProcessor && !pProcessor->m_bUseInherited &&
eRetValue != Result::kPageFullBreak) {
- m_pPageMgr->ProcessOverflow(pFormNode, true);
+ m_pViewLayoutProcessor->ProcessOverflow(pFormNode, true);
}
if (pTrailerLayoutItem && bIsAddTrailerHeight) {
pProcessor->AddTrailerBeforeSplit(fSplitPos, pTrailerLayoutItem,
@@ -2541,12 +2551,13 @@
if (*fContentCurRowY <= kXFALayoutPrecision) {
childSize = pProcessor->GetCurrentComponentSize();
- if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(childSize.height)) {
- if (m_pPageMgr) {
+ if (pProcessor->m_pViewLayoutProcessor->GetNextAvailContentHeight(
+ childSize.height)) {
+ if (m_pViewLayoutProcessor) {
if (!pFormNode && pLayoutContext)
pFormNode = pLayoutContext->m_pOverflowProcessor->GetFormNode();
- m_pPageMgr->ProcessOverflow(pFormNode, true);
+ m_pViewLayoutProcessor->ProcessOverflow(pFormNode, true);
}
if (bUseInherited) {
pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
@@ -2573,9 +2584,9 @@
pProcessor->GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout);
if (pProcessor->GetFormNode()->GetIntact() == XFA_AttributeValue::None &&
eLayout == XFA_AttributeValue::Tb) {
- if (m_pPageMgr) {
- Optional<CXFA_LayoutPageMgr::OverflowData> overflow_data =
- m_pPageMgr->ProcessOverflow(pFormNode, true);
+ if (m_pViewLayoutProcessor) {
+ Optional<CXFA_ViewLayoutProcessor::OverflowData> overflow_data =
+ m_pViewLayoutProcessor->ProcessOverflow(pFormNode, true);
if (overflow_data.has_value()) {
pOverflowLeaderNode = overflow_data.value().pLeader;
pOverflowTrailerNode = overflow_data.value().pTrailer;
@@ -2594,9 +2605,9 @@
if (!pFormNode && pLayoutContext)
pFormNode = pLayoutContext->m_pOverflowProcessor->GetFormNode();
- if (m_pPageMgr) {
- Optional<CXFA_LayoutPageMgr::OverflowData> overflow_data =
- m_pPageMgr->ProcessOverflow(pFormNode, true);
+ if (m_pViewLayoutProcessor) {
+ Optional<CXFA_ViewLayoutProcessor::OverflowData> overflow_data =
+ m_pViewLayoutProcessor->ProcessOverflow(pFormNode, true);
if (overflow_data.has_value()) {
pOverflowLeaderNode = overflow_data.value().pLeader;
pOverflowTrailerNode = overflow_data.value().pTrailer;
@@ -2610,17 +2621,17 @@
return Result::kPageFullBreak;
}
-Optional<CXFA_ItemLayoutProcessor::Stage> CXFA_ItemLayoutProcessor::HandleKeep(
- CXFA_Node* pBreakAfterNode,
- CXFA_Node** pCurActionNode) {
+Optional<CXFA_ContentLayoutProcessor::Stage>
+CXFA_ContentLayoutProcessor::HandleKeep(CXFA_Node* pBreakAfterNode,
+ CXFA_Node** pCurActionNode) {
if (m_bKeepBreakFinish)
return {};
return FindBreakNode(pBreakAfterNode, false, pCurActionNode);
}
-Optional<CXFA_ItemLayoutProcessor::Stage>
-CXFA_ItemLayoutProcessor::HandleBookendLeader(CXFA_Node* pParentContainer,
- CXFA_Node** pCurActionNode) {
+Optional<CXFA_ContentLayoutProcessor::Stage>
+CXFA_ContentLayoutProcessor::HandleBookendLeader(CXFA_Node* pParentContainer,
+ CXFA_Node** pCurActionNode) {
for (CXFA_Node* pBookendNode = *pCurActionNode
? (*pCurActionNode)->GetNextSibling()
: pParentContainer->GetFirstChild();
@@ -2637,9 +2648,9 @@
return {};
}
-Optional<CXFA_ItemLayoutProcessor::Stage>
-CXFA_ItemLayoutProcessor::HandleBreakBefore(CXFA_Node* pChildContainer,
- CXFA_Node** pCurActionNode) {
+Optional<CXFA_ContentLayoutProcessor::Stage>
+CXFA_ContentLayoutProcessor::HandleBreakBefore(CXFA_Node* pChildContainer,
+ CXFA_Node** pCurActionNode) {
if (!*pCurActionNode)
return {};
@@ -2656,9 +2667,9 @@
return Stage::kContainer;
}
-Optional<CXFA_ItemLayoutProcessor::Stage>
-CXFA_ItemLayoutProcessor::HandleBreakAfter(CXFA_Node* pChildContainer,
- CXFA_Node** pCurActionNode) {
+Optional<CXFA_ContentLayoutProcessor::Stage>
+CXFA_ContentLayoutProcessor::HandleBreakAfter(CXFA_Node* pChildContainer,
+ CXFA_Node** pCurActionNode) {
if (*pCurActionNode) {
CXFA_Node* pBreakAfterNode = (*pCurActionNode)->GetNextSibling();
return FindBreakNode(pBreakAfterNode, false, pCurActionNode);
@@ -2668,8 +2679,8 @@
return HandleKeep(pBreakAfterNode, pCurActionNode);
}
-Optional<CXFA_ItemLayoutProcessor::Stage>
-CXFA_ItemLayoutProcessor::HandleCheckNextChildContainer(
+Optional<CXFA_ContentLayoutProcessor::Stage>
+CXFA_ContentLayoutProcessor::HandleCheckNextChildContainer(
CXFA_Node* pParentContainer,
CXFA_Node* pChildContainer,
CXFA_Node** pCurActionNode) {
@@ -2701,9 +2712,9 @@
return m_bIsProcessKeep ? Stage::kKeep : Stage::kContainer;
}
-Optional<CXFA_ItemLayoutProcessor::Stage>
-CXFA_ItemLayoutProcessor::HandleBookendTrailer(CXFA_Node* pParentContainer,
- CXFA_Node** pCurActionNode) {
+Optional<CXFA_ContentLayoutProcessor::Stage>
+CXFA_ContentLayoutProcessor::HandleBookendTrailer(CXFA_Node* pParentContainer,
+ CXFA_Node** pCurActionNode) {
for (CXFA_Node* pBookendNode = *pCurActionNode
? (*pCurActionNode)->GetNextSibling()
: pParentContainer->GetFirstChild();
@@ -2720,14 +2731,14 @@
return {};
}
-void CXFA_ItemLayoutProcessor::ProcessKeepNodesEnd() {
+void CXFA_ContentLayoutProcessor::ProcessKeepNodesEnd() {
m_bKeepBreakFinish = true;
m_pKeepHeadNode = nullptr;
m_pKeepTailNode = nullptr;
m_bIsProcessKeep = false;
}
-void CXFA_ItemLayoutProcessor::AdjustContainerSpecifiedSize(
+void CXFA_ContentLayoutProcessor::AdjustContainerSpecifiedSize(
CXFA_LayoutContext* pContext,
CFX_SizeF* pSize,
bool* pContainerWidthAutoSize,
@@ -2755,7 +2766,7 @@
*pContainerHeightAutoSize = true;
}
-CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::FindLastContentLayoutItem(
+CXFA_ContentLayoutItem* CXFA_ContentLayoutProcessor::FindLastContentLayoutItem(
XFA_AttributeValue eFlowStrategy) {
if (m_nCurChildNodeStage == Stage::kDone ||
eFlowStrategy == XFA_AttributeValue::Tb) {
@@ -2773,7 +2784,7 @@
return pLastChild;
}
-CFX_SizeF CXFA_ItemLayoutProcessor::CalculateLayoutItemSize(
+CFX_SizeF CXFA_ContentLayoutProcessor::CalculateLayoutItemSize(
const CXFA_ContentLayoutItem* pLastChild) {
CFX_SizeF size;
for (CXFA_LayoutItem* pChild = m_pLayoutItem->GetFirstChild();
diff --git a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.h b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.h
similarity index 91%
rename from xfa/fxfa/layout/cxfa_itemlayoutprocessor.h
rename to xfa/fxfa/layout/cxfa_contentlayoutprocessor.h
index 3faffb2..32dd9cd 100644
--- a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.h
+++ b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_LAYOUT_CXFA_ITEMLAYOUTPROCESSOR_H_
-#define XFA_FXFA_LAYOUT_CXFA_ITEMLAYOUTPROCESSOR_H_
+#ifndef XFA_FXFA_LAYOUT_CXFA_CONTENTLAYOUTPROCESSOR_H_
+#define XFA_FXFA_LAYOUT_CXFA_CONTENTLAYOUTPROCESSOR_H_
#include <float.h>
@@ -22,14 +22,14 @@
constexpr float kXFALayoutPrecision = 0.0005f;
class CXFA_ContentLayoutItem;
-class CXFA_ItemLayoutProcessor;
+class CXFA_ContentLayoutProcessor;
class CXFA_LayoutContext;
-class CXFA_LayoutPageMgr;
class CXFA_LayoutProcessor;
class CXFA_Node;
class CXFA_ViewLayoutItem;
+class CXFA_ViewLayoutProcessor;
-class CXFA_ItemLayoutProcessor {
+class CXFA_ContentLayoutProcessor {
public:
enum class Result : uint8_t {
kDone,
@@ -49,8 +49,9 @@
kDone,
};
- CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr);
- ~CXFA_ItemLayoutProcessor();
+ CXFA_ContentLayoutProcessor(CXFA_Node* pNode,
+ CXFA_ViewLayoutProcessor* pViewLayoutProcessor);
+ ~CXFA_ContentLayoutProcessor();
Result DoLayout(bool bUseBreakControl,
float fHeightLimit,
@@ -69,7 +70,7 @@
float FindSplitPos(float fProposedSplitPos);
bool ProcessKeepForSplit(
- CXFA_ItemLayoutProcessor* pChildProcessor,
+ CXFA_ContentLayoutProcessor* pChildProcessor,
Result eRetValue,
std::vector<CXFA_ContentLayoutItem*>* rgCurLineLayoutItem,
float* fContentCurRowAvailWidth,
@@ -143,7 +144,7 @@
void AddPendingNode(CXFA_Node* pPendingNode, bool bBreakPending);
float InsertPendingItems(CXFA_Node* pCurChildNode);
Result InsertFlowedItem(
- CXFA_ItemLayoutProcessor* pProcessor,
+ CXFA_ContentLayoutProcessor* pProcessor,
bool bContainerWidthAutoSize,
bool bContainerHeightAutoSize,
float fContainerHeight,
@@ -201,12 +202,12 @@
CXFA_Node* m_pKeepTailNode = nullptr;
CXFA_ContentLayoutItem* m_pLayoutItem = nullptr;
CXFA_ContentLayoutItem* m_pOldLayoutItem = nullptr;
- UnownedPtr<CXFA_LayoutPageMgr> m_pPageMgr;
+ UnownedPtr<CXFA_ViewLayoutProcessor> m_pViewLayoutProcessor;
std::vector<float> m_rgSpecifiedColumnWidths;
std::vector<CXFA_ContentLayoutItem*> m_arrayKeepItems;
std::list<CXFA_Node*> m_PendingNodes;
std::map<CXFA_Node*, int32_t> m_PendingNodesCount;
- std::unique_ptr<CXFA_ItemLayoutProcessor> m_pCurChildPreprocessor;
+ std::unique_ptr<CXFA_ContentLayoutProcessor> m_pCurChildPreprocessor;
};
-#endif // XFA_FXFA_LAYOUT_CXFA_ITEMLAYOUTPROCESSOR_H_
+#endif // XFA_FXFA_LAYOUT_CXFA_CONTENTLAYOUTPROCESSOR_H_
diff --git a/xfa/fxfa/layout/cxfa_layoutcontext.h b/xfa/fxfa/layout/cxfa_layoutcontext.h
index 4fa7b1c..76ed06f 100644
--- a/xfa/fxfa/layout/cxfa_layoutcontext.h
+++ b/xfa/fxfa/layout/cxfa_layoutcontext.h
@@ -12,7 +12,7 @@
#include "core/fxcrt/unowned_ptr.h"
#include "third_party/base/optional.h"
-class CXFA_ItemLayoutProcessor;
+class CXFA_ContentLayoutProcessor;
class CXFA_Node;
class CXFA_LayoutContext {
@@ -22,7 +22,7 @@
Optional<float> m_fCurColumnWidth;
UnownedPtr<std::vector<float>> m_prgSpecifiedColumnWidths;
- UnownedPtr<CXFA_ItemLayoutProcessor> m_pOverflowProcessor;
+ UnownedPtr<CXFA_ContentLayoutProcessor> m_pOverflowProcessor;
UnownedPtr<CXFA_Node> m_pOverflowNode;
};
diff --git a/xfa/fxfa/layout/cxfa_layoutprocessor.cpp b/xfa/fxfa/layout/cxfa_layoutprocessor.cpp
index 08476f9..fc86a4b 100644
--- a/xfa/fxfa/layout/cxfa_layoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_layoutprocessor.cpp
@@ -10,8 +10,8 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fxfa/layout/cxfa_contentlayoutitem.h"
-#include "xfa/fxfa/layout/cxfa_itemlayoutprocessor.h"
-#include "xfa/fxfa/layout/cxfa_layoutpagemgr.h"
+#include "xfa/fxfa/layout/cxfa_contentlayoutprocessor.h"
+#include "xfa/fxfa/layout/cxfa_viewlayoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
@@ -38,7 +38,7 @@
if (!bForceRestart && !IsNeedLayout())
return 100;
- m_pRootItemLayoutProcessor.reset();
+ m_pContentLayoutProcessor.reset();
m_nProgressCounter = 0;
CXFA_Node* pFormPacketNode =
ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Form));
@@ -50,16 +50,16 @@
if (!pFormRoot)
return -1;
- if (!m_pLayoutPageMgr)
- m_pLayoutPageMgr = pdfium::MakeUnique<CXFA_LayoutPageMgr>(this);
- if (!m_pLayoutPageMgr->InitLayoutPage(pFormRoot))
+ if (!m_pViewLayoutProcessor)
+ m_pViewLayoutProcessor = pdfium::MakeUnique<CXFA_ViewLayoutProcessor>(this);
+ if (!m_pViewLayoutProcessor->InitLayoutPage(pFormRoot))
return -1;
- if (!m_pLayoutPageMgr->PrepareFirstPage(pFormRoot))
+ if (!m_pViewLayoutProcessor->PrepareFirstPage(pFormRoot))
return -1;
- m_pRootItemLayoutProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- pFormRoot, m_pLayoutPageMgr.get());
+ m_pContentLayoutProcessor = pdfium::MakeUnique<CXFA_ContentLayoutProcessor>(
+ pFormRoot, m_pViewLayoutProcessor.get());
m_nProgressCounter = 1;
return 0;
}
@@ -68,35 +68,35 @@
if (m_nProgressCounter < 1)
return -1;
- CXFA_ItemLayoutProcessor::Result eStatus;
- CXFA_Node* pFormNode = m_pRootItemLayoutProcessor->GetFormNode();
+ CXFA_ContentLayoutProcessor::Result eStatus;
+ CXFA_Node* pFormNode = m_pContentLayoutProcessor->GetFormNode();
float fPosX =
pFormNode->JSObject()->GetMeasureInUnit(XFA_Attribute::X, XFA_Unit::Pt);
float fPosY =
pFormNode->JSObject()->GetMeasureInUnit(XFA_Attribute::Y, XFA_Unit::Pt);
do {
- float fAvailHeight = m_pLayoutPageMgr->GetAvailHeight();
- eStatus = m_pRootItemLayoutProcessor->DoLayout(true, fAvailHeight,
- fAvailHeight, nullptr);
- if (eStatus != CXFA_ItemLayoutProcessor::Result::kDone)
+ float fAvailHeight = m_pViewLayoutProcessor->GetAvailHeight();
+ eStatus = m_pContentLayoutProcessor->DoLayout(true, fAvailHeight,
+ fAvailHeight, nullptr);
+ if (eStatus != CXFA_ContentLayoutProcessor::Result::kDone)
m_nProgressCounter++;
CXFA_ContentLayoutItem* pLayoutItem =
- m_pRootItemLayoutProcessor->ExtractLayoutItem();
+ m_pContentLayoutProcessor->ExtractLayoutItem();
if (pLayoutItem)
pLayoutItem->m_sPos = CFX_PointF(fPosX, fPosY);
- m_pLayoutPageMgr->SubmitContentItem(pLayoutItem, eStatus);
- } while (eStatus != CXFA_ItemLayoutProcessor::Result::kDone);
+ m_pViewLayoutProcessor->SubmitContentItem(pLayoutItem, eStatus);
+ } while (eStatus != CXFA_ContentLayoutProcessor::Result::kDone);
- if (eStatus == CXFA_ItemLayoutProcessor::Result::kDone) {
- m_pLayoutPageMgr->FinishPaginatedPageSets();
- m_pLayoutPageMgr->SyncLayoutData();
+ if (eStatus == CXFA_ContentLayoutProcessor::Result::kDone) {
+ m_pViewLayoutProcessor->FinishPaginatedPageSets();
+ m_pViewLayoutProcessor->SyncLayoutData();
m_bNeedLayout = false;
m_rgChangedContainers.clear();
}
return 100 *
- (eStatus == CXFA_ItemLayoutProcessor::Result::kDone
+ (eStatus == CXFA_ContentLayoutProcessor::Result::kDone
? m_nProgressCounter
: m_nProgressCounter - 1) /
m_nProgressCounter;
@@ -111,11 +111,12 @@
}
int32_t CXFA_LayoutProcessor::CountPages() const {
- return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPageCount() : 0;
+ return m_pViewLayoutProcessor ? m_pViewLayoutProcessor->GetPageCount() : 0;
}
CXFA_ViewLayoutItem* CXFA_LayoutProcessor::GetPage(int32_t index) const {
- return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPage(index) : nullptr;
+ return m_pViewLayoutProcessor ? m_pViewLayoutProcessor->GetPage(index)
+ : nullptr;
}
CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) {
@@ -128,7 +129,8 @@
}
CXFA_ViewLayoutItem* CXFA_LayoutProcessor::GetRootLayoutItem() const {
- return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetRootLayoutItem() : nullptr;
+ return m_pViewLayoutProcessor ? m_pViewLayoutProcessor->GetRootLayoutItem()
+ : nullptr;
}
bool CXFA_LayoutProcessor::IsNeedLayout() {
diff --git a/xfa/fxfa/layout/cxfa_layoutprocessor.h b/xfa/fxfa/layout/cxfa_layoutprocessor.h
index dfaca7b..29cd3d6 100644
--- a/xfa/fxfa/layout/cxfa_layoutprocessor.h
+++ b/xfa/fxfa/layout/cxfa_layoutprocessor.h
@@ -14,11 +14,11 @@
#include "core/fxcrt/unowned_ptr.h"
#include "xfa/fxfa/parser/cxfa_document.h"
-class CXFA_ItemLayoutProcessor;
+class CXFA_ContentLayoutProcessor;
class CXFA_LayoutItem;
-class CXFA_LayoutPageMgr;
class CXFA_Node;
class CXFA_ViewLayoutItem;
+class CXFA_ViewLayoutProcessor;
class CXFA_LayoutProcessor : public CXFA_Document::LayoutProcessorIface {
public:
@@ -38,18 +38,18 @@
CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem);
void AddChangedContainer(CXFA_Node* pContainer);
CXFA_ViewLayoutItem* GetRootLayoutItem() const;
- CXFA_ItemLayoutProcessor* GetRootRootItemLayoutProcessor() const {
- return m_pRootItemLayoutProcessor.get();
+ CXFA_ContentLayoutProcessor* GetRootContentLayoutProcessor() const {
+ return m_pContentLayoutProcessor.get();
}
- CXFA_LayoutPageMgr* GetLayoutPageMgr() const {
- return m_pLayoutPageMgr.get();
+ CXFA_ViewLayoutProcessor* GetLayoutPageMgr() const {
+ return m_pViewLayoutProcessor.get();
}
private:
bool IsNeedLayout();
- std::unique_ptr<CXFA_LayoutPageMgr> m_pLayoutPageMgr;
- std::unique_ptr<CXFA_ItemLayoutProcessor> m_pRootItemLayoutProcessor;
+ std::unique_ptr<CXFA_ViewLayoutProcessor> m_pViewLayoutProcessor;
+ std::unique_ptr<CXFA_ContentLayoutProcessor> m_pContentLayoutProcessor;
std::vector<CXFA_Node*> m_rgChangedContainers;
uint32_t m_nProgressCounter = 0;
bool m_bNeedLayout = true;
diff --git a/xfa/fxfa/layout/cxfa_viewlayoutitem.cpp b/xfa/fxfa/layout/cxfa_viewlayoutitem.cpp
index 77e442a..2920cb4 100644
--- a/xfa/fxfa/layout/cxfa_viewlayoutitem.cpp
+++ b/xfa/fxfa/layout/cxfa_viewlayoutitem.cpp
@@ -10,8 +10,8 @@
#include "fxjs/xfa/cjx_object.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
-#include "xfa/fxfa/layout/cxfa_layoutpagemgr.h"
#include "xfa/fxfa/layout/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/layout/cxfa_viewlayoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_medium.h"
#include "xfa/fxfa/parser/cxfa_node.h"
diff --git a/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
similarity index 92%
rename from xfa/fxfa/layout/cxfa_layoutpagemgr.cpp
rename to xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
index a09b0cd..0605aa6 100644
--- a/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/layout/cxfa_layoutpagemgr.h"
+#include "xfa/fxfa/layout/cxfa_viewlayoutprocessor.h"
#include <utility>
@@ -15,7 +15,7 @@
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/layout/cxfa_contentlayoutitem.h"
-#include "xfa/fxfa/layout/cxfa_itemlayoutprocessor.h"
+#include "xfa/fxfa/layout/cxfa_contentlayoutprocessor.h"
#include "xfa/fxfa/layout/cxfa_layoutprocessor.h"
#include "xfa/fxfa/layout/cxfa_traversestrategy_layoutitem.h"
#include "xfa/fxfa/layout/cxfa_viewlayoutitem.h"
@@ -343,7 +343,8 @@
CXFA_ViewLayoutItem* pCurContentArea;
};
-CXFA_LayoutPageMgr::CXFA_LayoutPageMgr(CXFA_LayoutProcessor* pLayoutProcessor)
+CXFA_ViewLayoutProcessor::CXFA_ViewLayoutProcessor(
+ CXFA_LayoutProcessor* pLayoutProcessor)
: m_pLayoutProcessor(pLayoutProcessor),
m_pTemplatePageSetRoot(nullptr),
m_pPageSetLayoutItemRoot(nullptr),
@@ -355,7 +356,7 @@
m_ePageSetMode(XFA_AttributeValue::OrderedOccurrence),
m_bCreateOverFlowPage(false) {}
-CXFA_LayoutPageMgr::~CXFA_LayoutPageMgr() {
+CXFA_ViewLayoutProcessor::~CXFA_ViewLayoutProcessor() {
ClearData();
CXFA_LayoutItem* pLayoutItem = GetRootLayoutItem();
CXFA_LayoutItem* pNextLayout = nullptr;
@@ -365,7 +366,7 @@
}
}
-bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
+bool CXFA_ViewLayoutProcessor::InitLayoutPage(CXFA_Node* pFormNode) {
PrepareLayout();
CXFA_Node* pTemplateNode = pFormNode->GetTemplateNodeIfExists();
if (!pTemplateNode)
@@ -456,7 +457,7 @@
return true;
}
-bool CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) {
+bool CXFA_ViewLayoutProcessor::PrepareFirstPage(CXFA_Node* pRootSubform) {
bool bProBreakBefore = false;
const CXFA_Node* pBreakBeforeNode = nullptr;
while (pRootSubform) {
@@ -493,7 +494,7 @@
return AppendNewPage(true);
}
-bool CXFA_LayoutPageMgr::AppendNewPage(bool bFirstTemPage) {
+bool CXFA_ViewLayoutProcessor::AppendNewPage(bool bFirstTemPage) {
if (m_CurrentViewRecordIter != GetTailPosition())
return true;
@@ -506,8 +507,9 @@
return !bFirstTemPage || HasCurrentViewRecord();
}
-void CXFA_LayoutPageMgr::RemoveLayoutRecord(CXFA_ViewRecord* pNewRecord,
- CXFA_ViewRecord* pPrevRecord) {
+void CXFA_ViewLayoutProcessor::RemoveLayoutRecord(
+ CXFA_ViewRecord* pNewRecord,
+ CXFA_ViewRecord* pPrevRecord) {
if (!pNewRecord || !pPrevRecord)
return;
if (pNewRecord->pCurPageSet != pPrevRecord->pCurPageSet) {
@@ -524,7 +526,7 @@
}
}
-void CXFA_LayoutPageMgr::ReorderPendingLayoutRecordToTail(
+void CXFA_ViewLayoutProcessor::ReorderPendingLayoutRecordToTail(
CXFA_ViewRecord* pNewRecord,
CXFA_ViewRecord* pPrevRecord) {
if (!pNewRecord || !pPrevRecord)
@@ -543,17 +545,17 @@
}
}
-void CXFA_LayoutPageMgr::SubmitContentItem(
+void CXFA_ViewLayoutProcessor::SubmitContentItem(
CXFA_ContentLayoutItem* pContentLayoutItem,
- CXFA_ItemLayoutProcessor::Result eStatus) {
+ CXFA_ContentLayoutProcessor::Result eStatus) {
if (pContentLayoutItem) {
GetCurrentViewRecord()->pCurContentArea->AppendLastChild(
pContentLayoutItem);
m_bCreateOverFlowPage = false;
}
- if (eStatus != CXFA_ItemLayoutProcessor::Result::kDone) {
- if (eStatus == CXFA_ItemLayoutProcessor::Result::kPageFullBreak &&
+ if (eStatus != CXFA_ContentLayoutProcessor::Result::kDone) {
+ if (eStatus == CXFA_ContentLayoutProcessor::Result::kPageFullBreak &&
m_CurrentViewRecordIter == GetTailPosition()) {
AppendNewPage(false);
}
@@ -562,7 +564,7 @@
}
}
-float CXFA_LayoutPageMgr::GetAvailHeight() {
+float CXFA_ViewLayoutProcessor::GetAvailHeight() {
CXFA_ViewLayoutItem* pLayoutItem = GetCurrentViewRecord()->pCurContentArea;
if (!pLayoutItem || !pLayoutItem->GetFormNode())
return 0.0f;
@@ -576,14 +578,15 @@
return FLT_MAX;
}
-CXFA_ViewRecord* CXFA_LayoutPageMgr::AppendNewRecord(
+CXFA_ViewRecord* CXFA_ViewLayoutProcessor::AppendNewRecord(
std::unique_ptr<CXFA_ViewRecord> pNewRecord) {
m_ProposedViewRecords.push_back(std::move(pNewRecord));
return m_ProposedViewRecords.back().get();
}
-CXFA_ViewRecord* CXFA_LayoutPageMgr::CreateViewRecord(CXFA_Node* pPageNode,
- bool bCreateNew) {
+CXFA_ViewRecord* CXFA_ViewLayoutProcessor::CreateViewRecord(
+ CXFA_Node* pPageNode,
+ bool bCreateNew) {
ASSERT(pPageNode);
auto pNewRecord = pdfium::MakeUnique<CXFA_ViewRecord>();
if (!HasCurrentViewRecord()) {
@@ -645,7 +648,7 @@
return AppendNewRecord(std::move(pNewRecord));
}
-CXFA_ViewRecord* CXFA_LayoutPageMgr::CreateViewRecordSimple() {
+CXFA_ViewRecord* CXFA_ViewLayoutProcessor::CreateViewRecordSimple() {
auto pNewRecord = pdfium::MakeUnique<CXFA_ViewRecord>();
if (HasCurrentViewRecord())
*pNewRecord = *GetCurrentViewRecord();
@@ -654,8 +657,9 @@
return AppendNewRecord(std::move(pNewRecord));
}
-void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ViewRecord* pNewRecord,
- CXFA_Node* pNewPageArea) {
+void CXFA_ViewLayoutProcessor::AddPageAreaLayoutItem(
+ CXFA_ViewRecord* pNewRecord,
+ CXFA_Node* pNewPageArea) {
CXFA_ViewLayoutItem* pNewPageAreaLayoutItem = nullptr;
if (pdfium::IndexInBounds(m_PageArray, m_nAvailPages)) {
CXFA_ViewLayoutItem* pViewItem = m_PageArray[m_nAvailPages];
@@ -678,8 +682,9 @@
pNewRecord->pCurContentArea = nullptr;
}
-void CXFA_LayoutPageMgr::AddContentAreaLayoutItem(CXFA_ViewRecord* pNewRecord,
- CXFA_Node* pContentArea) {
+void CXFA_ViewLayoutProcessor::AddContentAreaLayoutItem(
+ CXFA_ViewRecord* pNewRecord,
+ CXFA_Node* pContentArea) {
if (!pContentArea) {
pNewRecord->pCurContentArea = nullptr;
return;
@@ -691,7 +696,7 @@
pNewRecord->pCurContentArea = pNewViewLayoutItem;
}
-void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
+void CXFA_ViewLayoutProcessor::FinishPaginatedPageSets() {
for (CXFA_ViewLayoutItem* pRootPageSetLayoutItem = m_pPageSetLayoutItemRoot;
pRootPageSetLayoutItem; pRootPageSetLayoutItem = ToViewLayoutItem(
pRootPageSetLayoutItem->GetNextSibling())) {
@@ -716,26 +721,26 @@
}
}
-int32_t CXFA_LayoutPageMgr::GetPageCount() const {
+int32_t CXFA_ViewLayoutProcessor::GetPageCount() const {
return pdfium::CollectionSize<int32_t>(m_PageArray);
}
-CXFA_ViewLayoutItem* CXFA_LayoutPageMgr::GetPage(int32_t index) const {
+CXFA_ViewLayoutItem* CXFA_ViewLayoutProcessor::GetPage(int32_t index) const {
if (!pdfium::IndexInBounds(m_PageArray, index))
return nullptr;
return m_PageArray[index];
}
-int32_t CXFA_LayoutPageMgr::GetPageIndex(
+int32_t CXFA_ViewLayoutProcessor::GetPageIndex(
const CXFA_ViewLayoutItem* pPage) const {
auto it = std::find(m_PageArray.begin(), m_PageArray.end(), pPage);
return it != m_PageArray.end() ? it - m_PageArray.begin() : -1;
}
-bool CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType,
- XFA_AttributeValue eTargetType,
- CXFA_Node* pTarget,
- bool bStartNew) {
+bool CXFA_ViewLayoutProcessor::RunBreak(XFA_Element eBreakType,
+ XFA_AttributeValue eTargetType,
+ CXFA_Node* pTarget,
+ bool bStartNew) {
bool bRet = false;
switch (eTargetType) {
case XFA_AttributeValue::ContentArea:
@@ -774,15 +779,15 @@
return bRet;
}
-bool CXFA_LayoutPageMgr::ShouldGetNextPageArea(CXFA_Node* pTarget,
- bool bStartNew) const {
+bool CXFA_ViewLayoutProcessor::ShouldGetNextPageArea(CXFA_Node* pTarget,
+ bool bStartNew) const {
return bStartNew || !pTarget || !HasCurrentViewRecord() ||
pTarget != GetCurrentViewRecord()->pCurPageArea->GetFormNode();
}
-CXFA_LayoutPageMgr::BreakData CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter(
- const CXFA_Node* pCurNode,
- bool bBefore) {
+CXFA_ViewLayoutProcessor::BreakData
+CXFA_ViewLayoutProcessor::ExecuteBreakBeforeOrAfter(const CXFA_Node* pCurNode,
+ bool bBefore) {
BreakData ret = {nullptr, nullptr, false};
XFA_Element eType = pCurNode->GetElementType();
switch (eType) {
@@ -851,19 +856,19 @@
return ret;
}
-Optional<CXFA_LayoutPageMgr::BreakData> CXFA_LayoutPageMgr::ProcessBreakBefore(
- const CXFA_Node* pBreakNode) {
+Optional<CXFA_ViewLayoutProcessor::BreakData>
+CXFA_ViewLayoutProcessor::ProcessBreakBefore(const CXFA_Node* pBreakNode) {
return ProcessBreakBeforeOrAfter(pBreakNode, /*before=*/true);
}
-Optional<CXFA_LayoutPageMgr::BreakData> CXFA_LayoutPageMgr::ProcessBreakAfter(
- const CXFA_Node* pBreakNode) {
+Optional<CXFA_ViewLayoutProcessor::BreakData>
+CXFA_ViewLayoutProcessor::ProcessBreakAfter(const CXFA_Node* pBreakNode) {
return ProcessBreakBeforeOrAfter(pBreakNode, /*before=*/false);
}
-Optional<CXFA_LayoutPageMgr::BreakData>
-CXFA_LayoutPageMgr::ProcessBreakBeforeOrAfter(const CXFA_Node* pBreakNode,
- bool bBefore) {
+Optional<CXFA_ViewLayoutProcessor::BreakData>
+CXFA_ViewLayoutProcessor::ProcessBreakBeforeOrAfter(const CXFA_Node* pBreakNode,
+ bool bBefore) {
CXFA_Node* pFormNode = pBreakNode->GetContainerParent();
if (!pFormNode->PresenceRequiresSpace())
return pdfium::nullopt;
@@ -903,17 +908,17 @@
return break_data;
}
-CXFA_Node* CXFA_LayoutPageMgr::ProcessBookendLeader(
+CXFA_Node* CXFA_ViewLayoutProcessor::ProcessBookendLeader(
const CXFA_Node* pBookendNode) {
return ProcessBookendLeaderOrTrailer(pBookendNode, /*leader=*/true);
}
-CXFA_Node* CXFA_LayoutPageMgr::ProcessBookendTrailer(
+CXFA_Node* CXFA_ViewLayoutProcessor::ProcessBookendTrailer(
const CXFA_Node* pBookendNode) {
return ProcessBookendLeaderOrTrailer(pBookendNode, /*leader=*/false);
}
-CXFA_Node* CXFA_LayoutPageMgr::ProcessBookendLeaderOrTrailer(
+CXFA_Node* CXFA_ViewLayoutProcessor::ProcessBookendLeaderOrTrailer(
const CXFA_Node* pBookendNode,
bool bLeader) {
CXFA_Node* pFormNode = pBookendNode->GetContainerParent();
@@ -934,10 +939,10 @@
return pBookendAppendNode;
}
-bool CXFA_LayoutPageMgr::BreakOverflow(const CXFA_Node* pOverflowNode,
- bool bCreatePage,
- CXFA_Node** pLeaderTemplate,
- CXFA_Node** pTrailerTemplate) {
+bool CXFA_ViewLayoutProcessor::BreakOverflow(const CXFA_Node* pOverflowNode,
+ bool bCreatePage,
+ CXFA_Node** pLeaderTemplate,
+ CXFA_Node** pTrailerTemplate) {
CXFA_Node* pContainer =
pOverflowNode->GetContainerParent()->GetTemplateNodeIfExists();
if (pOverflowNode->GetElementType() == XFA_Element::Break) {
@@ -1015,9 +1020,9 @@
return true;
}
-Optional<CXFA_LayoutPageMgr::OverflowData> CXFA_LayoutPageMgr::ProcessOverflow(
- CXFA_Node* pFormNode,
- bool bCreatePage) {
+Optional<CXFA_ViewLayoutProcessor::OverflowData>
+CXFA_ViewLayoutProcessor::ProcessOverflow(CXFA_Node* pFormNode,
+ bool bCreatePage) {
if (!pFormNode)
return pdfium::nullopt;
@@ -1067,7 +1072,7 @@
return pdfium::nullopt;
}
-CXFA_Node* CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer(
+CXFA_Node* CXFA_ViewLayoutProcessor::ResolveBookendLeaderOrTrailer(
const CXFA_Node* pBookendNode,
bool bLeader) {
CXFA_Node* pContainer =
@@ -1088,12 +1093,13 @@
return ResolveBreakTarget(pContainer, true, &leader);
}
-bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet(CXFA_Node* pPageSet,
- CXFA_Node* pStartChild,
- CXFA_Node* pTargetPageArea,
- CXFA_Node* pTargetContentArea,
- bool bNewPage,
- bool bQuery) {
+bool CXFA_ViewLayoutProcessor::FindPageAreaFromPageSet(
+ CXFA_Node* pPageSet,
+ CXFA_Node* pStartChild,
+ CXFA_Node* pTargetPageArea,
+ CXFA_Node* pTargetContentArea,
+ bool bNewPage,
+ bool bQuery) {
if (!pPageSet && !pStartChild)
return false;
@@ -1110,7 +1116,7 @@
bQuery, ePreferredPosition);
}
-bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered(
+bool CXFA_ViewLayoutProcessor::FindPageAreaFromPageSet_Ordered(
CXFA_Node* pPageSet,
CXFA_Node* pStartChild,
CXFA_Node* pTargetPageArea,
@@ -1183,7 +1189,7 @@
return bRes;
}
-bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex(
+bool CXFA_ViewLayoutProcessor::FindPageAreaFromPageSet_SimplexDuplex(
CXFA_Node* pPageSet,
CXFA_Node* pStartChild,
CXFA_Node* pTargetPageArea,
@@ -1291,7 +1297,7 @@
return true;
}
-bool CXFA_LayoutPageMgr::MatchPageAreaOddOrEven(CXFA_Node* pPageArea) {
+bool CXFA_ViewLayoutProcessor::MatchPageAreaOddOrEven(CXFA_Node* pPageArea) {
if (m_ePageSetMode != XFA_AttributeValue::DuplexPaginated)
return true;
@@ -1304,7 +1310,7 @@
return *ret == XFA_AttributeValue::Odd ? iPageLast == 0 : iPageLast == 1;
}
-CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea(
+CXFA_Node* CXFA_ViewLayoutProcessor::GetNextAvailPageArea(
CXFA_Node* pTargetPageArea,
CXFA_Node* pTargetContentArea,
bool bNewPage,
@@ -1375,7 +1381,7 @@
return nullptr;
}
-bool CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) {
+bool CXFA_ViewLayoutProcessor::GetNextContentArea(CXFA_Node* pContentArea) {
CXFA_Node* pCurContentNode =
GetCurrentViewRecord()->pCurContentArea->GetFormNode();
if (!pContentArea) {
@@ -1406,7 +1412,7 @@
return true;
}
-void CXFA_LayoutPageMgr::InitPageSetMap() {
+void CXFA_ViewLayoutProcessor::InitPageSetMap() {
if (!IsPageSetRootOrderedOccurrence())
return;
@@ -1422,9 +1428,9 @@
}
}
-int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea,
- bool bTargetPageArea,
- bool bCreateLast) {
+int32_t CXFA_ViewLayoutProcessor::CreateMinPageRecord(CXFA_Node* pPageArea,
+ bool bTargetPageArea,
+ bool bCreateLast) {
if (!pPageArea)
return 0;
@@ -1458,8 +1464,8 @@
return iMin;
}
-void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet,
- bool bCreateAll) {
+void CXFA_ViewLayoutProcessor::CreateMinPageSetRecord(CXFA_Node* pPageSet,
+ bool bCreateAll) {
if (!pPageSet)
return;
@@ -1493,7 +1499,7 @@
m_pPageSetMap[pPageSet] = *iMin;
}
-void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) {
+void CXFA_ViewLayoutProcessor::CreateNextMinRecord(CXFA_Node* pRecordNode) {
if (!pRecordNode)
return;
@@ -1506,7 +1512,7 @@
}
}
-void CXFA_LayoutPageMgr::ProcessLastPageSet() {
+void CXFA_ViewLayoutProcessor::ProcessLastPageSet() {
CreateMinPageRecord(m_pCurPageArea, false, true);
CreateNextMinRecord(m_pCurPageArea);
CXFA_Node* pPageSet = m_pCurPageArea->GetParent();
@@ -1520,7 +1526,7 @@
}
}
-bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) {
+bool CXFA_ViewLayoutProcessor::GetNextAvailContentHeight(float fChildHeight) {
CXFA_Node* pCurContentNode =
GetCurrentViewRecord()->pCurContentArea->GetFormNode();
if (!pCurContentNode)
@@ -1586,7 +1592,7 @@
fNextContentHeight > fChildHeight;
}
-void CXFA_LayoutPageMgr::ClearData() {
+void CXFA_ViewLayoutProcessor::ClearData() {
if (!m_pTemplatePageSetRoot)
return;
@@ -1598,7 +1604,7 @@
m_pPageSetMap.clear();
}
-void CXFA_LayoutPageMgr::SaveLayoutItemChildren(
+void CXFA_ViewLayoutProcessor::SaveLayoutItemChildren(
CXFA_LayoutItem* pParentLayoutItem) {
CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument();
CXFA_FFNotify* pNotify = pDocument->GetNotify();
@@ -1626,7 +1632,7 @@
}
}
-CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) {
+CXFA_Node* CXFA_ViewLayoutProcessor::QueryOverflow(CXFA_Node* pFormNode) {
for (CXFA_Node* pCurNode = pFormNode->GetFirstChild(); pCurNode;
pCurNode = pCurNode->GetNextSibling()) {
if (pCurNode->GetElementType() == XFA_Element::Break) {
@@ -1649,7 +1655,7 @@
return nullptr;
}
-void CXFA_LayoutPageMgr::MergePageSetContents() {
+void CXFA_ViewLayoutProcessor::MergePageSetContents() {
CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument();
pDocument->SetPendingNodesUnusedAndUnbound();
@@ -1825,7 +1831,7 @@
}
}
-void CXFA_LayoutPageMgr::LayoutPageSetContents() {
+void CXFA_ViewLayoutProcessor::LayoutPageSetContents() {
for (CXFA_ViewLayoutItem* pRootLayoutItem = GetRootLayoutItem();
pRootLayoutItem;
pRootLayoutItem = ToViewLayoutItem(pRootLayoutItem->GetNextSibling())) {
@@ -1836,13 +1842,13 @@
if (type != XFA_Element::PageArea)
continue;
- m_pLayoutProcessor->GetRootRootItemLayoutProcessor()->DoLayoutPageArea(
+ m_pLayoutProcessor->GetRootContentLayoutProcessor()->DoLayoutPageArea(
pViewItem);
}
}
}
-void CXFA_LayoutPageMgr::SyncLayoutData() {
+void CXFA_ViewLayoutProcessor::SyncLayoutData() {
MergePageSetContents();
LayoutPageSetContents();
CXFA_FFNotify* pNotify = m_pTemplatePageSetRoot->GetDocument()->GetNotify();
@@ -1897,7 +1903,7 @@
ClearData();
}
-void CXFA_LayoutPageMgr::PrepareLayout() {
+void CXFA_ViewLayoutProcessor::PrepareLayout() {
m_pPageSetCurRoot = nullptr;
m_ePageSetMode = XFA_AttributeValue::OrderedOccurrence;
m_nAvailPages = 0;
@@ -1940,7 +1946,7 @@
m_pPageSetLayoutItemRoot = nullptr;
}
-void CXFA_LayoutPageMgr::ProcessSimplexOrDuplexPageSets(
+void CXFA_ViewLayoutProcessor::ProcessSimplexOrDuplexPageSets(
CXFA_ViewLayoutItem* pPageSetLayoutItem,
bool bIsSimplex) {
size_t nPageAreaCount;
diff --git a/xfa/fxfa/layout/cxfa_layoutpagemgr.h b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.h
similarity index 93%
rename from xfa/fxfa/layout/cxfa_layoutpagemgr.h
rename to xfa/fxfa/layout/cxfa_viewlayoutprocessor.h
index 335e22d..332cbc0 100644
--- a/xfa/fxfa/layout/cxfa_layoutpagemgr.h
+++ b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_LAYOUT_CXFA_LAYOUTPAGEMGR_H_
-#define XFA_FXFA_LAYOUT_CXFA_LAYOUTPAGEMGR_H_
+#ifndef XFA_FXFA_LAYOUT_CXFA_VIEWLAYOUTPROCESSOR_H_
+#define XFA_FXFA_LAYOUT_CXFA_VIEWLAYOUTPROCESSOR_H_
#include <iterator>
#include <list>
@@ -14,13 +14,13 @@
#include <vector>
#include "third_party/base/optional.h"
-#include "xfa/fxfa/layout/cxfa_itemlayoutprocessor.h"
+#include "xfa/fxfa/layout/cxfa_contentlayoutprocessor.h"
class CXFA_LayoutItem;
class CXFA_Node;
class CXFA_ViewRecord;
-class CXFA_LayoutPageMgr {
+class CXFA_ViewLayoutProcessor {
public:
struct BreakData {
CXFA_Node* pLeader;
@@ -33,15 +33,15 @@
CXFA_Node* pTrailer;
};
- explicit CXFA_LayoutPageMgr(CXFA_LayoutProcessor* pLayoutProcessor);
- ~CXFA_LayoutPageMgr();
+ explicit CXFA_ViewLayoutProcessor(CXFA_LayoutProcessor* pLayoutProcessor);
+ ~CXFA_ViewLayoutProcessor();
bool InitLayoutPage(CXFA_Node* pFormNode);
bool PrepareFirstPage(CXFA_Node* pRootSubform);
float GetAvailHeight();
bool GetNextAvailContentHeight(float fChildHeight);
void SubmitContentItem(CXFA_ContentLayoutItem* pContentLayoutItem,
- CXFA_ItemLayoutProcessor::Result eStatus);
+ CXFA_ContentLayoutProcessor::Result eStatus);
void FinishPaginatedPageSets();
void SyncLayoutData();
int32_t GetPageCount() const;
@@ -165,4 +165,4 @@
std::vector<CXFA_ViewLayoutItem*> m_PageArray;
};
-#endif // XFA_FXFA_LAYOUT_CXFA_LAYOUTPAGEMGR_H_
+#endif // XFA_FXFA_LAYOUT_CXFA_VIEWLAYOUTPROCESSOR_H_