Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Unified Diff: xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp

Issue 1890563003: Simplify XFA event handling. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: cleanup CXFA_Node Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
index 78492c2702c0882523ce33a487de579cab23b6aa..4778613c9eb94293f0f26d9b0af19ba84782cbd3 100644
--- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
@@ -415,8 +415,7 @@ void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord,
(CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea);
m_PageArray.Add(pContainerItem);
m_nAvailPages++;
- pNotify->OnPageEvent(pContainerItem, XFA_PAGEEVENT_PageAdded,
- (void*)(uintptr_t)m_nAvailPages);
+ pNotify->OnPageEvent(pContainerItem, XFA_PAGEVIEWEVENT_PostRemoved);
pNewPageAreaLayoutItem = pContainerItem;
}
pNewRecord->pCurPageSet->AddChild(pNewPageAreaLayoutItem);
@@ -1507,8 +1506,7 @@ static void XFA_SyncRemoveLayoutItem(CXFA_LayoutItem* pParentLayoutItem,
if (pCurLayoutItem->m_pFirstChild) {
XFA_SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout);
}
- pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem);
delete pCurLayoutItem;
pCurLayoutItem = pNextLayoutItem;
}
@@ -1528,8 +1526,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
if (pCurLayoutItem->m_pFirstChild) {
XFA_SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout);
}
- pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem);
delete pCurLayoutItem;
pCurLayoutItem = pNextLayoutItem;
continue;
@@ -1679,8 +1676,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>(
pNode->GetUserData(XFA_LAYOUTITEMKEY));
if (pLayoutItem) {
- pNotify->OnLayoutEvent(pDocLayout, pLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
delete pLayoutItem;
}
}
@@ -1740,8 +1736,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>(
pChildNode->GetUserData(XFA_LAYOUTITEMKEY));
if (pLayoutItem) {
- pNotify->OnLayoutEvent(pDocLayout, pLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
delete pLayoutItem;
}
}
@@ -1749,8 +1744,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>(
pNode->GetUserData(XFA_LAYOUTITEMKEY));
if (pLayoutItem) {
- pNotify->OnLayoutEvent(pDocLayout, pLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
delete pLayoutItem;
}
}
@@ -1814,9 +1808,7 @@ void XFA_SyncContainer(CXFA_FFNotify* pNotify,
dwStatus =
(bVisibleItem ? XFA_LAYOUTSTATUS_Visible : 0) | dwRelevantContainer;
}
- pNotify->OnLayoutEvent(pDocLayout, pContainerItem, XFA_LAYOUTEVENT_ItemAdded,
- (void*)(uintptr_t)nPageIndex,
- (void*)(uintptr_t)dwStatus);
+ pNotify->OnLayoutItemAdd(pDocLayout, pContainerItem, nPageIndex, dwStatus);
for (CXFA_LayoutItem* pChild = pContainerItem->m_pFirstChild; pChild;
pChild = pChild->m_pNextSibling) {
if (pChild->IsContentLayoutItem()) {
@@ -1876,7 +1868,7 @@ void CXFA_LayoutPageMgr::SyncLayoutData() {
for (int32_t i = nPage - 1; i >= m_nAvailPages; i--) {
CXFA_ContainerLayoutItem* pPage = m_PageArray[i];
m_PageArray.RemoveAt(i);
- pNotify->OnPageEvent(pPage, XFA_PAGEEVENT_PageRemoved);
+ pNotify->OnPageEvent(pPage, XFA_PAGEVIEWEVENT_PostRemoved);
delete pPage;
}
ClearRecordList();

Powered by Google App Engine
This is Rietveld 408576698