Chromium Code Reviews| Index: xfa/fxfa/parser/xfa_layout_itemlayout.cpp |
| diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp |
| index ef2df840c99bec14fe619f7d1384e61620195f37..7ab4468c1d77f4fe4d2c478c9eb5ebdafe3d0881 100644 |
| --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp |
| +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp |
| @@ -9,7 +9,6 @@ |
| #include <algorithm> |
| #include <memory> |
| -#include "xfa/fgas/crt/fgas_algorithm.h" |
| #include "xfa/fxfa/app/xfa_ffnotify.h" |
| #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| #include "xfa/fxfa/parser/cxfa_occur.h" |
| @@ -25,6 +24,36 @@ |
| #include "xfa/fxfa/parser/xfa_script.h" |
| #include "xfa/fxfa/parser/xfa_utils.h" |
| +namespace { |
| + |
| +int32_t SeparateStringW(const FX_WCHAR* pStr, |
| + int32_t iStrLen, |
| + FX_WCHAR delimiter, |
| + CFX_WideStringArray& pieces) { |
| + if (pStr == NULL) { |
|
Tom Sepez
2016/05/18 22:01:22
nit: !pStr, no braces
dsinclair
2016/05/19 14:24:44
Done.
|
| + return 0; |
| + } |
| + if (iStrLen < 0) { |
|
Tom Sepez
2016/05/18 22:01:21
no {}
dsinclair
2016/05/19 14:24:44
Done.
|
| + iStrLen = FXSYS_wcslen(pStr); |
| + } |
| + const FX_WCHAR* pToken = pStr; |
| + const FX_WCHAR* pEnd = pStr + iStrLen; |
| + while (TRUE) { |
| + if (pStr >= pEnd || delimiter == *pStr) { |
| + CFX_WideString sub(pToken, pStr - pToken); |
| + pieces.Add(sub); |
| + pToken = pStr + 1; |
| + if (pStr >= pEnd) { |
| + break; |
| + } |
| + } |
| + pStr++; |
| + } |
| + return pieces.GetSize(); |
| +} |
| + |
| +} // namespace |
| + |
| CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, |
| CXFA_LayoutPageMgr* pPageMgr) |
| : m_bKeepBreakFinish(FALSE), |
| @@ -1380,8 +1409,8 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { |
| CFX_WideStringC wsColumnWidths; |
| if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { |
| CFX_WideStringArray widths; |
| - if (FX_SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(), |
| - L' ', widths) > 0) { |
| + if (SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(), |
| + L' ', widths) > 0) { |
| int32_t iCols = widths.GetSize(); |
| CFX_WideString wsWidth; |
| for (int32_t i = 0; i < iCols; i++) { |