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

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

Issue 1999883002: Use std::map in CXFA_ItemLayoutProcessor (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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_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 "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 2956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2967 fHeight = m_pLayoutItem->m_sSize.y; 2967 fHeight = m_pLayoutItem->m_sSize.y;
2968 } 2968 }
2969 void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(FX_FLOAT fAbsoluteX, 2969 void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(FX_FLOAT fAbsoluteX,
2970 FX_FLOAT fAbsoluteY) { 2970 FX_FLOAT fAbsoluteY) {
2971 m_pLayoutItem->m_sPos = CFX_PointF(fAbsoluteX, fAbsoluteY); 2971 m_pLayoutItem->m_sPos = CFX_PointF(fAbsoluteX, fAbsoluteY);
2972 } 2972 }
2973 void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(FX_FLOAT fWidth, 2973 void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(FX_FLOAT fWidth,
2974 FX_FLOAT fHeight) { 2974 FX_FLOAT fHeight) {
2975 m_pLayoutItem->m_sSize = CFX_SizeF(fWidth, fHeight); 2975 m_pLayoutItem->m_sSize = CFX_SizeF(fWidth, fHeight);
2976 } 2976 }
2977
2977 FX_BOOL CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur( 2978 FX_BOOL CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur(
2978 CXFA_Node* pFormNode) { 2979 CXFA_Node* pFormNode) {
2979 if (pFormNode == NULL) { 2980 if (!pFormNode)
2980 return FALSE; 2981 return FALSE;
2981 } 2982
2982 CXFA_Node* pTemplate = pFormNode->GetTemplateNode(); 2983 CXFA_Node* pTemplate = pFormNode->GetTemplateNode();
2983 if (!pTemplate) { 2984 if (!pTemplate)
2984 pTemplate = pFormNode; 2985 pTemplate = pFormNode;
2985 } 2986
2986 CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_ELEMENT_Occur)); 2987 CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_ELEMENT_Occur));
2987 int32_t iMax = NodeOccur.GetMax(); 2988 int32_t iMax = NodeOccur.GetMax();
2988 if (iMax > -1) { 2989 if (iMax < 0)
2989 int32_t iCount =
2990 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate);
2991 if (iCount >= iMax) {
2992 return FALSE;
2993 }
2994 iCount++;
2995 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount));
2996 return TRUE; 2990 return TRUE;
2997 } 2991
2992 int32_t iCount = m_PendingNodesCount[pTemplate];
2993 if (iCount >= iMax)
2994 return FALSE;
2995
2996 m_PendingNodesCount[pTemplate] = iCount + 1;
2998 return TRUE; 2997 return TRUE;
2999 } 2998 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_itemlayout.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698