summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-07-16 21:52:56 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-16 21:52:56 +0000
commitf9d49da715deeb0efa6eaaf8ac43727ae28f8749 (patch)
treeb03ec7b1168c04a3f75aa92ae2689626df3b1386 /xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
parent98b356a36bc9291a4f222d092afeeea0d5b5f379 (diff)
downloadpdfium-f9d49da715deeb0efa6eaaf8ac43727ae28f8749.tar.xz
Use UnownedPtr/Optional in cfxa_layoutcontext.cpp
Introduce cfxa_layoutcontext.cpp to satisfy chromium style ctor check. Fix typo in class forward declaration in cfxa_layoutcontext.h Change-Id: I2b29bf61a21be0f895faf8984897c5655a4f0e89 Reviewed-on: https://pdfium-review.googlesource.com/37950 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index 2dfa956ee0..2ff9acd25a 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -1143,18 +1143,17 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer(
if (iColSpan <= pdfium::CollectionSize<int32_t>(
*pContext->m_prgSpecifiedColumnWidths) -
iColIndex) {
- pContext->m_fCurColumnWidth = 0;
- pContext->m_bCurColumnWidthAvaiable = true;
+ pContext->m_fCurColumnWidth = 0.0f;
if (iColSpan == -1) {
iColSpan = pdfium::CollectionSize<int32_t>(
*pContext->m_prgSpecifiedColumnWidths);
}
for (int32_t i = 0; iColIndex + i < iColSpan; ++i) {
- pContext->m_fCurColumnWidth +=
+ pContext->m_fCurColumnWidth.value() +=
(*pContext->m_prgSpecifiedColumnWidths)[iColIndex + i];
}
- if (pContext->m_fCurColumnWidth == 0)
- pContext->m_bCurColumnWidthAvaiable = false;
+ if (pContext->m_fCurColumnWidth.value() == 0)
+ pContext->m_fCurColumnWidth.reset();
iColIndex += iColSpan >= 0 ? iColSpan : 0;
}
@@ -1273,8 +1272,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
for (; m_pCurChildNode; GotoNextContainerNode(
m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(), false)) {
- layoutContext.m_bCurColumnWidthAvaiable = false;
- layoutContext.m_fCurColumnWidth = 0;
+ layoutContext.m_fCurColumnWidth.reset();
if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
continue;
@@ -1605,9 +1603,9 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
GetFormNode(), &bContainerWidthAutoSize, &bContainerHeightAutoSize);
- if (pContext && pContext->m_bCurColumnWidthAvaiable) {
+ if (pContext && pContext->m_fCurColumnWidth.has_value()) {
+ containerSize.width = pContext->m_fCurColumnWidth.value();
bContainerWidthAutoSize = false;
- containerSize.width = pContext->m_fCurColumnWidth;
}
if (!bContainerHeightAutoSize)
containerSize.height -= m_fUsedSize;
@@ -2556,7 +2554,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::InsertFlowedItem(
pProcessor->GetFormNode()->GetIntact() == XFA_AttributeEnum::None) {
pFormNode = m_pPageMgr->QueryOverflow(pProcessor->GetFormNode());
if (!pFormNode && pLayoutContext && pLayoutContext->m_pOverflowProcessor) {
- pFormNode = pLayoutContext->m_pOverflowNode;
+ pFormNode = pLayoutContext->m_pOverflowNode.Get();
bUseInherited = true;
}
if (m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode,