summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-29 23:18:09 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-29 23:18:09 +0000
commit09646f2d0497eb4cdcf2f3843585faa9264196f4 (patch)
tree82b6ec32ab2edd616a1ea99b11ef8459bef7efaf /xfa/fxfa/parser
parent0894dc84013cd6a814136ccd40f585fc2eb895f3 (diff)
downloadpdfium-09646f2d0497eb4cdcf2f3843585faa9264196f4.tar.xz
Use UnownedPtr<CXFA_Node> or comment raw pointers as tree nodes.chromium/3479chromium/3478
Part 2. Change-Id: I26fe434dac3c3f5186414440acc2a495a5f14091 Reviewed-on: https://pdfium-review.googlesource.com/36670 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_attachnodelist.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_attachnodelist.h3
-rw-r--r--xfa/fxfa/parser/cxfa_containerlayoutitem.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_containerlayoutitem.h3
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp233
-rw-r--r--xfa/fxfa/parser/cxfa_layoutitem.cpp16
-rw-r--r--xfa/fxfa/parser/cxfa_layoutitem.h13
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp141
8 files changed, 220 insertions, 201 deletions
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.cpp b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
index 4e6a678162..e7d4c1d04a 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
@@ -11,9 +11,9 @@
CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument,
CXFA_Node* pAttachNode)
- : CXFA_TreeList(pDocument) {
- m_pAttachNode = pAttachNode;
-}
+ : CXFA_TreeList(pDocument), m_pAttachNode(pAttachNode) {}
+
+CXFA_AttachNodeList::~CXFA_AttachNodeList() = default;
size_t CXFA_AttachNodeList::GetLength() {
return m_pAttachNode->CountChildren(
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.h b/xfa/fxfa/parser/cxfa_attachnodelist.h
index cb41b73797..f4cebe48f8 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.h
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.h
@@ -15,6 +15,7 @@ class CXFA_Node;
class CXFA_AttachNodeList : public CXFA_TreeList {
public:
CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode);
+ ~CXFA_AttachNodeList() override;
// From CXFA_TreeList.
size_t GetLength() override;
@@ -24,7 +25,7 @@ class CXFA_AttachNodeList : public CXFA_TreeList {
CXFA_Node* Item(size_t iIndex) override;
private:
- CXFA_Node* m_pAttachNode;
+ UnownedPtr<CXFA_Node> const m_pAttachNode;
};
#endif // XFA_FXFA_PARSER_CXFA_ATTACHNODELIST_H_
diff --git a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp
index ee122b6770..47da2b1798 100644
--- a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp
+++ b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp
@@ -14,7 +14,9 @@
#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_ContainerLayoutItem::CXFA_ContainerLayoutItem(CXFA_Node* pNode)
- : CXFA_LayoutItem(pNode, false), m_pOldSubform(nullptr) {}
+ : CXFA_LayoutItem(pNode, false) {}
+
+CXFA_ContainerLayoutItem::~CXFA_ContainerLayoutItem() = default;
CXFA_LayoutProcessor* CXFA_ContainerLayoutItem::GetLayout() const {
return m_pFormNode->GetDocument()->GetLayoutProcessor();
@@ -48,5 +50,5 @@ CFX_SizeF CXFA_ContainerLayoutItem::GetPageSize() const {
}
CXFA_Node* CXFA_ContainerLayoutItem::GetMasterPage() const {
- return m_pFormNode;
+ return m_pFormNode.Get();
}
diff --git a/xfa/fxfa/parser/cxfa_containerlayoutitem.h b/xfa/fxfa/parser/cxfa_containerlayoutitem.h
index 3c8a8afa22..4a02333ef5 100644
--- a/xfa/fxfa/parser/cxfa_containerlayoutitem.h
+++ b/xfa/fxfa/parser/cxfa_containerlayoutitem.h
@@ -12,13 +12,14 @@
class CXFA_ContainerLayoutItem : public CXFA_LayoutItem {
public:
explicit CXFA_ContainerLayoutItem(CXFA_Node* pNode);
+ ~CXFA_ContainerLayoutItem() override;
CXFA_LayoutProcessor* GetLayout() const;
int32_t GetPageIndex() const;
CFX_SizeF GetPageSize() const;
CXFA_Node* GetMasterPage() const;
- CXFA_Node* m_pOldSubform;
+ UnownedPtr<CXFA_Node> m_pOldSubform;
};
inline CXFA_ContainerLayoutItem* ToContainerLayoutItem(CXFA_LayoutItem* pItem) {
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index f4f1ceb708..2dfa956ee0 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -62,7 +62,7 @@ std::vector<WideString> SeparateStringW(const wchar_t* pStr,
void UpdateWidgetSize(CXFA_ContentLayoutItem* pLayoutItem,
float* pWidth,
float* pHeight) {
- CXFA_Node* pNode = pLayoutItem->m_pFormNode;
+ CXFA_Node* pNode = pLayoutItem->GetFormNode();
switch (pNode->GetElementType()) {
case XFA_Element::Subform:
case XFA_Element::Area:
@@ -177,10 +177,10 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow,
bool bContainerWidthAutoSize = true;
bool bContainerHeightAutoSize = true;
CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
- pLayoutRow->m_pFormNode, &bContainerWidthAutoSize,
+ pLayoutRow->GetFormNode(), &bContainerWidthAutoSize,
&bContainerHeightAutoSize);
CXFA_Margin* pMarginNode =
- pLayoutRow->m_pFormNode->GetFirstChildByClass<CXFA_Margin>(
+ pLayoutRow->GetFormNode()->GetFirstChildByClass<CXFA_Margin>(
XFA_Element::Margin);
float fLeftInset = 0;
float fTopInset = 0;
@@ -217,7 +217,7 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow,
pLayoutChild; pLayoutChild = static_cast<CXFA_ContentLayoutItem*>(
pLayoutChild->m_pNextSibling)) {
int32_t nOriginalColSpan =
- pLayoutChild->m_pFormNode->JSObject()->GetInteger(
+ pLayoutChild->GetFormNode()->JSObject()->GetInteger(
XFA_Attribute::ColSpan);
int32_t nColSpan = nOriginalColSpan;
float fColSpanWidth = 0;
@@ -240,7 +240,7 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow,
pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0);
pLayoutChild->m_sSize.width = fColSpanWidth;
- if (!pLayoutChild->m_pFormNode->PresenceRequiresSpace())
+ if (!pLayoutChild->GetFormNode()->PresenceRequiresSpace())
continue;
fCurrentColX += fColSpanWidth;
@@ -263,7 +263,7 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow,
float fOldChildHeight = pLayoutChild->m_sSize.height;
pLayoutChild->m_sSize.height = fContentCalculatedHeight;
CXFA_Para* pParaNode =
- pLayoutChild->m_pFormNode->GetFirstChildByClass<CXFA_Para>(
+ pLayoutChild->GetFormNode()->GetFirstChildByClass<CXFA_Para>(
XFA_Element::Para);
if (pParaNode && pLayoutChild->m_pFirstChild) {
float fOffHeight = fContentCalculatedHeight - fOldChildHeight;
@@ -303,7 +303,7 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow,
fContentCalculatedWidth = containerSize.width - fLeftInset - fRightInset;
}
- if (pLayoutRow->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout) ==
+ if (pLayoutRow->GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout) ==
XFA_AttributeEnum::Rl_row) {
for (CXFA_LayoutItem* pIter = pLayoutRow->m_pFirstChild; pIter;
pIter = pIter->m_pNextSibling) {
@@ -314,8 +314,9 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow,
}
}
pLayoutRow->m_sSize = CalculateContainerComponentSizeFromContentSize(
- pLayoutRow->m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
- bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
+ pLayoutRow->GetFormNode(), bContainerWidthAutoSize,
+ fContentCalculatedWidth, bContainerHeightAutoSize,
+ fContentCalculatedHeight, containerSize);
}
XFA_AttributeEnum GetLayout(CXFA_Node* pFormNode, bool* bRootForceTb) {
@@ -465,7 +466,7 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem,
float* fProposedSplitPos,
bool* bAppChange,
bool bCalculateMargin) {
- CXFA_Node* pFormNode = pLayoutItem->m_pFormNode;
+ CXFA_Node* pFormNode = pLayoutItem->GetFormNode();
if (*fProposedSplitPos <= fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION ||
*fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.height -
XFA_LAYOUT_FLOAT_PERCISION) {
@@ -619,10 +620,11 @@ CFX_PointF CalculatePositionedContainerPos(CXFA_Node* pNode,
CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode,
CXFA_LayoutPageMgr* pPageMgr)
: m_pFormNode(pNode), m_pPageMgr(pPageMgr) {
- ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() ||
- m_pFormNode->GetElementType() == XFA_Element::Form));
+ ASSERT(GetFormNode());
+ ASSERT(GetFormNode()->IsContainerNode() ||
+ GetFormNode()->GetElementType() == XFA_Element::Form);
m_pOldLayoutItem = static_cast<CXFA_ContentLayoutItem*>(
- m_pFormNode->JSObject()->GetLayoutItem());
+ GetFormNode()->JSObject()->GetLayoutItem());
}
CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {}
@@ -658,7 +660,8 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem(
float CXFA_ItemLayoutProcessor::FindSplitPos(float fProposedSplitPos) {
ASSERT(m_pLayoutItem);
- XFA_AttributeEnum eLayout = m_pFormNode->JSObject()
+ XFA_AttributeEnum eLayout = GetFormNode()
+ ->JSObject()
->TryEnum(XFA_Attribute::Layout, true)
.value_or(XFA_AttributeEnum::Position);
bool bCalculateMargin = eLayout != XFA_AttributeEnum::Position;
@@ -677,7 +680,8 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(
CXFA_ContentLayoutItem* pSecondParent,
float fSplitPos) {
float fCurTopMargin = 0, fCurBottomMargin = 0;
- XFA_AttributeEnum eLayout = m_pFormNode->JSObject()
+ XFA_AttributeEnum eLayout = GetFormNode()
+ ->JSObject()
->TryEnum(XFA_Attribute::Layout, true)
.value_or(XFA_AttributeEnum::Position);
bool bCalculateMargin = true;
@@ -685,7 +689,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(
bCalculateMargin = false;
CXFA_Margin* pMarginNode =
- pLayoutItem->m_pFormNode->GetFirstChildByClass<CXFA_Margin>(
+ pLayoutItem->GetFormNode()->GetFirstChildByClass<CXFA_Margin>(
XFA_Element::Margin);
if (pMarginNode && bCalculateMargin) {
fCurTopMargin = pMarginNode->JSObject()
@@ -698,11 +702,11 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(
CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr;
if (m_pCurChildPreprocessor &&
- m_pCurChildPreprocessor->m_pFormNode == pLayoutItem->m_pFormNode) {
+ m_pCurChildPreprocessor->GetFormNode() == pLayoutItem->GetFormNode()) {
pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem(
- pLayoutItem->m_pFormNode);
+ pLayoutItem->GetFormNode());
} else {
- pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->m_pFormNode);
+ pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->GetFormNode());
}
pSecondLayoutItem->m_sPos.x = pLayoutItem->m_sPos.x;
pSecondLayoutItem->m_sSize.width = pLayoutItem->m_sSize.width;
@@ -742,7 +746,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(
pChildItem->m_pNextSibling = nullptr;
if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin +
XFA_LAYOUT_FLOAT_PERCISION) {
- if (!ExistContainerKeep(pChildItem->m_pFormNode, true)) {
+ if (!ExistContainerKeep(pChildItem->GetFormNode(), true)) {
pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin;
pChildItem->m_sPos.y += lHeightForKeep;
pChildItem->m_sPos.y += fAddMarginHeight;
@@ -775,7 +779,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(
fCurTopMargin + fCurBottomMargin + pChildItem->m_sPos.y +
pChildItem->m_sSize.height) {
pLayoutItem->AddChild(pChildItem);
- if (ExistContainerKeep(pChildItem->m_pFormNode, false))
+ if (ExistContainerKeep(pChildItem->GetFormNode(), false))
keepLayoutItems.push_back(pChildItem);
else
keepLayoutItems.clear();
@@ -813,9 +817,9 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() {
m_pOldLayoutItem->m_pPrev->m_pNext = nullptr;
CXFA_FFNotify* pNotify =
- m_pOldLayoutItem->m_pFormNode->GetDocument()->GetNotify();
+ m_pOldLayoutItem->GetFormNode()->GetDocument()->GetNotify();
CXFA_LayoutProcessor* pDocLayout =
- m_pOldLayoutItem->m_pFormNode->GetDocument()->GetLayoutProcessor();
+ m_pOldLayoutItem->GetFormNode()->GetDocument()->GetLayoutProcessor();
CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem;
while (pOldLayoutItem) {
CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext;
@@ -1044,7 +1048,7 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore(
void CXFA_ItemLayoutProcessor::DoLayoutPageArea(
CXFA_ContainerLayoutItem* pPageAreaLayoutItem) {
- CXFA_Node* pFormNode = pPageAreaLayoutItem->m_pFormNode;
+ CXFA_Node* pFormNode = pPageAreaLayoutItem->GetFormNode();
CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE;
XFA_ItemLayoutProcessorStages nCurChildNodeStage =
XFA_ItemLayoutProcessorStages::None;
@@ -1079,11 +1083,11 @@ void CXFA_ItemLayoutProcessor::DoLayoutPageArea(
CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild;
while (pLayoutItem) {
if (!pLayoutItem->IsContentLayoutItem() ||
- pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw) {
+ pLayoutItem->GetFormNode()->GetElementType() != XFA_Element::Draw) {
pLayoutItem = pLayoutItem->m_pNextSibling;
continue;
}
- if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw)
+ if (pLayoutItem->GetFormNode()->GetElementType() != XFA_Element::Draw)
continue;
CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling;
@@ -1103,28 +1107,29 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer(
if (m_pLayoutItem)
return;
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
- bool bIgnoreXY = (m_pFormNode->JSObject()
+ m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
+ bool bIgnoreXY = (GetFormNode()
+ ->JSObject()
->TryEnum(XFA_Attribute::Layout, true)
.value_or(XFA_AttributeEnum::Position) !=
XFA_AttributeEnum::Position);
bool bContainerWidthAutoSize = true;
bool bContainerHeightAutoSize = true;
CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
- m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize);
+ GetFormNode(), &bContainerWidthAutoSize, &bContainerHeightAutoSize);
float fContentCalculatedWidth = 0;
float fContentCalculatedHeight = 0;
float fHiddenContentCalculatedWidth = 0;
float fHiddenContentCalculatedHeight = 0;
if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) {
- GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, m_pFormNode,
+ GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(),
false);
}
int32_t iColIndex = 0;
for (; m_pCurChildNode; GotoNextContainerNode(
- m_pCurChildNode, &m_nCurChildNodeStage, m_pFormNode, false)) {
+ m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(), false)) {
if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
continue;
if (m_pCurChildNode->GetElementType() == XFA_Element::Variables)
@@ -1197,14 +1202,14 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer(
m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem());
}
- XFA_VERSION eVersion = m_pFormNode->GetDocument()->GetCurVersionMode();
+ XFA_VERSION eVersion = GetFormNode()->GetDocument()->GetCurVersionMode();
if (fContentCalculatedWidth == 0 && eVersion < XFA_VERSION_207)
fContentCalculatedWidth = fHiddenContentCalculatedWidth;
if (fContentCalculatedHeight == 0 && eVersion < XFA_VERSION_207)
fContentCalculatedHeight = fHiddenContentCalculatedHeight;
containerSize = CalculateContainerComponentSizeFromContentSize(
- m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
+ GetFormNode(), bContainerWidthAutoSize, fContentCalculatedWidth,
bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
SetCurrentComponentSize(containerSize);
}
@@ -1213,19 +1218,19 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
if (m_pLayoutItem)
return;
if (!pLayoutNode)
- pLayoutNode = m_pFormNode;
+ pLayoutNode = GetFormNode();
ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE);
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+ m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
bool bContainerWidthAutoSize = true;
bool bContainerHeightAutoSize = true;
CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
- m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize);
+ GetFormNode(), &bContainerWidthAutoSize, &bContainerHeightAutoSize);
float fContentCalculatedWidth = 0;
float fContentCalculatedHeight = 0;
CXFA_Margin* pMarginNode =
- m_pFormNode->GetFirstChildByClass<CXFA_Margin>(XFA_Element::Margin);
+ GetFormNode()->GetFirstChildByClass<CXFA_Margin>(XFA_Element::Margin);
float fLeftInset = 0;
float fRightInset = 0;
if (pMarginNode) {
@@ -1262,12 +1267,12 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
CXFA_LayoutContext* pLayoutContext =
iSpecifiedColumnCount > 0 ? &layoutContext : nullptr;
if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) {
- GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, m_pFormNode,
+ GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(),
false);
}
for (; m_pCurChildNode; GotoNextContainerNode(
- m_pCurChildNode, &m_nCurChildNodeStage, m_pFormNode, false)) {
+ m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(), false)) {
layoutContext.m_bCurColumnWidthAvaiable = false;
layoutContext.m_fCurColumnWidth = 0;
if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
@@ -1292,13 +1297,14 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
static_cast<CXFA_ContentLayoutItem*>(m_pLayoutItem->m_pFirstChild);
pLayoutChild; pLayoutChild = static_cast<CXFA_ContentLayoutItem*>(
pLayoutChild->m_pNextSibling)) {
- if (pLayoutChild->m_pFormNode->GetElementType() != XFA_Element::Subform)
+ if (pLayoutChild->GetFormNode()->GetElementType() != XFA_Element::Subform)
continue;
- if (!pLayoutChild->m_pFormNode->PresenceRequiresSpace())
+ if (!pLayoutChild->GetFormNode()->PresenceRequiresSpace())
continue;
XFA_AttributeEnum eLayout =
- pLayoutChild->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout);
+ pLayoutChild->GetFormNode()->JSObject()->GetEnum(
+ XFA_Attribute::Layout);
if (eLayout != XFA_AttributeEnum::Row &&
eLayout != XFA_AttributeEnum::Rl_row) {
continue;
@@ -1307,8 +1313,9 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
static_cast<CXFA_ContentLayoutItem*>(pLayoutChild->m_pFirstChild);
if (pRowLayoutCell) {
rgRowItems.push_back(pRowLayoutCell);
- int32_t iColSpan = pRowLayoutCell->m_pFormNode->JSObject()->GetInteger(
- XFA_Attribute::ColSpan);
+ int32_t iColSpan =
+ pRowLayoutCell->GetFormNode()->JSObject()->GetInteger(
+ XFA_Attribute::ColSpan);
rgRowItemsSpan.push_back(iColSpan);
rgRowItemsWidth.push_back(pRowLayoutCell->m_sSize.width);
}
@@ -1323,16 +1330,16 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
for (int32_t i = 0; i < iRowCount; i++) {
while (rgRowItems[i] &&
(rgRowItemsSpan[i] <= 0 ||
- !rgRowItems[i]->m_pFormNode->PresenceRequiresSpace())) {
+ !rgRowItems[i]->GetFormNode()->PresenceRequiresSpace())) {
auto* pNewCell = static_cast<CXFA_ContentLayoutItem*>(
rgRowItems[i]->m_pNextSibling);
if (rgRowItemsSpan[i] < 0 &&
- rgRowItems[i]->m_pFormNode->PresenceRequiresSpace()) {
+ rgRowItems[i]->GetFormNode()->PresenceRequiresSpace()) {
pNewCell = nullptr;
}
rgRowItems[i] = pNewCell;
rgRowItemsSpan[i] =
- pNewCell ? pNewCell->m_pFormNode->JSObject()->GetInteger(
+ pNewCell ? pNewCell->GetFormNode()->JSObject()->GetInteger(
XFA_Attribute::ColSpan)
: 0;
rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.width : 0;
@@ -1381,12 +1388,13 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
for (CXFA_LayoutItem* pIter = m_pLayoutItem->m_pFirstChild; pIter;
pIter = pIter->m_pNextSibling) {
auto* pLayoutChild = static_cast<CXFA_ContentLayoutItem*>(pIter);
- if (!pLayoutChild->m_pFormNode->PresenceRequiresSpace())
+ if (!pLayoutChild->GetFormNode()->PresenceRequiresSpace())
continue;
- if (pLayoutChild->m_pFormNode->GetElementType() == XFA_Element::Subform) {
+ if (pLayoutChild->GetFormNode()->GetElementType() == XFA_Element::Subform) {
XFA_AttributeEnum eSubformLayout =
- pLayoutChild->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout);
+ pLayoutChild->GetFormNode()->JSObject()->GetEnum(
+ XFA_Attribute::Layout);
if (eSubformLayout == XFA_AttributeEnum::Row ||
eSubformLayout == XFA_AttributeEnum::Rl_row) {
RelocateTableRowCells(pLayoutChild, m_rgSpecifiedColumnWidths,
@@ -1398,7 +1406,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
if (bContainerWidthAutoSize) {
pLayoutChild->m_sPos.x = 0;
} else {
- switch (pLayoutChild->m_pFormNode->JSObject()->GetEnum(
+ switch (pLayoutChild->GetFormNode()->JSObject()->GetEnum(
XFA_Attribute::HAlign)) {
case XFA_AttributeEnum::Center:
pLayoutChild->m_sPos.x =
@@ -1432,7 +1440,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
fContentCalculatedHeight = std::max(fContentCalculatedHeight, fCurrentRowY);
containerSize = CalculateContainerComponentSizeFromContentSize(
- m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
+ GetFormNode(), bContainerWidthAutoSize, fContentCalculatedWidth,
bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
SetCurrentComponentSize(containerSize);
}
@@ -1444,7 +1452,7 @@ bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer(
float fWidth = pTrailerItem->m_sSize.width;
XFA_AttributeEnum eLayout =
- m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout);
+ GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout);
return eLayout == XFA_AttributeEnum::Tb || m_fWidthLimite <= fWidth;
}
@@ -1453,7 +1461,7 @@ float CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() {
return 0;
if (!m_pLayoutItem) {
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+ m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
m_pLayoutItem->m_sSize.clear();
}
@@ -1524,7 +1532,7 @@ bool CXFA_ItemLayoutProcessor::JudgePutNextPage(
for (CXFA_LayoutItem* pIter = pParentLayoutItem->m_pFirstChild; pIter;
pIter = pIter->m_pNextSibling) {
auto* pChildLayoutItem = static_cast<CXFA_ContentLayoutItem*>(pIter);
- if (ExistContainerKeep(pChildLayoutItem->m_pFormNode, false)) {
+ if (ExistContainerKeep(pChildLayoutItem->GetFormNode(), false)) {
pKeepItems->push_back(pChildLayoutItem);
fItemsHeight += pChildLayoutItem->m_sSize.height;
} else {
@@ -1596,7 +1604,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
}
CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
- m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize);
+ GetFormNode(), &bContainerWidthAutoSize, &bContainerHeightAutoSize);
if (pContext && pContext->m_bCurColumnWidthAvaiable) {
bContainerWidthAutoSize = false;
containerSize.width = pContext->m_fCurColumnWidth;
@@ -1605,11 +1613,11 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
containerSize.height -= m_fUsedSize;
if (!bContainerHeightAutoSize) {
- CXFA_Node* pParentNode = m_pFormNode->GetParent();
+ CXFA_Node* pParentNode = GetFormNode()->GetParent();
bool bFocrTb = false;
if (pParentNode &&
GetLayout(pParentNode, &bFocrTb) == XFA_AttributeEnum::Row) {
- CXFA_Node* pChildContainer = m_pFormNode->GetFirstContainerChild();
+ CXFA_Node* pChildContainer = GetFormNode()->GetFirstContainerChild();
if (pChildContainer && pChildContainer->GetNextContainerSibling()) {
containerSize.height = 0;
bContainerHeightAutoSize = true;
@@ -1618,7 +1626,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
}
CXFA_Margin* pMarginNode =
- m_pFormNode->GetFirstChildByClass<CXFA_Margin>(XFA_Element::Margin);
+ GetFormNode()->GetFirstChildByClass<CXFA_Margin>(XFA_Element::Margin);
float fLeftInset = 0;
float fTopInset = 0;
float fRightInset = 0;
@@ -1667,7 +1675,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
pLayoutTempChild != pLayoutChild;
pLayoutTempChild = static_cast<CXFA_ContentLayoutItem*>(
pLayoutTempChild->m_pNextSibling)) {
- if (!pLayoutTempChild->m_pFormNode->PresenceRequiresSpace())
+ if (!pLayoutTempChild->GetFormNode()->PresenceRequiresSpace())
continue;
fContentCalculatedWidth = std::max(
@@ -1686,11 +1694,11 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
fContentCurRowY += InsertKeepLayoutItems();
if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::None) {
- GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, m_pFormNode,
+ GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(),
true);
}
- fContentCurRowY += InsertPendingItems(m_pFormNode);
+ fContentCurRowY += InsertPendingItems(GetFormNode());
if (m_pCurChildPreprocessor &&
m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Container) {
if (ExistContainerKeep(m_pCurChildPreprocessor->GetFormNode(), false)) {
@@ -1712,13 +1720,14 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
pLayoutNext = static_cast<CXFA_ContentLayoutItem*>(
pLayoutNext->m_pNextSibling)) {
if (!pLayoutNext->m_pNextSibling && m_pCurChildPreprocessor &&
- m_pCurChildPreprocessor->m_pFormNode == pLayoutNext->m_pFormNode) {
+ m_pCurChildPreprocessor->GetFormNode() ==
+ pLayoutNext->GetFormNode()) {
pLayoutNext->m_pNext = m_pCurChildPreprocessor->m_pLayoutItem;
m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext;
break;
}
uint8_t uHAlign =
- HAlignEnumToInt(pLayoutNext->m_pFormNode->JSObject()->GetEnum(
+ HAlignEnumToInt(pLayoutNext->GetFormNode()->JSObject()->GetEnum(
XFA_Attribute::HAlign));
rgCurLineLayoutItems[uHAlign].push_back(pLayoutNext);
if (eFlowStrategy == XFA_AttributeEnum::Lr_tb) {
@@ -1727,7 +1736,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
} else if (uHAlign < uCurHAlignState) {
uCurHAlignState = uHAlign;
}
- if (pLayoutNext->m_pFormNode->PresenceRequiresSpace()) {
+ if (pLayoutNext->GetFormNode()->PresenceRequiresSpace()) {
if (pLayoutNext->m_sSize.height > fContentCurRowHeight)
fContentCurRowHeight = pLayoutNext->m_sSize.height;
fContentCurRowAvailWidth -= pLayoutNext->m_sSize.width;
@@ -1763,7 +1772,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
while (m_pCurChildNode) {
std::unique_ptr<CXFA_ItemLayoutProcessor> pProcessor;
bool bAddedItemInRow = false;
- fContentCurRowY += InsertPendingItems(m_pFormNode);
+ fContentCurRowY += InsertPendingItems(GetFormNode());
switch (m_nCurChildNodeStage) {
case XFA_ItemLayoutProcessorStages::Keep:
case XFA_ItemLayoutProcessorStages::None:
@@ -1781,7 +1790,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
!m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, true,
pLeaderNode, pTrailerNode,
bCreatePage) ||
- m_pFormNode->GetElementType() == XFA_Element::Form ||
+ GetFormNode()->GetElementType() == XFA_Element::Form ||
!bCreatePage) {
break;
}
@@ -1790,7 +1799,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
AddPendingNode(pLeaderNode, true);
if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) {
- if (m_pFormNode->GetParent()->GetElementType() ==
+ if (GetFormNode()->GetParent()->GetElementType() ==
XFA_Element::Form &&
!m_pLayoutItem) {
AddPendingNode(pTrailerNode, true);
@@ -1808,7 +1817,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
}
}
GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage,
- m_pFormNode, true);
+ GetFormNode(), true);
bForceEndPage = true;
bIsManualBreak = true;
goto SuspendAndCreateNewRow;
@@ -1821,7 +1830,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
!m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, false,
pLeaderNode, pTrailerNode,
bCreatePage) ||
- m_pFormNode->GetElementType() == XFA_Element::Form) {
+ GetFormNode()->GetElementType() == XFA_Element::Form) {
break;
}
@@ -1861,7 +1870,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
}
GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage,
- m_pFormNode, true);
+ GetFormNode(), true);
if (bCreatePage) {
bForceEndPage = true;
bIsManualBreak = true;
@@ -1978,8 +1987,8 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
default:
break;
}
- GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, m_pFormNode,
- true);
+ GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage,
+ GetFormNode(), true);
if (bAddedItemInRow && eFlowStrategy == XFA_AttributeEnum::Tb)
break;
continue;
@@ -2006,13 +2015,13 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
bRetValue = false;
containerSize = CalculateContainerComponentSizeFromContentSize(
- m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
+ GetFormNode(), bContainerWidthAutoSize, fContentCalculatedWidth,
bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
if (containerSize.height >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem ||
bRetValue) {
if (!m_pLayoutItem)
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+ m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
containerSize.height = std::max(containerSize.height, 0.f);
SetCurrentComponentSize(containerSize);
@@ -2046,7 +2055,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
nGroupLengths[i] = pdfium::CollectionSize<int32_t>(rgCurLineLayoutItems[i]);
for (int32_t c = nGroupLengths[i], j = 0; j < c; j++) {
nTotalLength++;
- if (rgCurLineLayoutItems[i][j]->m_pFormNode->PresenceRequiresSpace())
+ if (rgCurLineLayoutItems[i][j]->GetFormNode()->PresenceRequiresSpace())
fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.width;
}
}
@@ -2058,7 +2067,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
return false;
}
if (!m_pLayoutItem)
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+ m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
if (eFlowStrategy != XFA_AttributeEnum::Rl_tb) {
float fCurPos;
@@ -2066,12 +2075,12 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) {
if (bRootForceTb) {
rgCurLineLayoutItems[0][j]->m_sPos = CalculatePositionedContainerPos(
- rgCurLineLayoutItems[0][j]->m_pFormNode,
+ rgCurLineLayoutItems[0][j]->GetFormNode(),
rgCurLineLayoutItems[0][j]->m_sSize);
} else {
rgCurLineLayoutItems[0][j]->m_sPos =
CFX_PointF(fCurPos, *fContentCurRowY);
- if (rgCurLineLayoutItems[0][j]->m_pFormNode->PresenceRequiresSpace())
+ if (rgCurLineLayoutItems[0][j]->GetFormNode()->PresenceRequiresSpace())
fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.width;
}
m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]);
@@ -2083,12 +2092,12 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) {
if (bRootForceTb) {
rgCurLineLayoutItems[1][j]->m_sPos = CalculatePositionedContainerPos(
- rgCurLineLayoutItems[1][j]->m_pFormNode,
+ rgCurLineLayoutItems[1][j]->GetFormNode(),
rgCurLineLayoutItems[1][j]->m_sSize);
} else {
rgCurLineLayoutItems[1][j]->m_sPos =
CFX_PointF(fCurPos, *fContentCurRowY);
- if (rgCurLineLayoutItems[1][j]->m_pFormNode->PresenceRequiresSpace())
+ if (rgCurLineLayoutItems[1][j]->GetFormNode()->PresenceRequiresSpace())
fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.width;
}
m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]);
@@ -2098,12 +2107,12 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) {
if (bRootForceTb) {
rgCurLineLayoutItems[2][j]->m_sPos = CalculatePositionedContainerPos(
- rgCurLineLayoutItems[2][j]->m_pFormNode,
+ rgCurLineLayoutItems[2][j]->GetFormNode(),
rgCurLineLayoutItems[2][j]->m_sSize);
} else {
rgCurLineLayoutItems[2][j]->m_sPos =
CFX_PointF(fCurPos, *fContentCurRowY);
- if (rgCurLineLayoutItems[2][j]->m_pFormNode->PresenceRequiresSpace())
+ if (rgCurLineLayoutItems[2][j]->GetFormNode()->PresenceRequiresSpace())
fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.width;
}
m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]);
@@ -2113,7 +2122,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
float fCurPos;
fCurPos = fGroupWidths[0];
for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) {
- if (rgCurLineLayoutItems[0][j]->m_pFormNode->PresenceRequiresSpace())
+ if (rgCurLineLayoutItems[0][j]->GetFormNode()->PresenceRequiresSpace())
fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.width;
rgCurLineLayoutItems[0][j]->m_sPos =
@@ -2125,7 +2134,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
fGroupWidths[2]) /
2;
for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) {
- if (rgCurLineLayoutItems[1][j]->m_pFormNode->PresenceRequiresSpace())
+ if (rgCurLineLayoutItems[1][j]->GetFormNode()->PresenceRequiresSpace())
fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.width;
rgCurLineLayoutItems[1][j]->m_sPos =
@@ -2135,7 +2144,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
}
fCurPos = fContentWidthLimit;
for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) {
- if (rgCurLineLayoutItems[2][j]->m_pFormNode->PresenceRequiresSpace())
+ if (rgCurLineLayoutItems[2][j]->GetFormNode()->PresenceRequiresSpace())
fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.width;
rgCurLineLayoutItems[2][j]->m_sPos =
@@ -2180,17 +2189,17 @@ void CXFA_ItemLayoutProcessor::DoLayoutField() {
return;
ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE);
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+ m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
if (!m_pLayoutItem)
return;
- CXFA_Document* pDocument = m_pFormNode->GetDocument();
+ CXFA_Document* pDocument = GetFormNode()->GetDocument();
CXFA_FFNotify* pNotify = pDocument->GetNotify();
CFX_SizeF size(-1, -1);
- pNotify->StartFieldDrawLayout(m_pFormNode, &size.width, &size.height);
+ pNotify->StartFieldDrawLayout(GetFormNode(), &size.width, &size.height);
int32_t nRotate = XFA_MapRotation(
- m_pFormNode->JSObject()->GetInteger(XFA_Attribute::Rotate));
+ GetFormNode()->JSObject()->GetInteger(XFA_Attribute::Rotate));
if (nRotate == 90 || nRotate == 270)
std::swap(size.width, size.height);
@@ -2202,13 +2211,13 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout(
float fHeightLimit,
float fRealHeight,
CXFA_LayoutContext* pContext) {
- switch (m_pFormNode->GetElementType()) {
+ switch (GetFormNode()->GetElementType()) {
case XFA_Element::Subform:
case XFA_Element::Area:
case XFA_Element::ExclGroup:
case XFA_Element::SubformSet: {
bool bRootForceTb = false;
- CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode);
+ CXFA_Node* pLayoutNode = GetSubformSetParent(GetFormNode());
XFA_AttributeEnum eLayoutStrategy = GetLayout(pLayoutNode, &bRootForceTb);
switch (eLayoutStrategy) {
case XFA_AttributeEnum::Tb:
@@ -2279,7 +2288,7 @@ bool CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur(
void CXFA_ItemLayoutProcessor::UpdatePendingItemLayout(
CXFA_ContentLayoutItem* pLayoutItem) {
XFA_AttributeEnum eLayout =
- pLayoutItem->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout);
+ pLayoutItem->GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout);
switch (eLayout) {
case XFA_AttributeEnum::Row:
case XFA_AttributeEnum::Rl_row:
@@ -2309,7 +2318,7 @@ void CXFA_ItemLayoutProcessor::AddTrailerBeforeSplit(
UpdatePendingItemLayout(pTrailerLayoutItem);
CXFA_Margin* pMarginNode =
- m_pFormNode->GetFirstChildByClass<CXFA_Margin>(XFA_Element::Margin);
+ GetFormNode()->GetFirstChildByClass<CXFA_Margin>(XFA_Element::Margin);
float fLeftInset = 0;
float fTopInset = 0;
float fRightInset = 0;
@@ -2348,7 +2357,7 @@ void CXFA_ItemLayoutProcessor::AddTrailerBeforeSplit(
pTrailerLayoutItem->m_sPos.y = fSplitPos - fTopInset - fBottomInset;
}
- switch (pTrailerLayoutItem->m_pFormNode->JSObject()->GetEnum(
+ switch (pTrailerLayoutItem->GetFormNode()->JSObject()->GetEnum(
XFA_Attribute::HAlign)) {
case XFA_AttributeEnum::Right:
pTrailerLayoutItem->m_sPos.x = m_pLayoutItem->m_sSize.width -
@@ -2375,7 +2384,7 @@ void CXFA_ItemLayoutProcessor::AddLeaderAfterSplit(
UpdatePendingItemLayout(pLeaderLayoutItem);
CXFA_Margin* pMarginNode =
- m_pFormNode->GetFirstChildByClass<CXFA_Margin>(XFA_Element::Margin);
+ GetFormNode()->GetFirstChildByClass<CXFA_Margin>(XFA_Element::Margin);
float fLeftInset = 0;
float fRightInset = 0;
if (pMarginNode) {
@@ -2394,7 +2403,7 @@ void CXFA_ItemLayoutProcessor::AddLeaderAfterSplit(
}
pLeaderLayoutItem->m_sPos.y = 0;
- switch (pLeaderLayoutItem->m_pFormNode->JSObject()->GetEnum(
+ switch (pLeaderLayoutItem->GetFormNode()->JSObject()->GetEnum(
XFA_Attribute::HAlign)) {
case XFA_AttributeEnum::Right:
pLeaderLayoutItem->m_sPos.x = m_pLayoutItem->m_sSize.width - fRightInset -
@@ -2468,7 +2477,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
bool* bForceEndPage,
CXFA_LayoutContext* pLayoutContext,
bool bNewRow) {
- bool bTakeSpace = pProcessor->m_pFormNode->PresenceRequiresSpace();
+ bool bTakeSpace = pProcessor->GetFormNode()->PresenceRequiresSpace();
uint8_t uHAlign = HAlignEnumToInt(
m_pCurChildNode->JSObject()->GetEnum(XFA_Attribute::HAlign));
if (bContainerWidthAutoSize)
@@ -2483,15 +2492,15 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
*uCurHAlignState = uHAlign;
bool bIsOwnSplit =
- pProcessor->m_pFormNode->GetIntact() == XFA_AttributeEnum::None;
+ pProcessor->GetFormNode()->GetIntact() == XFA_AttributeEnum::None;
bool bUseRealHeight = bTakeSpace && bContainerHeightAutoSize && bIsOwnSplit &&
- pProcessor->m_pFormNode->GetParent()->GetIntact() ==
+ pProcessor->GetFormNode()->GetParent()->GetIntact() ==
XFA_AttributeEnum::None;
bool bIsTransHeight = bTakeSpace;
if (bIsTransHeight && !bIsOwnSplit) {
bool bRootForceTb = false;
XFA_AttributeEnum eLayoutStrategy =
- GetLayout(pProcessor->m_pFormNode, &bRootForceTb);
+ GetLayout(pProcessor->GetFormNode(), &bRootForceTb);
if (eLayoutStrategy == XFA_AttributeEnum::Lr_tb ||
eLayoutStrategy == XFA_AttributeEnum::Rl_tb) {
bIsTransHeight = false;
@@ -2501,7 +2510,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
bool bUseInherited = false;
CXFA_LayoutContext layoutContext;
if (m_pPageMgr) {
- CXFA_Node* pOverflowNode = m_pPageMgr->QueryOverflow(m_pFormNode);
+ CXFA_Node* pOverflowNode = m_pPageMgr->QueryOverflow(GetFormNode());
if (pOverflowNode) {
layoutContext.m_pOverflowNode = pOverflowNode;
layoutContext.m_pOverflowProcessor = this;
@@ -2544,8 +2553,8 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr;
bool bIsAddTrailerHeight = false;
if (m_pPageMgr &&
- pProcessor->m_pFormNode->GetIntact() == XFA_AttributeEnum::None) {
- pFormNode = m_pPageMgr->QueryOverflow(pProcessor->m_pFormNode);
+ pProcessor->GetFormNode()->GetIntact() == XFA_AttributeEnum::None) {
+ pFormNode = m_pPageMgr->QueryOverflow(pProcessor->GetFormNode());
if (!pFormNode && pLayoutContext && pLayoutContext->m_pOverflowProcessor) {
pFormNode = pLayoutContext->m_pOverflowNode;
bUseInherited = true;
@@ -2602,8 +2611,8 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
CXFA_ContentLayoutItem* pChildLayoutItem =
pProcessor->ExtractLayoutItem();
- if (ExistContainerKeep(pProcessor->m_pFormNode, false) &&
- pProcessor->m_pFormNode->GetIntact() == XFA_AttributeEnum::None) {
+ if (ExistContainerKeep(pProcessor->GetFormNode(), false) &&
+ pProcessor->GetFormNode()->GetIntact() == XFA_AttributeEnum::None) {
m_arrayKeepItems.push_back(pChildLayoutItem);
} else {
m_arrayKeepItems.clear();
@@ -2656,7 +2665,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
float fSplitPos = pProcessor->FindSplitPos(fAvailHeight - *fContentCurRowY);
if (fSplitPos > XFA_LAYOUT_FLOAT_PERCISION) {
XFA_AttributeEnum eLayout =
- pProcessor->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout);
+ pProcessor->GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout);
if (eLayout == XFA_AttributeEnum::Tb &&
eRetValue == XFA_ItemLayoutProcessorResult::Done) {
pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
@@ -2694,7 +2703,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
} else {
CXFA_LayoutItem* firstChild = pProcessor->m_pLayoutItem->m_pFirstChild;
if (firstChild && !firstChild->m_pNextSibling &&
- firstChild->m_pFormNode->IsLayoutGeneratedNode()) {
+ firstChild->GetFormNode()->IsLayoutGeneratedNode()) {
pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
pOverflowTrailerNode,
pTrailerLayoutItem, pFormNode);
@@ -2724,7 +2733,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
CXFA_Node* pTempTrailerNode = nullptr;
if (m_pPageMgr) {
if (!pFormNode && pLayoutContext)
- pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode;
+ pFormNode = pLayoutContext->m_pOverflowProcessor->GetFormNode();
m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode,
pTempTrailerNode, false, true);
@@ -2751,8 +2760,8 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
}
XFA_AttributeEnum eLayout =
- pProcessor->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout);
- if (pProcessor->m_pFormNode->GetIntact() == XFA_AttributeEnum::None &&
+ pProcessor->GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout);
+ if (pProcessor->GetFormNode()->GetIntact() == XFA_AttributeEnum::None &&
eLayout == XFA_AttributeEnum::Tb) {
if (m_pPageMgr) {
m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode,
@@ -2770,7 +2779,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
return XFA_ItemLayoutProcessorResult::PageFullBreak;
if (!pFormNode && pLayoutContext)
- pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode;
+ pFormNode = pLayoutContext->m_pOverflowProcessor->GetFormNode();
if (m_pPageMgr) {
m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode,
pOverflowTrailerNode, false, true);
diff --git a/xfa/fxfa/parser/cxfa_layoutitem.cpp b/xfa/fxfa/parser/cxfa_layoutitem.cpp
index bd8ca2a58a..aac7e5db41 100644
--- a/xfa/fxfa/parser/cxfa_layoutitem.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutitem.cpp
@@ -16,9 +16,9 @@
void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) {
CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild;
- CXFA_FFNotify* pNotify = pLayoutItem->m_pFormNode->GetDocument()->GetNotify();
- CXFA_LayoutProcessor* pDocLayout =
- pLayoutItem->m_pFormNode->GetDocument()->GetLayoutProcessor();
+ CXFA_Document* pDocument = pLayoutItem->GetFormNode()->GetDocument();
+ CXFA_FFNotify* pNotify = pDocument->GetNotify();
+ CXFA_LayoutProcessor* pDocLayout = pDocument->GetLayoutProcessor();
while (pNode) {
CXFA_LayoutItem* pNext = pNode->m_pNextSibling;
pNode->m_pParent = nullptr;
@@ -27,7 +27,7 @@ void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) {
pNode = pNext;
}
pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
- if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::PageArea) {
+ if (pLayoutItem->GetFormNode()->GetElementType() == XFA_Element::PageArea) {
pNotify->OnPageEvent(static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem),
XFA_PAGEVIEWEVENT_PostRemoved);
}
@@ -35,13 +35,9 @@ void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) {
}
CXFA_LayoutItem::CXFA_LayoutItem(CXFA_Node* pNode, bool bIsContentLayoutItem)
- : m_pFormNode(pNode),
- m_pParent(nullptr),
- m_pNextSibling(nullptr),
- m_pFirstChild(nullptr),
- m_bIsContentLayoutItem(bIsContentLayoutItem) {}
+ : m_bIsContentLayoutItem(bIsContentLayoutItem), m_pFormNode(pNode) {}
-CXFA_LayoutItem::~CXFA_LayoutItem() {}
+CXFA_LayoutItem::~CXFA_LayoutItem() = default;
CXFA_ContainerLayoutItem* CXFA_LayoutItem::AsContainerLayoutItem() {
return IsContainerLayoutItem() ? static_cast<CXFA_ContainerLayoutItem*>(this)
diff --git a/xfa/fxfa/parser/cxfa_layoutitem.h b/xfa/fxfa/parser/cxfa_layoutitem.h
index e03f455de5..6e51a05e69 100644
--- a/xfa/fxfa/parser/cxfa_layoutitem.h
+++ b/xfa/fxfa/parser/cxfa_layoutitem.h
@@ -7,6 +7,7 @@
#ifndef XFA_FXFA_PARSER_CXFA_LAYOUTITEM_H_
#define XFA_FXFA_PARSER_CXFA_LAYOUTITEM_H_
+#include "core/fxcrt/unowned_ptr.h"
#include "xfa/fxfa/parser/cxfa_document.h"
class CXFA_ContainerLayoutItem;
@@ -23,9 +24,11 @@ class CXFA_LayoutItem {
CXFA_ContentLayoutItem* AsContentLayoutItem();
CXFA_ContainerLayoutItem* GetPage() const;
- CXFA_Node* GetFormNode() const { return m_pFormNode; }
CFX_RectF GetRect(bool bRelative) const;
+ CXFA_Node* GetFormNode() const { return m_pFormNode.Get(); }
+ void SetFormNode(CXFA_Node* pNode) { m_pFormNode = pNode; }
+
int32_t GetIndex() const;
int32_t GetCount() const;
@@ -40,15 +43,15 @@ class CXFA_LayoutItem {
void RemoveChild(CXFA_LayoutItem* pChildItem);
void InsertChild(CXFA_LayoutItem* pBeforeItem, CXFA_LayoutItem* pChildItem);
- CXFA_Node* m_pFormNode;
- CXFA_LayoutItem* m_pParent;
- CXFA_LayoutItem* m_pNextSibling;
- CXFA_LayoutItem* m_pFirstChild;
+ CXFA_LayoutItem* m_pParent = nullptr; // Raw, intra-tree pointer.
+ CXFA_LayoutItem* m_pNextSibling = nullptr; // Raw, intra-tree pointer.
+ CXFA_LayoutItem* m_pFirstChild = nullptr; // Raw, intra-tree pointer.
protected:
CXFA_LayoutItem(CXFA_Node* pNode, bool bIsContentLayoutItem);
bool m_bIsContentLayoutItem;
+ UnownedPtr<CXFA_Node> m_pFormNode;
};
void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem);
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index c6b76b88cc..b6c95c1d56 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -38,13 +38,13 @@ class PageSetContainerLayoutItem {
public:
static CXFA_ContainerLayoutItem* GetFirstChild(
CXFA_ContainerLayoutItem* pLayoutItem) {
- if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::PageSet)
+ if (pLayoutItem->GetFormNode()->GetElementType() != XFA_Element::PageSet)
return nullptr;
CXFA_ContainerLayoutItem* pChildItem =
static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pFirstChild);
- while (pChildItem &&
- pChildItem->m_pFormNode->GetElementType() != XFA_Element::PageSet) {
+ while (pChildItem && pChildItem->GetFormNode()->GetElementType() !=
+ XFA_Element::PageSet) {
pChildItem =
static_cast<CXFA_ContainerLayoutItem*>(pChildItem->m_pNextSibling);
}
@@ -55,8 +55,8 @@ class PageSetContainerLayoutItem {
CXFA_ContainerLayoutItem* pLayoutItem) {
CXFA_ContainerLayoutItem* pChildItem =
static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pNextSibling);
- while (pChildItem &&
- pChildItem->m_pFormNode->GetElementType() != XFA_Element::PageSet) {
+ while (pChildItem && pChildItem->GetFormNode()->GetElementType() !=
+ XFA_Element::PageSet) {
pChildItem =
static_cast<CXFA_ContainerLayoutItem*>(pChildItem->m_pNextSibling);
}
@@ -103,13 +103,15 @@ void SyncContainer(CXFA_FFNotify* pNotify,
uint32_t dwRelevantContainer = 0;
if (bVisible) {
XFA_AttributeEnum eAttributeValue =
- pContainerItem->m_pFormNode->JSObject()
+ pContainerItem->GetFormNode()
+ ->JSObject()
->TryEnum(XFA_Attribute::Presence, true)
.value_or(XFA_AttributeEnum::Visible);
if (eAttributeValue == XFA_AttributeEnum::Visible)
bVisibleItem = true;
- dwRelevantContainer = GetRelevant(pContainerItem->m_pFormNode, dwRelevant);
+ dwRelevantContainer =
+ GetRelevant(pContainerItem->GetFormNode(), dwRelevant);
dwStatus =
(bVisibleItem ? XFA_WidgetStatus_Visible : 0) | dwRelevantContainer;
}
@@ -211,7 +213,7 @@ bool CheckContentAreaNotUsed(
pPageAreaLayoutItem->m_pFirstChild);
pLayoutItem; pLayoutItem = static_cast<CXFA_ContainerLayoutItem*>(
pLayoutItem->m_pNextSibling)) {
- if (pLayoutItem->m_pFormNode == pContentArea) {
+ if (pLayoutItem->GetFormNode() == pContentArea) {
if (!pLayoutItem->m_pFirstChild) {
pContentAreaLayoutItem = pLayoutItem;
return true;
@@ -299,7 +301,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
m_pPageSetLayoutItemRoot->m_pParent = nullptr;
m_pPageSetLayoutItemRoot->m_pFirstChild = nullptr;
m_pPageSetLayoutItemRoot->m_pNextSibling = nullptr;
- m_pPageSetLayoutItemRoot->m_pFormNode = m_pTemplatePageSetRoot;
+ m_pPageSetLayoutItemRoot->SetFormNode(m_pTemplatePageSetRoot);
} else {
m_pPageSetLayoutItemRoot =
new CXFA_ContainerLayoutItem(m_pTemplatePageSetRoot);
@@ -480,17 +482,18 @@ void CXFA_LayoutPageMgr::SubmitContentItem(
AppendNewPage();
}
m_CurrentContainerRecordIter = GetTailPosition();
- m_pCurPageArea = GetCurrentContainerRecord()->pCurPageArea->m_pFormNode;
+ m_pCurPageArea = GetCurrentContainerRecord()->pCurPageArea->GetFormNode();
}
}
float CXFA_LayoutPageMgr::GetAvailHeight() {
CXFA_ContainerLayoutItem* pLayoutItem =
GetCurrentContainerRecord()->pCurContentArea;
- if (!pLayoutItem || !pLayoutItem->m_pFormNode)
+ if (!pLayoutItem || !pLayoutItem->GetFormNode())
return 0.0f;
- float fAvailHeight = pLayoutItem->m_pFormNode->JSObject()
+ float fAvailHeight = pLayoutItem->GetFormNode()
+ ->JSObject()
->GetMeasure(XFA_Attribute::H)
.ToUnit(XFA_Unit::Pt);
if (fAvailHeight >= XFA_LAYOUT_FLOAT_PERCISION)
@@ -525,7 +528,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord(
}
} else {
CXFA_ContainerLayoutItem* pParentPageSetLayout = nullptr;
- if (pPageSet == GetCurrentContainerRecord()->pCurPageSet->m_pFormNode) {
+ if (pPageSet == GetCurrentContainerRecord()->pCurPageSet->GetFormNode()) {
pParentPageSetLayout = static_cast<CXFA_ContainerLayoutItem*>(
GetCurrentContainerRecord()->pCurPageSet->m_pParent);
} else {
@@ -574,7 +577,7 @@ void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord,
CXFA_ContainerLayoutItem* pNewPageAreaLayoutItem = nullptr;
if (pdfium::IndexInBounds(m_PageArray, m_nAvailPages)) {
CXFA_ContainerLayoutItem* pContainerItem = m_PageArray[m_nAvailPages];
- pContainerItem->m_pFormNode = pNewPageArea;
+ pContainerItem->SetFormNode(pNewPageArea);
m_nAvailPages++;
pNewPageAreaLayoutItem = pContainerItem;
} else {
@@ -615,7 +618,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
for (CXFA_ContainerLayoutItem* pPageSetLayoutItem = sIterator.GetCurrent();
pPageSetLayoutItem; pPageSetLayoutItem = sIterator.MoveToNext()) {
XFA_AttributeEnum ePageRelation =
- pPageSetLayoutItem->m_pFormNode->JSObject()->GetEnum(
+ pPageSetLayoutItem->GetFormNode()->JSObject()->GetEnum(
XFA_Attribute::Relation);
switch (ePageRelation) {
case XFA_AttributeEnum::OrderedOccurrence:
@@ -628,7 +631,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
pPageSetLayoutItem->m_pFirstChild;
pPageAreaLayoutItem;
pPageAreaLayoutItem = pPageAreaLayoutItem->m_pNextSibling) {
- if (pPageAreaLayoutItem->m_pFormNode->GetElementType() !=
+ if (pPageAreaLayoutItem->GetFormNode()->GetElementType() !=
XFA_Element::PageArea) {
continue;
}
@@ -639,13 +642,13 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
break;
if (!FindPageAreaFromPageSet_SimplexDuplex(
- pPageSetLayoutItem->m_pFormNode, nullptr, nullptr, nullptr,
+ pPageSetLayoutItem->GetFormNode(), nullptr, nullptr, nullptr,
true, true,
nPageAreaCount == 1 ? XFA_AttributeEnum::Only
: XFA_AttributeEnum::Last) &&
(nPageAreaCount == 1 &&
!FindPageAreaFromPageSet_SimplexDuplex(
- pPageSetLayoutItem->m_pFormNode, nullptr, nullptr, nullptr,
+ pPageSetLayoutItem->GetFormNode(), nullptr, nullptr, nullptr,
true, true, XFA_AttributeEnum::Last))) {
break;
}
@@ -656,7 +659,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
XFA_AttributeEnum eOddOrEven =
pNode->JSObject()->GetEnum(XFA_Attribute::OddOrEven);
XFA_AttributeEnum eLastChoice =
- pLastPageAreaLayoutItem->m_pFormNode->JSObject()->GetEnum(
+ pLastPageAreaLayoutItem->GetFormNode()->JSObject()->GetEnum(
XFA_Attribute::PagePosition);
if (eLastChoice == XFA_AttributeEnum::First &&
(ePageRelation == XFA_AttributeEnum::SimplexPaginated ||
@@ -672,7 +675,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
pLastPageAreaLayoutItem->m_pFirstChild;
pChildLayoutItem;
pChildLayoutItem = pChildLayoutItem->m_pNextSibling) {
- if (pChildLayoutItem->m_pFormNode->GetElementType() !=
+ if (pChildLayoutItem->GetFormNode()->GetElementType() !=
XFA_Element::ContentArea) {
continue;
}
@@ -711,9 +714,9 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
CXFA_LayoutItem* pChildLayoutItem =
pLastPageAreaLayoutItem->m_pFirstChild;
CXFA_Node* pContentAreaNode = pNode->GetFirstChild();
- pLastPageAreaLayoutItem->m_pFormNode = pNode;
+ pLastPageAreaLayoutItem->SetFormNode(pNode);
while (pChildLayoutItem && pContentAreaNode) {
- if (pChildLayoutItem->m_pFormNode->GetElementType() !=
+ if (pChildLayoutItem->GetFormNode()->GetElementType() !=
XFA_Element::ContentArea) {
pChildLayoutItem = pChildLayoutItem->m_pNextSibling;
continue;
@@ -723,7 +726,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
pContentAreaNode = pContentAreaNode->GetNextSibling();
continue;
}
- pChildLayoutItem->m_pFormNode = pContentAreaNode;
+ pChildLayoutItem->SetFormNode(pContentAreaNode);
pChildLayoutItem = pChildLayoutItem->m_pNextSibling;
pContentAreaNode = pContentAreaNode->GetNextSibling();
}
@@ -766,7 +769,7 @@ bool CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType,
if (!pTarget ||
m_CurrentContainerRecordIter == m_ProposedContainerRecords.end() ||
pTarget !=
- GetCurrentContainerRecord()->pCurContentArea->m_pFormNode ||
+ GetCurrentContainerRecord()->pCurContentArea->GetFormNode() ||
bStartNew) {
CXFA_Node* pPageArea = nullptr;
if (pTarget)
@@ -781,7 +784,7 @@ bool CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType,
pTarget = nullptr;
if (!pTarget ||
m_CurrentContainerRecordIter == m_ProposedContainerRecords.end() ||
- pTarget != GetCurrentContainerRecord()->pCurPageArea->m_pFormNode ||
+ pTarget != GetCurrentContainerRecord()->pCurPageArea->GetFormNode() ||
bStartNew) {
CXFA_Node* pPageArea = GetNextAvailPageArea(pTarget, nullptr, true);
bRet = !!pPageArea;
@@ -1385,7 +1388,7 @@ CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea(
bool CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) {
CXFA_Node* pCurContentNode =
- GetCurrentContainerRecord()->pCurContentArea->m_pFormNode;
+ GetCurrentContainerRecord()->pCurContentArea->GetFormNode();
if (!pContentArea) {
pContentArea = pCurContentNode->GetNextSameClassSibling<CXFA_ContentArea>(
XFA_Element::ContentArea);
@@ -1401,7 +1404,7 @@ bool CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) {
return false;
}
if (pContentAreaLayout) {
- if (pContentAreaLayout->m_pFormNode != pCurContentNode) {
+ if (pContentAreaLayout->GetFormNode() != pCurContentNode) {
CXFA_ContainerRecord* pNewRecord = CreateContainerRecord();
pNewRecord->pCurContentArea = pContentAreaLayout;
return true;
@@ -1531,7 +1534,7 @@ void CXFA_LayoutPageMgr::ProcessLastPageSet() {
bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) {
CXFA_Node* pCurContentNode =
- GetCurrentContainerRecord()->pCurContentArea->m_pFormNode;
+ GetCurrentContainerRecord()->pCurContentArea->GetFormNode();
if (!pCurContentNode)
return false;
@@ -1544,7 +1547,8 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) {
return fNextContentHeight > fChildHeight;
}
- CXFA_Node* pPageNode = GetCurrentContainerRecord()->pCurPageArea->m_pFormNode;
+ CXFA_Node* pPageNode =
+ GetCurrentContainerRecord()->pCurPageArea->GetFormNode();
CXFA_Node* pOccurNode =
pPageNode->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
int32_t iMax = 0;
@@ -1622,7 +1626,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
while (pCurLayoutItem) {
pNextLayoutItem = pCurLayoutItem->m_pNextSibling;
if (pCurLayoutItem->IsContentLayoutItem()) {
- if (pCurLayoutItem->m_pFormNode->HasRemovedChildren()) {
+ if (pCurLayoutItem->GetFormNode()->HasRemovedChildren()) {
CXFA_FFNotify* pNotify =
m_pTemplatePageSetRoot->GetDocument()->GetNotify();
CXFA_LayoutProcessor* pDocLayout =
@@ -1636,9 +1640,9 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
continue;
}
- if (pCurLayoutItem->m_pFormNode->IsLayoutGeneratedNode()) {
+ if (pCurLayoutItem->GetFormNode()->IsLayoutGeneratedNode()) {
CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
- sIterator(pCurLayoutItem->m_pFormNode);
+ sIterator(pCurLayoutItem->GetFormNode());
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
pNode->SetFlag(XFA_NodeFlag_UnusedNode);
@@ -1653,7 +1657,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
pCurLayoutItem->m_pNextSibling = nullptr;
pCurLayoutItem->m_pFirstChild = nullptr;
if (!pCurLayoutItem->IsContentLayoutItem() &&
- pCurLayoutItem->m_pFormNode->GetElementType() !=
+ pCurLayoutItem->GetFormNode()->GetElementType() !=
XFA_Element::PageArea) {
delete pCurLayoutItem;
}
@@ -1714,7 +1718,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_TraverseStrategy_ContentAreaContainerLayoutItem>
iterator(pRootLayout);
CXFA_ContainerLayoutItem* pRootPageSetContainerItem = iterator.GetCurrent();
- ASSERT(pRootPageSetContainerItem->m_pFormNode->GetElementType() ==
+ ASSERT(pRootPageSetContainerItem->GetFormNode()->GetElementType() ==
XFA_Element::PageSet);
if (iIndex <
pdfium::CollectionSize<int32_t>(pDocument->m_pPendingPageSet)) {
@@ -1722,44 +1726,45 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
iIndex++;
}
if (!pPendingPageSet) {
- if (pRootPageSetContainerItem->m_pFormNode->GetPacketType() ==
+ if (pRootPageSetContainerItem->GetFormNode()->GetPacketType() ==
XFA_PacketType::Template) {
pPendingPageSet =
- pRootPageSetContainerItem->m_pFormNode->CloneTemplateToForm(false);
+ pRootPageSetContainerItem->GetFormNode()->CloneTemplateToForm(
+ false);
} else {
- pPendingPageSet = pRootPageSetContainerItem->m_pFormNode;
+ pPendingPageSet = pRootPageSetContainerItem->GetFormNode();
}
}
- if (pRootPageSetContainerItem->m_pFormNode->JSObject()->GetLayoutItem() ==
+ if (pRootPageSetContainerItem->GetFormNode()->JSObject()->GetLayoutItem() ==
pRootPageSetContainerItem) {
- pRootPageSetContainerItem->m_pFormNode->JSObject()->SetLayoutItem(
+ pRootPageSetContainerItem->GetFormNode()->JSObject()->SetLayoutItem(
nullptr);
}
- pRootPageSetContainerItem->m_pFormNode = pPendingPageSet;
+ pRootPageSetContainerItem->SetFormNode(pPendingPageSet);
pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode);
for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext();
pContainerItem; pContainerItem = iterator.MoveToNext()) {
- CXFA_Node* pNode = pContainerItem->m_pFormNode;
+ CXFA_Node* pNode = pContainerItem->GetFormNode();
if (pNode->GetPacketType() != XFA_PacketType::Template)
continue;
switch (pNode->GetElementType()) {
case XFA_Element::PageSet: {
- CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode;
- pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer(
- pDocument, pParentNode, pContainerItem->m_pFormNode, true,
- nullptr);
+ CXFA_Node* pParentNode = pContainerItem->m_pParent->GetFormNode();
+ pContainerItem->SetFormNode(XFA_NodeMerge_CloneOrMergeContainer(
+ pDocument, pParentNode, pContainerItem->GetFormNode(), true,
+ nullptr));
break;
}
case XFA_Element::PageArea: {
CXFA_LayoutItem* pFormLayout = pContainerItem;
- CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode;
+ CXFA_Node* pParentNode = pContainerItem->m_pParent->GetFormNode();
bool bIsExistForm = true;
for (int32_t iLevel = 0; iLevel < 3; iLevel++) {
pFormLayout = pFormLayout->m_pFirstChild;
if (iLevel == 2) {
while (pFormLayout &&
- !pFormLayout->m_pFormNode->PresenceRequiresSpace()) {
+ !pFormLayout->GetFormNode()->PresenceRequiresSpace()) {
pFormLayout = pFormLayout->m_pNextSibling;
}
}
@@ -1769,12 +1774,12 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
}
}
if (bIsExistForm) {
- CXFA_Node* pNewSubform = pFormLayout->m_pFormNode;
+ CXFA_Node* pNewSubform = pFormLayout->GetFormNode();
if (pContainerItem->m_pOldSubform &&
pContainerItem->m_pOldSubform != pNewSubform) {
CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance(
- pDocument, pContainerItem->m_pFormNode->GetElementType(),
- pContainerItem->m_pFormNode->GetNameHash(), pParentNode);
+ pDocument, pContainerItem->GetFormNode()->GetElementType(),
+ pContainerItem->GetFormNode()->GetNameHash(), pParentNode);
CXFA_ContainerIterator sIterator(pExistingNode);
for (CXFA_Node* pIter = sIterator.GetCurrent(); pIter;
pIter = sIterator.MoveToNext()) {
@@ -1793,21 +1798,21 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
}
pContainerItem->m_pOldSubform = pNewSubform;
}
- pContainerItem->m_pFormNode = pDocument->DataMerge_CopyContainer(
- pContainerItem->m_pFormNode, pParentNode,
+ pContainerItem->SetFormNode(pDocument->DataMerge_CopyContainer(
+ pContainerItem->GetFormNode(), pParentNode,
ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)), true, true,
- true);
+ true));
break;
}
case XFA_Element::ContentArea: {
- CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode;
+ CXFA_Node* pParentNode = pContainerItem->m_pParent->GetFormNode();
for (CXFA_Node* pChildNode = pParentNode->GetFirstChild(); pChildNode;
pChildNode = pChildNode->GetNextSibling()) {
if (pChildNode->GetTemplateNodeIfExists() !=
- pContainerItem->m_pFormNode) {
+ pContainerItem->GetFormNode()) {
continue;
}
- pContainerItem->m_pFormNode = pChildNode;
+ pContainerItem->SetFormNode(pChildNode);
break;
}
break;
@@ -1827,7 +1832,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
pPendingPageSet->SetFlagAndNotify(XFA_NodeFlag_Initialized);
}
- CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode;
+ CXFA_Node* pPageSet = GetRootLayoutItem()->GetFormNode();
while (pPageSet) {
CXFA_Node* pNextPageSet =
pPageSet->GetNextSameClassSibling<CXFA_PageSet>(XFA_Element::PageSet);
@@ -1884,7 +1889,7 @@ void CXFA_LayoutPageMgr::LayoutPageSetContents() {
iterator(pRootLayoutItem);
for (CXFA_ContainerLayoutItem* pContainerItem = iterator.GetCurrent();
pContainerItem; pContainerItem = iterator.MoveToNext()) {
- CXFA_Node* pNode = pContainerItem->m_pFormNode;
+ CXFA_Node* pNode = pContainerItem->GetFormNode();
switch (pNode->GetElementType()) {
case XFA_Element::PageArea:
m_pLayoutProcessor->GetRootRootItemLayoutProcessor()
@@ -1912,7 +1917,7 @@ void CXFA_LayoutPageMgr::SyncLayoutData() {
iteratorParent(pRootLayoutItem);
for (CXFA_ContainerLayoutItem* pContainerItem = iteratorParent.GetCurrent();
pContainerItem; pContainerItem = iteratorParent.MoveToNext()) {
- switch (pContainerItem->m_pFormNode->GetElementType()) {
+ switch (pContainerItem->GetFormNode()->GetElementType()) {
case XFA_Element::PageArea: {
nPageIdx++;
uint32_t dwRelevant =
@@ -1930,12 +1935,13 @@ void CXFA_LayoutPageMgr::SyncLayoutData() {
}
XFA_AttributeEnum presence =
- pContentItem->m_pFormNode->JSObject()
+ pContentItem->GetFormNode()
+ ->JSObject()
->TryEnum(XFA_Attribute::Presence, true)
.value_or(XFA_AttributeEnum::Visible);
bool bVisible = presence == XFA_AttributeEnum::Visible;
uint32_t dwRelevantChild =
- GetRelevant(pContentItem->m_pFormNode, dwRelevant);
+ GetRelevant(pContentItem->GetFormNode(), dwRelevant);
SyncContainer(pNotify, m_pLayoutProcessor, pContentItem,
dwRelevantChild, bVisible, nPageIdx);
pChildLayoutItem = iterator.SkipChildrenAndMoveToNext();
@@ -1966,7 +1972,7 @@ void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) {
XFA_ReleaseLayoutItem_NoPageArea(pNode);
pNode = pNext;
}
- if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::PageArea)
+ if (pLayoutItem->GetFormNode()->GetElementType() != XFA_Element::PageArea)
delete pLayoutItem;
}
@@ -1980,9 +1986,9 @@ void CXFA_LayoutPageMgr::PrepareLayout() {
CXFA_ContainerLayoutItem* pRootLayoutItem = m_pPageSetLayoutItemRoot;
if (pRootLayoutItem &&
- pRootLayoutItem->m_pFormNode->GetPacketType() == XFA_PacketType::Form) {
- CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode;
- pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.clear();
+ pRootLayoutItem->GetFormNode()->GetPacketType() == XFA_PacketType::Form) {
+ CXFA_Node* pPageSetFormNode = pRootLayoutItem->GetFormNode();
+ pRootLayoutItem->GetFormNode()->GetDocument()->m_pPendingPageSet.clear();
if (pPageSetFormNode->HasRemovedChildren()) {
XFA_ReleaseLayoutItem(pRootLayoutItem);
m_pPageSetLayoutItemRoot = nullptr;
@@ -1995,8 +2001,9 @@ void CXFA_LayoutPageMgr::PrepareLayout() {
pPageSetFormNode->GetNextSameClassSibling<CXFA_PageSet>(
XFA_Element::PageSet);
pPageSetFormNode->GetParent()->RemoveChild(pPageSetFormNode, false);
- pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.push_back(
- pPageSetFormNode);
+ pRootLayoutItem->GetFormNode()
+ ->GetDocument()
+ ->m_pPendingPageSet.push_back(pPageSetFormNode);
pPageSetFormNode = pNextPageSet;
}
}