summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_layoutitem.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-08-03 10:20:32 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-03 10:20:32 -0700
commit6ea5ba035a396bf0956b4b4ab3a5b3ee33b6c546 (patch)
tree04083808d748c93226f6c3752fb05f47fc0851cb /xfa/fxfa/parser/cxfa_layoutitem.cpp
parente85f971fe9ba628e46bcb0709d5da4368c15d0b0 (diff)
downloadpdfium-6ea5ba035a396bf0956b4b4ab3a5b3ee33b6c546.tar.xz
Split xfa_layout_appadapter
This moves the needed traverse strategies into their own files, removes the unused one and cleans up the includes. Review-Url: https://codereview.chromium.org/2207033002
Diffstat (limited to 'xfa/fxfa/parser/cxfa_layoutitem.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_layoutitem.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/xfa/fxfa/parser/cxfa_layoutitem.cpp b/xfa/fxfa/parser/cxfa_layoutitem.cpp
index a9ba3490d8..ebe33b650f 100644
--- a/xfa/fxfa/parser/cxfa_layoutitem.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutitem.cpp
@@ -6,9 +6,32 @@
#include "xfa/fxfa/parser/cxfa_layoutitem.h"
+#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
+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()->GetDocLayout();
+ while (pNode) {
+ CXFA_LayoutItem* pNext = pNode->m_pNextSibling;
+ pNode->m_pParent = nullptr;
+ pNotify->OnLayoutItemRemoving(pDocLayout,
+ static_cast<CXFA_LayoutItem*>(pNode));
+ XFA_ReleaseLayoutItem(pNode);
+ pNode = pNext;
+ }
+
+ pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
+ if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::PageArea) {
+ pNotify->OnPageEvent(static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem),
+ XFA_PAGEVIEWEVENT_PostRemoved);
+ }
+ delete pLayoutItem;
+}
+
CXFA_LayoutItem::CXFA_LayoutItem(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem)
: m_pFormNode(pNode),
m_pParent(nullptr),