Tidy cxfa_itemlayoutprocessor.h - Nest Result enumerated type and use |k| constant names. - Narrow enum storage and arrange similar types together. - Fix spelling of |limite|. - Avoid some unique_ptr release/reset, and potential leak. - Remove redundant else-after-goto Change-Id: I8d9b0659d0f3c0b6e07236fbe7d17182e3789920 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/51510 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp index 14a5478..12941c4 100644 --- a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp
@@ -1362,7 +1362,7 @@ float fWidth = pTrailerItem->m_sSize.width; XFA_AttributeValue eLayout = GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout); - return eLayout == XFA_AttributeValue::Tb || m_fWidthLimite <= fWidth; + return eLayout == XFA_AttributeValue::Tb || m_fWidthLimit <= fWidth; } float CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() { @@ -1387,14 +1387,14 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit( CXFA_ItemLayoutProcessor* pChildProcessor, - XFA_ItemLayoutProcessorResult eRetValue, + Result eRetValue, std::vector<CXFA_ContentLayoutItem*>* rgCurLineLayoutItem, float* fContentCurRowAvailWidth, float* fContentCurRowHeight, float* fContentCurRowY, bool* bAddedItemInRow, bool* bForceEndPage, - XFA_ItemLayoutProcessorResult* result) { + Result* result) { if (!pChildProcessor) return false; @@ -1417,7 +1417,7 @@ } *bAddedItemInRow = true; *bForceEndPage = true; - *result = XFA_ItemLayoutProcessorResult::PageFullBreak; + *result = Result::kPageFullBreak; return true; } @@ -1426,7 +1426,6 @@ *fContentCurRowAvailWidth -= childSize.width; *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); *result = eRetValue; - return true; } @@ -1496,7 +1495,8 @@ XFA_ReleaseLayoutItem(pTrailerItem); } -XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( +CXFA_ItemLayoutProcessor::Result +CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( bool bUseBreakControl, XFA_AttributeValue eFlowStrategy, float fHeightLimit, @@ -1509,10 +1509,8 @@ bool bContainerHeightAutoSize = true; bool bForceEndPage = false; bool bIsManualBreak = false; - if (m_pCurChildPreprocessor) { - m_pCurChildPreprocessor->m_ePreProcessRs = - XFA_ItemLayoutProcessorResult::Done; - } + if (m_pCurChildPreprocessor) + m_pCurChildPreprocessor->m_ePreProcessRs = Result::kDone; CFX_SizeF containerSize = CalculateContainerSpecifiedSize( GetFormNode(), &bContainerWidthAutoSize, &bContainerHeightAutoSize); @@ -1619,7 +1617,7 @@ while (m_nCurChildNodeStage != Stage::kDone) { float fContentCurRowHeight = 0; float fContentCurRowAvailWidth = fContentWidthLimit; - m_fWidthLimite = fContentCurRowAvailWidth; + m_fWidthLimit = fContentCurRowAvailWidth; std::vector<CXFA_ContentLayoutItem*> rgCurLineLayoutItems[3]; uint8_t uCurHAlignState = (eFlowStrategy != XFA_AttributeValue::Rl_tb ? 0 : 2); @@ -1790,8 +1788,7 @@ case Stage::kBookendLeader: { CXFA_Node* pLeaderNode = nullptr; if (m_pCurChildPreprocessor) { - pProcessor.reset(m_pCurChildPreprocessor); - m_pCurChildPreprocessor = nullptr; + pProcessor = std::move(m_pCurChildPreprocessor); } else if (m_pPageMgr && m_pPageMgr->ProcessBookendLeaderOrTrailer( m_pCurChildNode, true, pLeaderNode)) { pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>( @@ -1806,20 +1803,18 @@ fAvailHeight, fRealHeight, fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, &fContentCurRowHeight, &bAddedItemInRow, - &bForceEndPage, pContext, false) != - XFA_ItemLayoutProcessorResult::Done) { + &bForceEndPage, pContext, + false) != Result::kDone) { goto SuspendAndCreateNewRow; - } else { - pProcessor.reset(); } + pProcessor.reset(); } break; } case Stage::kBookendTrailer: { CXFA_Node* pTrailerNode = nullptr; if (m_pCurChildPreprocessor) { - pProcessor.reset(m_pCurChildPreprocessor); - m_pCurChildPreprocessor = nullptr; + pProcessor = std::move(m_pCurChildPreprocessor); } else if (m_pPageMgr && m_pPageMgr->ProcessBookendLeaderOrTrailer( m_pCurChildNode, false, pTrailerNode)) { pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>( @@ -1833,12 +1828,11 @@ fAvailHeight, fRealHeight, fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, &fContentCurRowHeight, &bAddedItemInRow, - &bForceEndPage, pContext, false) != - XFA_ItemLayoutProcessorResult::Done) { + &bForceEndPage, pContext, + false) != Result::kDone) { goto SuspendAndCreateNewRow; - } else { - pProcessor.reset(); } + pProcessor.reset(); } break; } @@ -1856,8 +1850,7 @@ bool bNewRow = false; if (m_pCurChildPreprocessor) { - pProcessor.reset(m_pCurChildPreprocessor); - m_pCurChildPreprocessor = nullptr; + pProcessor = std::move(m_pCurChildPreprocessor); bNewRow = true; } else { pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>( @@ -1865,7 +1858,7 @@ } pProcessor->InsertPendingItems(m_pCurChildNode); - XFA_ItemLayoutProcessorResult rs = InsertFlowedItem( + Result rs = InsertFlowedItem( pProcessor.get(), bContainerWidthAutoSize, bContainerHeightAutoSize, containerSize.height, eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, @@ -1873,15 +1866,15 @@ &fContentCurRowAvailWidth, &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage, pContext, bNewRow); switch (rs) { - case XFA_ItemLayoutProcessorResult::ManualBreak: + case Result::kManualBreak: bIsManualBreak = true; FALLTHROUGH; - case XFA_ItemLayoutProcessorResult::PageFullBreak: + case Result::kPageFullBreak: bForceEndPage = true; FALLTHROUGH; - case XFA_ItemLayoutProcessorResult::RowFullBreak: + case Result::kRowFullBreak: goto SuspendAndCreateNewRow; - case XFA_ItemLayoutProcessorResult::Done: + case Result::kDone: default: fContentCurRowY += pProcessor->InsertPendingItems(m_pCurChildNode); @@ -1901,7 +1894,7 @@ continue; SuspendAndCreateNewRow: if (pProcessor) - m_pCurChildPreprocessor = pProcessor.release(); + m_pCurChildPreprocessor = std::move(pProcessor); break; } @@ -1910,7 +1903,7 @@ bContainerWidthAutoSize, &fContentCalculatedWidth, &fContentCalculatedHeight, &fContentCurRowY, fContentCurRowHeight, fContentWidthLimit, bRootForceTb); - m_fWidthLimite = fContentCurRowAvailWidth; + m_fWidthLimit = fContentCurRowAvailWidth; if (bForceEndPage) break; } @@ -1938,9 +1931,8 @@ } return bRetValue - ? XFA_ItemLayoutProcessorResult::Done - : (bIsManualBreak ? XFA_ItemLayoutProcessorResult::ManualBreak - : XFA_ItemLayoutProcessorResult::PageFullBreak); + ? Result::kDone + : (bIsManualBreak ? Result::kManualBreak : Result::kPageFullBreak); } bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( @@ -2112,7 +2104,7 @@ SetCurrentComponentSize(size); } -XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( +CXFA_ItemLayoutProcessor::Result CXFA_ItemLayoutProcessor::DoLayout( bool bUseBreakControl, float fHeightLimit, float fRealHeight, @@ -2139,22 +2131,21 @@ default: DoLayoutPositionedContainer(pContext); m_nCurChildNodeStage = Stage::kDone; - return XFA_ItemLayoutProcessorResult::Done; + return Result::kDone; case XFA_AttributeValue::Table: DoLayoutTableContainer(pLayoutNode); m_nCurChildNodeStage = Stage::kDone; - return XFA_ItemLayoutProcessorResult::Done; + return Result::kDone; } } case XFA_Element::Draw: case XFA_Element::Field: DoLayoutField(); m_nCurChildNodeStage = Stage::kDone; - return XFA_ItemLayoutProcessorResult::Done; + return Result::kDone; case XFA_Element::ContentArea: - return XFA_ItemLayoutProcessorResult::Done; default: - return XFA_ItemLayoutProcessorResult::Done; + return Result::kDone; } } @@ -2367,7 +2358,7 @@ return fTotalHeight; } -XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem( +CXFA_ItemLayoutProcessor::Result CXFA_ItemLayoutProcessor::InsertFlowedItem( CXFA_ItemLayoutProcessor* pProcessor, bool bContainerWidthAutoSize, bool bContainerHeightAutoSize, @@ -2396,7 +2387,7 @@ uHAlign < *uCurHAlignState) || (eFlowStrategy == XFA_AttributeValue::Rl_tb && uHAlign > *uCurHAlignState)) { - return XFA_ItemLayoutProcessorResult::RowFullBreak; + return Result::kRowFullBreak; } *uCurHAlignState = uHAlign; @@ -2427,9 +2418,8 @@ } } - XFA_ItemLayoutProcessorResult eRetValue = XFA_ItemLayoutProcessorResult::Done; - if (!bNewRow || - pProcessor->m_ePreProcessRs == XFA_ItemLayoutProcessorResult::Done) { + Result eRetValue = Result::kDone; + if (!bNewRow || pProcessor->m_ePreProcessRs == Result::kDone) { eRetValue = pProcessor->DoLayout( bTakeSpace ? bUseBreakControl : false, bUseRealHeight ? fRealHeight - *fContentCurRowY : FLT_MAX, @@ -2438,7 +2428,7 @@ pProcessor->m_ePreProcessRs = eRetValue; } else { eRetValue = pProcessor->m_ePreProcessRs; - pProcessor->m_ePreProcessRs = XFA_ItemLayoutProcessorResult::Done; + pProcessor->m_ePreProcessRs = Result::kDone; } if (pProcessor->HasLayoutItem() == false) return eRetValue; @@ -2451,7 +2441,7 @@ if (bTakeSpace && (childSize.width > *fContentCurRowAvailWidth + kXFALayoutPrecision) && (fContentWidthLimit - *fContentCurRowAvailWidth > kXFALayoutPrecision)) { - return XFA_ItemLayoutProcessorResult::RowFullBreak; + return Result::kRowFullBreak; } CXFA_Node* pOverflowLeaderNode = nullptr; @@ -2497,7 +2487,7 @@ fAvailHeight + kXFALayoutPrecision || (!bContainerHeightAutoSize && m_fUsedSize + fAvailHeight + kXFALayoutPrecision >= fContainerHeight)) { - if (!bTakeSpace || eRetValue == XFA_ItemLayoutProcessorResult::Done) { + if (!bTakeSpace || eRetValue == Result::kDone) { if (pProcessor->m_bUseInheriated) { if (pTrailerLayoutItem) pProcessor->AddTrailerBeforeSplit(childSize.height, @@ -2530,10 +2520,10 @@ *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); } - return XFA_ItemLayoutProcessorResult::Done; + return Result::kDone; } - if (eRetValue == XFA_ItemLayoutProcessorResult::PageFullBreak) { + if (eRetValue == Result::kPageFullBreak) { if (pProcessor->m_bUseInheriated) { if (pTrailerLayoutItem) { pProcessor->AddTrailerBeforeSplit(childSize.height, @@ -2559,7 +2549,7 @@ return eRetValue; } - XFA_ItemLayoutProcessorResult eResult; + Result eResult; if (ProcessKeepForSplit(pProcessor, eRetValue, &rgCurLineLayoutItems[uHAlign], fContentCurRowAvailWidth, fContentCurRowHeight, fContentCurRowY, bAddedItemInRow, bForceEndPage, @@ -2572,8 +2562,7 @@ if (fSplitPos > kXFALayoutPrecision) { XFA_AttributeValue eLayout = pProcessor->GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout); - if (eLayout == XFA_AttributeValue::Tb && - eRetValue == XFA_ItemLayoutProcessorResult::Done) { + if (eLayout == XFA_AttributeValue::Tb && eRetValue == Result::kDone) { pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, pOverflowTrailerNode, pTrailerLayoutItem, pFormNode); @@ -2584,13 +2573,13 @@ *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); } - return XFA_ItemLayoutProcessorResult::PageFullBreak; + return Result::kPageFullBreak; } CXFA_Node* pTempLeaderNode = nullptr; CXFA_Node* pTempTrailerNode = nullptr; if (m_pPageMgr && !pProcessor->m_bUseInheriated && - eRetValue != XFA_ItemLayoutProcessorResult::PageFullBreak) { + eRetValue != Result::kPageFullBreak) { m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, pTempTrailerNode, false, true); } @@ -2629,7 +2618,7 @@ std::max(*fContentCurRowHeight, childSize.height); } } - return XFA_ItemLayoutProcessorResult::PageFullBreak; + return Result::kPageFullBreak; } if (*fContentCurRowY <= kXFALayoutPrecision) { @@ -2650,7 +2639,7 @@ pTrailerLayoutItem, pFormNode); m_bUseInheriated = true; } - return XFA_ItemLayoutProcessorResult::PageFullBreak; + return Result::kPageFullBreak; } rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem()); @@ -2659,7 +2648,7 @@ *fContentCurRowAvailWidth -= childSize.width; *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); } - if (eRetValue == XFA_ItemLayoutProcessorResult::Done) + if (eRetValue == Result::kDone) *bForceEndPage = false; return eRetValue; @@ -2678,11 +2667,11 @@ if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) pProcessor->AddPendingNode(pOverflowLeaderNode, false); - return XFA_ItemLayoutProcessorResult::PageFullBreak; + return Result::kPageFullBreak; } - if (eRetValue != XFA_ItemLayoutProcessorResult::Done) - return XFA_ItemLayoutProcessorResult::PageFullBreak; + if (eRetValue != Result::kDone) + return Result::kPageFullBreak; if (!pFormNode && pLayoutContext) pFormNode = pLayoutContext->m_pOverflowProcessor->GetFormNode(); @@ -2695,7 +2684,7 @@ pTrailerLayoutItem, pFormNode); m_bUseInheriated = true; } - return XFA_ItemLayoutProcessorResult::PageFullBreak; + return Result::kPageFullBreak; } Optional<CXFA_ItemLayoutProcessor::Stage> CXFA_ItemLayoutProcessor::HandleKeep(
diff --git a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.h b/xfa/fxfa/layout/cxfa_itemlayoutprocessor.h index 539b205..2974a2f 100644 --- a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.h +++ b/xfa/fxfa/layout/cxfa_itemlayoutprocessor.h
@@ -11,6 +11,7 @@ #include <list> #include <map> +#include <memory> #include <vector> #include "core/fxcrt/fx_coordinates.h" @@ -28,16 +29,16 @@ class CXFA_LayoutProcessor; class CXFA_Node; -enum class XFA_ItemLayoutProcessorResult { - Done, - PageFullBreak, - RowFullBreak, - ManualBreak, -}; - class CXFA_ItemLayoutProcessor { public: - enum class Stage { + enum class Result : uint8_t { + kDone, + kPageFullBreak, + kRowFullBreak, + kManualBreak, + }; + + enum class Stage : uint8_t { kNone, kBookendLeader, kBreakBefore, @@ -51,10 +52,10 @@ CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr); ~CXFA_ItemLayoutProcessor(); - XFA_ItemLayoutProcessorResult DoLayout(bool bUseBreakControl, - float fHeightLimit, - float fRealHeight, - CXFA_LayoutContext* pContext); + Result DoLayout(bool bUseBreakControl, + float fHeightLimit, + float fRealHeight, + CXFA_LayoutContext* pContext); void DoLayoutPageArea(CXFA_ContainerLayoutItem* pPageAreaLayoutItem); CXFA_Node* GetFormNode() { return m_pFormNode; } @@ -69,14 +70,14 @@ bool ProcessKeepForSplit( CXFA_ItemLayoutProcessor* pChildProcessor, - XFA_ItemLayoutProcessorResult eRetValue, + Result eRetValue, std::vector<CXFA_ContentLayoutItem*>* rgCurLineLayoutItem, float* fContentCurRowAvailWidth, float* fContentCurRowHeight, float* fContentCurRowY, bool* bAddedItemInRow, bool* bForceEndPage, - XFA_ItemLayoutProcessorResult* result); + Result* result); void ProcessUnUseOverFlow(CXFA_Node* pLeaderNode, CXFA_Node* pTrailerNode, CXFA_ContentLayoutItem* pTrailerItem, @@ -111,13 +112,12 @@ void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext); void DoLayoutTableContainer(CXFA_Node* pLayoutNode); - XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer( - bool bUseBreakControl, - XFA_AttributeValue eFlowStrategy, - float fHeightLimit, - float fRealHeight, - CXFA_LayoutContext* pContext, - bool bRootForceTb); + Result DoLayoutFlowedContainer(bool bUseBreakControl, + XFA_AttributeValue eFlowStrategy, + float fHeightLimit, + float fRealHeight, + CXFA_LayoutContext* pContext, + bool bRootForceTb); void DoLayoutField(); void GotoNextContainerNodeSimple(bool bUsePageBreak); @@ -142,7 +142,7 @@ void AddLeaderAfterSplit(CXFA_ContentLayoutItem* pLeaderLayoutItem); void AddPendingNode(CXFA_Node* pPendingNode, bool bBreakPending); float InsertPendingItems(CXFA_Node* pCurChildNode); - XFA_ItemLayoutProcessorResult InsertFlowedItem( + Result InsertFlowedItem( CXFA_ItemLayoutProcessor* pProcessor, bool bContainerWidthAutoSize, bool bContainerHeightAutoSize, @@ -177,30 +177,29 @@ CXFA_Node** pCurActionNode); void ProcessKeepNodesEnd(); - CXFA_Node* m_pFormNode; - CXFA_ContentLayoutItem* m_pLayoutItem = nullptr; - CXFA_Node* m_pCurChildNode = nullptr; - float m_fUsedSize = 0; - UnownedPtr<CXFA_LayoutPageMgr> m_pPageMgr; - std::list<CXFA_Node*> m_PendingNodes; + Stage m_nCurChildNodeStage = Stage::kNone; + Result m_ePreProcessRs = Result::kDone; bool m_bBreakPending = true; - std::vector<float> m_rgSpecifiedColumnWidths; - std::vector<CXFA_ContentLayoutItem*> m_arrayKeepItems; - float m_fLastRowWidth = 0; - float m_fLastRowY = 0; bool m_bUseInheriated = false; - XFA_ItemLayoutProcessorResult m_ePreProcessRs = - XFA_ItemLayoutProcessorResult::Done; bool m_bKeepBreakFinish = false; bool m_bIsProcessKeep = false; + bool m_bHasAvailHeight = true; + float m_fUsedSize = 0; + float m_fLastRowWidth = 0; + float m_fLastRowY = 0; + float m_fWidthLimit = 0; + CXFA_Node* m_pFormNode; + CXFA_Node* m_pCurChildNode = nullptr; CXFA_Node* m_pKeepHeadNode = nullptr; CXFA_Node* m_pKeepTailNode = nullptr; + CXFA_ContentLayoutItem* m_pLayoutItem = nullptr; CXFA_ContentLayoutItem* m_pOldLayoutItem = nullptr; - CXFA_ItemLayoutProcessor* m_pCurChildPreprocessor = nullptr; - Stage m_nCurChildNodeStage = Stage::kNone; + UnownedPtr<CXFA_LayoutPageMgr> m_pPageMgr; + std::vector<float> m_rgSpecifiedColumnWidths; + std::vector<CXFA_ContentLayoutItem*> m_arrayKeepItems; + std::list<CXFA_Node*> m_PendingNodes; std::map<CXFA_Node*, int32_t> m_PendingNodesCount; - float m_fWidthLimite = 0; - bool m_bHasAvailHeight = true; + std::unique_ptr<CXFA_ItemLayoutProcessor> m_pCurChildPreprocessor; }; #endif // XFA_FXFA_LAYOUT_CXFA_ITEMLAYOUTPROCESSOR_H_
diff --git a/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp b/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp index 8139097..616e319 100644 --- a/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp
@@ -473,14 +473,14 @@ void CXFA_LayoutPageMgr::SubmitContentItem( CXFA_ContentLayoutItem* pContentLayoutItem, - XFA_ItemLayoutProcessorResult eStatus) { + CXFA_ItemLayoutProcessor::Result eStatus) { if (pContentLayoutItem) { GetCurrentContainerRecord()->pCurContentArea->AddChild(pContentLayoutItem); m_bCreateOverFlowPage = false; } - if (eStatus != XFA_ItemLayoutProcessorResult::Done) { - if (eStatus == XFA_ItemLayoutProcessorResult::PageFullBreak && + if (eStatus != CXFA_ItemLayoutProcessor::Result::kDone) { + if (eStatus == CXFA_ItemLayoutProcessor::Result::kPageFullBreak && m_CurrentContainerRecordIter == GetTailPosition()) { AppendNewPage(false); }
diff --git a/xfa/fxfa/layout/cxfa_layoutpagemgr.h b/xfa/fxfa/layout/cxfa_layoutpagemgr.h index 041bbd5..8cf6c9e 100644 --- a/xfa/fxfa/layout/cxfa_layoutpagemgr.h +++ b/xfa/fxfa/layout/cxfa_layoutpagemgr.h
@@ -28,7 +28,7 @@ float GetAvailHeight(); bool GetNextAvailContentHeight(float fChildHeight); void SubmitContentItem(CXFA_ContentLayoutItem* pContentLayoutItem, - XFA_ItemLayoutProcessorResult eStatus); + CXFA_ItemLayoutProcessor::Result eStatus); void FinishPaginatedPageSets(); void SyncLayoutData(); int32_t GetPageCount() const;
diff --git a/xfa/fxfa/layout/cxfa_layoutprocessor.cpp b/xfa/fxfa/layout/cxfa_layoutprocessor.cpp index 45b54d6..a31db89 100644 --- a/xfa/fxfa/layout/cxfa_layoutprocessor.cpp +++ b/xfa/fxfa/layout/cxfa_layoutprocessor.cpp
@@ -63,7 +63,7 @@ if (m_nProgressCounter < 1) return -1; - XFA_ItemLayoutProcessorResult eStatus; + CXFA_ItemLayoutProcessor::Result eStatus; CXFA_Node* pFormNode = m_pRootItemLayoutProcessor->GetFormNode(); float fPosX = pFormNode->JSObject()->GetMeasureInUnit(XFA_Attribute::X, XFA_Unit::Pt); @@ -73,7 +73,7 @@ float fAvailHeight = m_pLayoutPageMgr->GetAvailHeight(); eStatus = m_pRootItemLayoutProcessor->DoLayout(true, fAvailHeight, fAvailHeight, nullptr); - if (eStatus != XFA_ItemLayoutProcessorResult::Done) + if (eStatus != CXFA_ItemLayoutProcessor::Result::kDone) m_nProgressCounter++; CXFA_ContentLayoutItem* pLayoutItem = @@ -82,16 +82,16 @@ pLayoutItem->m_sPos = CFX_PointF(fPosX, fPosY); m_pLayoutPageMgr->SubmitContentItem(pLayoutItem, eStatus); - } while (eStatus != XFA_ItemLayoutProcessorResult::Done); + } while (eStatus != CXFA_ItemLayoutProcessor::Result::kDone); - if (eStatus == XFA_ItemLayoutProcessorResult::Done) { + if (eStatus == CXFA_ItemLayoutProcessor::Result::kDone) { m_pLayoutPageMgr->FinishPaginatedPageSets(); m_pLayoutPageMgr->SyncLayoutData(); m_bNeedLayout = false; m_rgChangedContainers.clear(); } return 100 * - (eStatus == XFA_ItemLayoutProcessorResult::Done + (eStatus == CXFA_ItemLayoutProcessor::Result::kDone ? m_nProgressCounter : m_nProgressCounter - 1) / m_nProgressCounter;