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

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: address comments 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
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_appadapter.cpp ('k') | xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 pFormNode); 1859 pFormNode);
1862 for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode; 1860 for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode;
1863 pNode = sIterator.MoveToNext()) { 1861 pNode = sIterator.MoveToNext()) {
1864 if (pNode->IsContainerNode()) { 1862 if (pNode->IsContainerNode()) {
1865 CXFA_Node* pBindNode = pNode->GetBindData(); 1863 CXFA_Node* pBindNode = pNode->GetBindData();
1866 if (pBindNode) { 1864 if (pBindNode) {
1867 pBindNode->RemoveBindItem(pNode); 1865 pBindNode->RemoveBindItem(pNode);
1868 pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); 1866 pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL);
1869 } 1867 }
1870 } 1868 }
1871 pNode->SetFlag(XFA_NODEFLAG_UnusedNode); 1869 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true);
1872 } 1870 }
1873 } 1871 }
1874 void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( 1872 void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow(
1875 CXFA_Node* pLeaderNode, 1873 CXFA_Node* pLeaderNode,
1876 CXFA_Node* pTrailerNode, 1874 CXFA_Node* pTrailerNode,
1877 CXFA_ContentLayoutItem* pTrailerItem, 1875 CXFA_ContentLayoutItem* pTrailerItem,
1878 CXFA_Node* pFormNode) { 1876 CXFA_Node* pFormNode) {
1879 ProcessUnUseBinds(pLeaderNode); 1877 ProcessUnUseBinds(pLeaderNode);
1880 ProcessUnUseBinds(pTrailerNode); 1878 ProcessUnUseBinds(pTrailerNode);
1881 if (pFormNode == NULL) { 1879 if (pFormNode == NULL) {
(...skipping 1082 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
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_appadapter.cpp ('k') | xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698