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

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

Issue 1712913002: Move m_rgPendingNodes off of CFX_PtrList. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Delcaration ordering. Created 4 years, 10 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/src/fxfa/src/parser/xfa_layout_itemlayout.h ('k') | no next file » | 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 <algorithm> 7 #include <algorithm>
8 #include <memory>
8 9
9 #include "xfa/src/foxitlib.h" 10 #include "xfa/src/foxitlib.h"
10 #include "xfa/src/fxfa/src/common/xfa_utils.h" 11 #include "xfa/src/fxfa/src/common/xfa_utils.h"
11 #include "xfa/src/fxfa/src/common/xfa_object.h" 12 #include "xfa/src/fxfa/src/common/xfa_object.h"
12 #include "xfa/src/fxfa/src/common/xfa_document.h" 13 #include "xfa/src/fxfa/src/common/xfa_document.h"
13 #include "xfa/src/fxfa/src/common/xfa_parser.h" 14 #include "xfa/src/fxfa/src/common/xfa_parser.h"
14 #include "xfa/src/fxfa/src/common/xfa_script.h" 15 #include "xfa/src/fxfa/src/common/xfa_script.h"
15 #include "xfa/src/fxfa/src/common/xfa_docdata.h" 16 #include "xfa/src/fxfa/src/common/xfa_docdata.h"
16 #include "xfa/src/fxfa/src/common/xfa_doclayout.h" 17 #include "xfa/src/fxfa/src/common/xfa_doclayout.h"
17 #include "xfa/src/fxfa/src/common/xfa_localemgr.h" 18 #include "xfa/src/fxfa/src/common/xfa_localemgr.h"
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 2; 1746 2;
1746 break; 1747 break;
1747 } 1748 }
1748 pProcessor->m_pLayoutItem->m_sSize.y += fHeight; 1749 pProcessor->m_pLayoutItem->m_sSize.y += fHeight;
1749 pProcessor->m_pLayoutItem->AddChild(pLeaderLayoutItem); 1750 pProcessor->m_pLayoutItem->AddChild(pLeaderLayoutItem);
1750 }; 1751 };
1751 static void XFA_ItemLayoutProcessor_AddPendingNode( 1752 static void XFA_ItemLayoutProcessor_AddPendingNode(
1752 CXFA_ItemLayoutProcessor* pProcessor, 1753 CXFA_ItemLayoutProcessor* pProcessor,
1753 CXFA_Node* pPendingNode, 1754 CXFA_Node* pPendingNode,
1754 FX_BOOL bBreakPending) { 1755 FX_BOOL bBreakPending) {
1755 pProcessor->m_rgPendingNodes.AddTail(pPendingNode); 1756 pProcessor->m_PendingNodes.push_back(pPendingNode);
1756 pProcessor->m_bBreakPending = bBreakPending; 1757 pProcessor->m_bBreakPending = bBreakPending;
1757 } 1758 }
1758 static FX_FLOAT XFA_ItemLayoutProcessor_InsertPendingItems( 1759 static FX_FLOAT XFA_ItemLayoutProcessor_InsertPendingItems(
1759 CXFA_ItemLayoutProcessor* pProcessor, 1760 CXFA_ItemLayoutProcessor* pProcessor,
1760 CXFA_Node* pCurChildNode) { 1761 CXFA_Node* pCurChildNode) {
1761 FX_FLOAT fTotalHeight = 0; 1762 FX_FLOAT fTotalHeight = 0;
1762 if (pProcessor->m_rgPendingNodes.GetCount() < 1) { 1763 if (pProcessor->m_PendingNodes.empty()) {
1763 return fTotalHeight; 1764 return fTotalHeight;
1764 } 1765 }
1765 if (pProcessor->m_pLayoutItem == NULL) { 1766 if (pProcessor->m_pLayoutItem == NULL) {
1766 pProcessor->m_pLayoutItem = 1767 pProcessor->m_pLayoutItem =
1767 pProcessor->CreateContentLayoutItem(pCurChildNode); 1768 pProcessor->CreateContentLayoutItem(pCurChildNode);
1768 pProcessor->m_pLayoutItem->m_sSize.Set(0, 0); 1769 pProcessor->m_pLayoutItem->m_sSize.Set(0, 0);
1769 } 1770 }
1770 while (pProcessor->m_rgPendingNodes.GetCount() > 0) { 1771 while (!pProcessor->m_PendingNodes.empty()) {
1771 FX_POSITION pos = pProcessor->m_rgPendingNodes.GetHeadPosition(); 1772 std::unique_ptr<CXFA_ItemLayoutProcessor> pPendingProcessor(
1772 CXFA_Node* pPendingNode = 1773 new CXFA_ItemLayoutProcessor(pProcessor->m_PendingNodes.front(),
1773 reinterpret_cast<CXFA_Node*>(pProcessor->m_rgPendingNodes.GetAt(pos)); 1774 nullptr));
1774 pProcessor->m_rgPendingNodes.RemoveAt(pos); 1775 pProcessor->m_PendingNodes.pop_front();
1775 CXFA_ContentLayoutItem* pPendingLayoutItem = NULL;
1776 CXFA_ItemLayoutProcessor* pPendingProcessor =
1777 new CXFA_ItemLayoutProcessor(pPendingNode, NULL);
1778 #ifndef _XFA_LAYOUTITEM_ProcessCACHE_ 1776 #ifndef _XFA_LAYOUTITEM_ProcessCACHE_
1779 pPendingProcessor->m_pPageMgrCreateItem = pProcessor->m_pPageMgrCreateItem; 1777 pPendingProcessor->m_pPageMgrCreateItem = pProcessor->m_pPageMgrCreateItem;
1780 #endif 1778 #endif
1781 pPendingProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); 1779 pPendingProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX);
1782 pPendingLayoutItem = pPendingProcessor->HasLayoutItem() 1780 CXFA_ContentLayoutItem* pPendingLayoutItem =
1783 ? pPendingProcessor->ExtractLayoutItem() 1781 pPendingProcessor->HasLayoutItem()
1784 : NULL; 1782 ? pPendingProcessor->ExtractLayoutItem()
1785 delete pPendingProcessor; 1783 : nullptr;
1786 if (pPendingLayoutItem) { 1784 if (pPendingLayoutItem) {
1787 XFA_ItemLayoutProcessor_AddLeaderAfterSplit(pProcessor, 1785 XFA_ItemLayoutProcessor_AddLeaderAfterSplit(pProcessor,
1788 pPendingLayoutItem); 1786 pPendingLayoutItem);
1789 if (pProcessor->m_bBreakPending) { 1787 if (pProcessor->m_bBreakPending) {
1790 fTotalHeight += pPendingLayoutItem->m_sSize.y; 1788 fTotalHeight += pPendingLayoutItem->m_sSize.y;
1791 } 1789 }
1792 } 1790 }
1793 } 1791 }
1794 return fTotalHeight; 1792 return fTotalHeight;
1795 } 1793 }
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2708 bContainerHeightAutoSize, bContainerWidthAutoSize, 2706 bContainerHeightAutoSize, bContainerWidthAutoSize,
2709 fContentCalculatedWidth, fContentCalculatedHeight, 2707 fContentCalculatedWidth, fContentCalculatedHeight,
2710 fContentCurRowY, fContentCurRowHeight, 2708 fContentCurRowY, fContentCurRowHeight,
2711 fContentWidthLimit, bRootForceTb); 2709 fContentWidthLimit, bRootForceTb);
2712 m_fWidthLimite = fContentCurRowAvailWidth; 2710 m_fWidthLimite = fContentCurRowAvailWidth;
2713 if (bForceEndPage) { 2711 if (bForceEndPage) {
2714 break; 2712 break;
2715 } 2713 }
2716 } 2714 }
2717 FX_BOOL bRetValue = 2715 FX_BOOL bRetValue =
2718 (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done && 2716 m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done &&
2719 m_rgPendingNodes.GetCount() == 0); 2717 m_PendingNodes.empty();
2720 if (bBreakDone) { 2718 if (bBreakDone) {
2721 bRetValue = FALSE; 2719 bRetValue = FALSE;
2722 } 2720 }
2723 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( 2721 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize(
2724 m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, 2722 m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
2725 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, 2723 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight,
2726 fContainerHeight); 2724 fContainerHeight);
2727 if (fContainerHeight >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || 2725 if (fContainerHeight >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem ||
2728 bRetValue) { 2726 bRetValue) {
2729 if (m_pLayoutItem == NULL) { 2727 if (m_pLayoutItem == NULL) {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
3017 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate); 3015 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate);
3018 if (iCount >= iMax) { 3016 if (iCount >= iMax) {
3019 return FALSE; 3017 return FALSE;
3020 } 3018 }
3021 iCount++; 3019 iCount++;
3022 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount)); 3020 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount));
3023 return TRUE; 3021 return TRUE;
3024 } 3022 }
3025 return TRUE; 3023 return TRUE;
3026 } 3024 }
OLDNEW
« no previous file with comments | « xfa/src/fxfa/src/parser/xfa_layout_itemlayout.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698