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

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

Issue 1992033002: fgas/ code cleanup. (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
« xfa/fxfa/app/xfa_ffdoc.cpp ('K') | « xfa/fxfa/app/xfa_ffdoc.cpp ('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>
11 11
12 #include "xfa/fgas/crt/fgas_algorithm.h"
13 #include "xfa/fxfa/app/xfa_ffnotify.h" 12 #include "xfa/fxfa/app/xfa_ffnotify.h"
14 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 13 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
15 #include "xfa/fxfa/parser/cxfa_occur.h" 14 #include "xfa/fxfa/parser/cxfa_occur.h"
16 #include "xfa/fxfa/parser/xfa_doclayout.h" 15 #include "xfa/fxfa/parser/xfa_doclayout.h"
17 #include "xfa/fxfa/parser/xfa_document.h" 16 #include "xfa/fxfa/parser/xfa_document.h"
18 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" 17 #include "xfa/fxfa/parser/xfa_document_layout_imp.h"
19 #include "xfa/fxfa/parser/xfa_layout_appadapter.h" 18 #include "xfa/fxfa/parser/xfa_layout_appadapter.h"
20 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" 19 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h"
21 #include "xfa/fxfa/parser/xfa_localemgr.h" 20 #include "xfa/fxfa/parser/xfa_localemgr.h"
22 #include "xfa/fxfa/parser/xfa_object.h" 21 #include "xfa/fxfa/parser/xfa_object.h"
23 #include "xfa/fxfa/parser/xfa_parser.h" 22 #include "xfa/fxfa/parser/xfa_parser.h"
24 #include "xfa/fxfa/parser/xfa_parser_imp.h" 23 #include "xfa/fxfa/parser/xfa_parser_imp.h"
25 #include "xfa/fxfa/parser/xfa_script.h" 24 #include "xfa/fxfa/parser/xfa_script.h"
26 #include "xfa/fxfa/parser/xfa_utils.h" 25 #include "xfa/fxfa/parser/xfa_utils.h"
27 26
27 namespace {
28
29 int32_t SeparateStringW(const FX_WCHAR* pStr,
30 int32_t iStrLen,
31 FX_WCHAR delimiter,
32 CFX_WideStringArray& pieces) {
33 if (pStr == NULL) {
Tom Sepez 2016/05/18 22:01:22 nit: !pStr, no braces
dsinclair 2016/05/19 14:24:44 Done.
34 return 0;
35 }
36 if (iStrLen < 0) {
Tom Sepez 2016/05/18 22:01:21 no {}
dsinclair 2016/05/19 14:24:44 Done.
37 iStrLen = FXSYS_wcslen(pStr);
38 }
39 const FX_WCHAR* pToken = pStr;
40 const FX_WCHAR* pEnd = pStr + iStrLen;
41 while (TRUE) {
42 if (pStr >= pEnd || delimiter == *pStr) {
43 CFX_WideString sub(pToken, pStr - pToken);
44 pieces.Add(sub);
45 pToken = pStr + 1;
46 if (pStr >= pEnd) {
47 break;
48 }
49 }
50 pStr++;
51 }
52 return pieces.GetSize();
53 }
54
55 } // namespace
56
28 CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, 57 CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode,
29 CXFA_LayoutPageMgr* pPageMgr) 58 CXFA_LayoutPageMgr* pPageMgr)
30 : m_bKeepBreakFinish(FALSE), 59 : m_bKeepBreakFinish(FALSE),
31 m_bIsProcessKeep(FALSE), 60 m_bIsProcessKeep(FALSE),
32 m_pKeepHeadNode(nullptr), 61 m_pKeepHeadNode(nullptr),
33 m_pKeepTailNode(nullptr), 62 m_pKeepTailNode(nullptr),
34 m_pFormNode(pNode), 63 m_pFormNode(pNode),
35 m_pLayoutItem(nullptr), 64 m_pLayoutItem(nullptr),
36 m_pOldLayoutItem(nullptr), 65 m_pOldLayoutItem(nullptr),
37 m_pCurChildNode(XFA_LAYOUT_INVALIDNODE), 66 m_pCurChildNode(XFA_LAYOUT_INVALIDNODE),
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); 1402 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
1374 fRightInset = 1403 fRightInset =
1375 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); 1404 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
1376 } 1405 }
1377 FX_FLOAT fContentWidthLimit = 1406 FX_FLOAT fContentWidthLimit =
1378 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX 1407 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX
1379 : fContainerWidth - fLeftInset - fRightInset; 1408 : fContainerWidth - fLeftInset - fRightInset;
1380 CFX_WideStringC wsColumnWidths; 1409 CFX_WideStringC wsColumnWidths;
1381 if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { 1410 if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) {
1382 CFX_WideStringArray widths; 1411 CFX_WideStringArray widths;
1383 if (FX_SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(), 1412 if (SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(),
1384 L' ', widths) > 0) { 1413 L' ', widths) > 0) {
1385 int32_t iCols = widths.GetSize(); 1414 int32_t iCols = widths.GetSize();
1386 CFX_WideString wsWidth; 1415 CFX_WideString wsWidth;
1387 for (int32_t i = 0; i < iCols; i++) { 1416 for (int32_t i = 0; i < iCols; i++) {
1388 wsWidth = widths[i]; 1417 wsWidth = widths[i];
1389 wsWidth.TrimLeft(L' '); 1418 wsWidth.TrimLeft(L' ');
1390 if (!wsWidth.IsEmpty()) { 1419 if (!wsWidth.IsEmpty()) {
1391 CXFA_Measurement measure(wsWidth.AsStringC()); 1420 CXFA_Measurement measure(wsWidth.AsStringC());
1392 m_rgSpecifiedColumnWidths.Add(measure.ToUnit(XFA_UNIT_Pt)); 1421 m_rgSpecifiedColumnWidths.Add(measure.ToUnit(XFA_UNIT_Pt));
1393 } 1422 }
1394 } 1423 }
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
2963 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate); 2992 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate);
2964 if (iCount >= iMax) { 2993 if (iCount >= iMax) {
2965 return FALSE; 2994 return FALSE;
2966 } 2995 }
2967 iCount++; 2996 iCount++;
2968 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount)); 2997 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount));
2969 return TRUE; 2998 return TRUE;
2970 } 2999 }
2971 return TRUE; 3000 return TRUE;
2972 } 3001 }
OLDNEW
« xfa/fxfa/app/xfa_ffdoc.cpp ('K') | « xfa/fxfa/app/xfa_ffdoc.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698