| OLD | NEW |
| 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) |
| 34 return 0; |
| 35 if (iStrLen < 0) |
| 36 iStrLen = FXSYS_wcslen(pStr); |
| 37 |
| 38 const FX_WCHAR* pToken = pStr; |
| 39 const FX_WCHAR* pEnd = pStr + iStrLen; |
| 40 while (TRUE) { |
| 41 if (pStr >= pEnd || delimiter == *pStr) { |
| 42 CFX_WideString sub(pToken, pStr - pToken); |
| 43 pieces.Add(sub); |
| 44 pToken = pStr + 1; |
| 45 if (pStr >= pEnd) |
| 46 break; |
| 47 } |
| 48 pStr++; |
| 49 } |
| 50 return pieces.GetSize(); |
| 51 } |
| 52 |
| 53 } // namespace |
| 54 |
| 28 CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, | 55 CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, |
| 29 CXFA_LayoutPageMgr* pPageMgr) | 56 CXFA_LayoutPageMgr* pPageMgr) |
| 30 : m_bKeepBreakFinish(FALSE), | 57 : m_bKeepBreakFinish(FALSE), |
| 31 m_bIsProcessKeep(FALSE), | 58 m_bIsProcessKeep(FALSE), |
| 32 m_pKeepHeadNode(nullptr), | 59 m_pKeepHeadNode(nullptr), |
| 33 m_pKeepTailNode(nullptr), | 60 m_pKeepTailNode(nullptr), |
| 34 m_pFormNode(pNode), | 61 m_pFormNode(pNode), |
| 35 m_pLayoutItem(nullptr), | 62 m_pLayoutItem(nullptr), |
| 36 m_pOldLayoutItem(nullptr), | 63 m_pOldLayoutItem(nullptr), |
| 37 m_pCurChildNode(XFA_LAYOUT_INVALIDNODE), | 64 m_pCurChildNode(XFA_LAYOUT_INVALIDNODE), |
| (...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); | 1400 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); |
| 1374 fRightInset = | 1401 fRightInset = |
| 1375 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); | 1402 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); |
| 1376 } | 1403 } |
| 1377 FX_FLOAT fContentWidthLimit = | 1404 FX_FLOAT fContentWidthLimit = |
| 1378 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX | 1405 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX |
| 1379 : fContainerWidth - fLeftInset - fRightInset; | 1406 : fContainerWidth - fLeftInset - fRightInset; |
| 1380 CFX_WideStringC wsColumnWidths; | 1407 CFX_WideStringC wsColumnWidths; |
| 1381 if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { | 1408 if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { |
| 1382 CFX_WideStringArray widths; | 1409 CFX_WideStringArray widths; |
| 1383 if (FX_SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(), | 1410 if (SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(), |
| 1384 L' ', widths) > 0) { | 1411 L' ', widths) > 0) { |
| 1385 int32_t iCols = widths.GetSize(); | 1412 int32_t iCols = widths.GetSize(); |
| 1386 CFX_WideString wsWidth; | 1413 CFX_WideString wsWidth; |
| 1387 for (int32_t i = 0; i < iCols; i++) { | 1414 for (int32_t i = 0; i < iCols; i++) { |
| 1388 wsWidth = widths[i]; | 1415 wsWidth = widths[i]; |
| 1389 wsWidth.TrimLeft(L' '); | 1416 wsWidth.TrimLeft(L' '); |
| 1390 if (!wsWidth.IsEmpty()) { | 1417 if (!wsWidth.IsEmpty()) { |
| 1391 CXFA_Measurement measure(wsWidth.AsStringC()); | 1418 CXFA_Measurement measure(wsWidth.AsStringC()); |
| 1392 m_rgSpecifiedColumnWidths.Add(measure.ToUnit(XFA_UNIT_Pt)); | 1419 m_rgSpecifiedColumnWidths.Add(measure.ToUnit(XFA_UNIT_Pt)); |
| 1393 } | 1420 } |
| 1394 } | 1421 } |
| (...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2963 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate); | 2990 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate); |
| 2964 if (iCount >= iMax) { | 2991 if (iCount >= iMax) { |
| 2965 return FALSE; | 2992 return FALSE; |
| 2966 } | 2993 } |
| 2967 iCount++; | 2994 iCount++; |
| 2968 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount)); | 2995 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount)); |
| 2969 return TRUE; | 2996 return TRUE; |
| 2970 } | 2997 } |
| 2971 return TRUE; | 2998 return TRUE; |
| 2972 } | 2999 } |
| OLD | NEW |