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

Side by Side Diff: xfa/fxfa/parser/xfa_layout_itemlayout.cpp

Issue 1890563003: Simplify XFA event handling. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: remove CXFA_FFNotify::OnNodeEvent and XFA_NODEEVENT 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" 7 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 if (m_pOldLayoutItem->m_pPrev) { 554 if (m_pOldLayoutItem->m_pPrev) {
555 m_pOldLayoutItem->m_pPrev->m_pNext = NULL; 555 m_pOldLayoutItem->m_pPrev->m_pNext = NULL;
556 } 556 }
557 CXFA_FFNotify* pNotify = 557 CXFA_FFNotify* pNotify =
558 m_pOldLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); 558 m_pOldLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify();
559 CXFA_LayoutProcessor* pDocLayout = 559 CXFA_LayoutProcessor* pDocLayout =
560 m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); 560 m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout();
561 CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem; 561 CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem;
562 while (pOldLayoutItem) { 562 while (pOldLayoutItem) {
563 CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext; 563 CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext;
564 pNotify->OnLayoutEvent(pDocLayout, pOldLayoutItem, 564 pNotify->OnLayoutItemRemoving(pDocLayout, pOldLayoutItem);
565 XFA_LAYOUTEVENT_ItemRemoving);
566 delete pOldLayoutItem; 565 delete pOldLayoutItem;
567 pOldLayoutItem = pNextOldLayoutItem; 566 pOldLayoutItem = pNextOldLayoutItem;
568 } 567 }
569 m_pOldLayoutItem = NULL; 568 m_pOldLayoutItem = NULL;
570 } 569 }
571 return pLayoutItem; 570 return pLayoutItem;
572 } 571 }
573 static FX_BOOL XFA_ItemLayoutProcessor_FindBreakNode( 572 static FX_BOOL XFA_ItemLayoutProcessor_FindBreakNode(
574 CXFA_Node* pContainerNode, 573 CXFA_Node* pContainerNode,
575 CXFA_Node*& pCurActionNode, 574 CXFA_Node*& pCurActionNode,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 pGenerateNode->GetDocument()->GetDocLayout(); 622 pGenerateNode->GetDocument()->GetDocLayout();
624 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator( 623 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
625 pGenerateNode); 624 pGenerateNode);
626 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; 625 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
627 pNode = sIterator.MoveToNext()) { 626 pNode = sIterator.MoveToNext()) {
628 CXFA_ContentLayoutItem* pCurLayoutItem = 627 CXFA_ContentLayoutItem* pCurLayoutItem =
629 (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY); 628 (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY);
630 CXFA_ContentLayoutItem* pNextLayoutItem = NULL; 629 CXFA_ContentLayoutItem* pNextLayoutItem = NULL;
631 while (pCurLayoutItem) { 630 while (pCurLayoutItem) {
632 pNextLayoutItem = pCurLayoutItem->m_pNext; 631 pNextLayoutItem = pCurLayoutItem->m_pNext;
633 pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem, 632 pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem);
634 XFA_LAYOUTEVENT_ItemRemoving);
635 delete pCurLayoutItem; 633 delete pCurLayoutItem;
636 pCurLayoutItem = pNextLayoutItem; 634 pCurLayoutItem = pNextLayoutItem;
637 } 635 }
638 } 636 }
639 pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode); 637 pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode);
640 } 638 }
641 void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode( 639 void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode(
642 CXFA_Node*& pCurActionNode, 640 CXFA_Node*& pCurActionNode,
643 XFA_ItemLayoutProcessorStages& nCurStage, 641 XFA_ItemLayoutProcessorStages& nCurStage,
644 CXFA_Node* pParentContainer, 642 CXFA_Node* pParentContainer,
(...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after
2964 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate); 2962 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate);
2965 if (iCount >= iMax) { 2963 if (iCount >= iMax) {
2966 return FALSE; 2964 return FALSE;
2967 } 2965 }
2968 iCount++; 2966 iCount++;
2969 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount)); 2967 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount));
2970 return TRUE; 2968 return TRUE;
2971 } 2969 }
2972 return TRUE; 2970 return TRUE;
2973 } 2971 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698