From 071d78690a4e2becffaeeb32fe210ee58ab3e532 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 7 Feb 2017 20:46:32 -0500 Subject: Rename x,y to width,height for Size types This Cl fixes the naming of the size types to match their purpose. This makes the code clearer. Change-Id: I37a41ab0fe01782f4749054f1f8ab29ddf8d2790 Reviewed-on: https://pdfium-review.googlesource.com/2551 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fxfa/app/cxfa_textlayout.cpp | 20 +- xfa/fxfa/app/xfa_fffield.cpp | 4 +- xfa/fxfa/app/xfa_ffpageview.cpp | 2 +- xfa/fxfa/app/xfa_ffwidget.cpp | 10 +- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 118 +++++------ xfa/fxfa/app/xfa_fwltheme.cpp | 4 +- xfa/fxfa/parser/cxfa_containerlayoutitem.cpp | 2 +- xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 2 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 300 ++++++++++++++------------- 9 files changed, 239 insertions(+), 223 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index 0fbe8e0fe3..ad0fc057e2 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -261,7 +261,7 @@ FX_FLOAT CXFA_TextLayout::GetLayoutHeight() { m_pLoader->m_fLastPos = 0; CalcSize(szMax, szMax, szDef); m_pLoader->m_bSaveLineHeight = false; - return szDef.y; + return szDef.height; } FX_FLOAT fHeight = m_pLoader->m_fHeight; @@ -293,7 +293,7 @@ FX_FLOAT CXFA_TextLayout::StartLayout(FX_FLOAT fWidth) { m_pLoader->m_fLastPos = 0; CalcSize(szMax, szMax, szDef); m_pLoader->m_bSaveLineHeight = false; - fWidth = szDef.x; + fWidth = szDef.width; } return fWidth; } @@ -388,9 +388,9 @@ int32_t CXFA_TextLayout::CountBlocks() const { bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize, const CFX_SizeF& maxSize, CFX_SizeF& defaultSize) { - defaultSize.x = maxSize.x; - if (defaultSize.x < 1) - defaultSize.x = 0xFFFF; + defaultSize.width = maxSize.width; + if (defaultSize.width < 1) + defaultSize.width = 0xFFFF; m_pBreak.reset(CreateBreak(false)); FX_FLOAT fLinePos = 0; @@ -406,7 +406,7 @@ bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize, } bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { - if (size.x < 1) + if (size.width < 1) return false; Unload(); @@ -419,7 +419,7 @@ bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { m_iLines = 0; FX_FLOAT fLinePos = 0; Loader(size, fLinePos, true); - UpdateAlign(size.y, fLinePos); + UpdateAlign(size.height, fLinePos); m_pTabstopContext.reset(); if (fHeight) *fHeight = fLinePos; @@ -456,7 +456,7 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) { Loader(szText, fLinePos, true); if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f) - UpdateAlign(szText.y, fLinePos); + UpdateAlign(szText.height, fLinePos); } else if (m_pTextDataNode) { iBlock *= 2; if (iBlock < iCount - 2) @@ -668,7 +668,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode, const CFX_SizeF& szText, FX_FLOAT& fLinePos, bool bSavePieces) { - InitBreak(szText.x); + InitBreak(szText.width); CXFA_Para para = m_pTextProvider->GetParaNode(); FX_FLOAT fSpaceAbove = 0; @@ -746,7 +746,7 @@ bool CXFA_TextLayout::LoadRichText( pStyle = m_textParser.ComputeStyle(pXMLNode, pParentStyle.Get()); InitBreak(bContentNode ? pParentStyle.Get() : pStyle.Get(), eDisplay, - szText.x, pXMLNode, pParentStyle.Get()); + szText.width, pXMLNode, pParentStyle.Get()); if ((eDisplay == FDE_CSSDisplay::Block || eDisplay == FDE_CSSDisplay::ListItem) && pStyle && diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 0f9bb65b6f..7a2a4cd656 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -208,9 +208,9 @@ void CXFA_FFField::CapPlacement() { pCapTextLayout->CalcSize(minSize, maxSize, size); if (iCapPlacement == XFA_ATTRIBUTEENUM_Top || iCapPlacement == XFA_ATTRIBUTEENUM_Bottom) { - fCapReserve = size.y; + fCapReserve = size.height; } else { - fCapReserve = size.x; + fCapReserve = size.width; } } } diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index da31cbf3b3..7481fa61aa 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -132,7 +132,7 @@ void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt, const CFX_Rect& rtDisp, int32_t iRotate) const { CFX_SizeF sz = GetPageSize(); - GetPageMatrix(mt, CFX_RectF(0, 0, sz.x, sz.y), rtDisp, iRotate, 0); + GetPageMatrix(mt, CFX_RectF(0, 0, sz), rtDisp, iRotate, 0); } IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator( diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index d34cecc44c..8bfee69578 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -875,18 +875,22 @@ void XFA_DrawImage(CFX_Graphics* pGS, } CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); pRenderDevice->SaveState(); + CFX_PathData path; path.AppendRect(rtImage.left, rtImage.bottom(), rtImage.right(), rtImage.top); pRenderDevice->SetClip_PathFill(&path, pMatrix, FXFILL_WINDING); + CFX_Matrix mtImage(1, 0, 0, -1, 0, 1); - mtImage.Concat(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top); + mtImage.Concat( + CFX_Matrix(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top)); mtImage.Concat(*pMatrix); + CXFA_ImageRenderer imageRender; bool bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage, FXDIB_INTERPOL); - while (bRet) { + while (bRet) bRet = imageRender.Continue(nullptr); - } + pRenderDevice->RestoreState(false); } diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 704aec634d..adc5c31cc6 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -727,12 +727,12 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { ->m_pCapTextLayout.get(); if (pCapTextLayout) { if (!bVert && eUIType != XFA_Element::Button) { - szCap.x = fCapReserve; + szCap.width = fCapReserve; } CFX_SizeF minSize; pCapTextLayout->CalcSize(minSize, szCap, szCap); if (bReserveExit) { - bVert ? szCap.y = fCapReserve : szCap.x = fCapReserve; + bVert ? szCap.height = fCapReserve : szCap.width = fCapReserve; } } else { FX_FLOAT fFontSize = 10.0f; @@ -742,10 +742,10 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { fFontSize = widgetfont.GetFontSize(); } if (bVert) { - szCap.y = fCapReserve > 0 ? fCapReserve : fFontSize; + szCap.height = fCapReserve > 0 ? fCapReserve : fFontSize; } else { - szCap.x = fCapReserve > 0 ? fCapReserve : 0; - szCap.y = fFontSize; + szCap.width = fCapReserve > 0 ? fCapReserve : 0; + szCap.height = fFontSize; } } if (CXFA_Margin mgCap = caption.GetMargin()) { @@ -755,11 +755,11 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { mgCap.GetRightInset(fRightInset); mgCap.GetBottomInset(fBottomInset); if (bReserveExit) { - bVert ? (szCap.x += fLeftInset + fRightInset) - : (szCap.y += fTopInset + fBottomInset); + bVert ? (szCap.width += fLeftInset + fRightInset) + : (szCap.height += fTopInset + fBottomInset); } else { - szCap.x += fLeftInset + fRightInset; - szCap.y += fTopInset + fBottomInset; + szCap.width += fLeftInset + fRightInset; + szCap.height += fTopInset + fBottomInset; } } } @@ -767,21 +767,21 @@ bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) { CFX_SizeF szCap; CalcCaptionSize(szCap); CFX_RectF rtUIMargin = GetUIMargin(); - size.x += rtUIMargin.left + rtUIMargin.width; - size.y += rtUIMargin.top + rtUIMargin.height; - if (szCap.x > 0 && szCap.y > 0) { + size.width += rtUIMargin.left + rtUIMargin.width; + size.height += rtUIMargin.top + rtUIMargin.height; + if (szCap.width > 0 && szCap.height > 0) { int32_t iCapPlacement = GetCaption().GetPlacementType(); switch (iCapPlacement) { case XFA_ATTRIBUTEENUM_Left: case XFA_ATTRIBUTEENUM_Right: case XFA_ATTRIBUTEENUM_Inline: { - size.x += szCap.x; - size.y = std::max(size.y, szCap.y); + size.width += szCap.width; + size.height = std::max(size.height, szCap.height); } break; case XFA_ATTRIBUTEENUM_Top: case XFA_ATTRIBUTEENUM_Bottom: { - size.y += szCap.y; - size.x = std::max(size.x, szCap.x); + size.height += szCap.height; + size.width = std::max(size.width, szCap.width); } default: break; @@ -797,46 +797,47 @@ bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { mgWidget.GetTopInset(fTopInset); mgWidget.GetRightInset(fRightInset); mgWidget.GetBottomInset(fBottomInset); - size.x += fLeftInset + fRightInset; - size.y += fTopInset + fBottomInset; + size.width += fLeftInset + fRightInset; + size.height += fTopInset + fBottomInset; } CXFA_Para para = GetPara(); - if (para) { - size.x += para.GetMarginLeft(); - size.x += para.GetTextIndent(); - } - FX_FLOAT fVal = 0, fMin = 0, fMax = 0; + if (para) + size.width += para.GetMarginLeft() + para.GetTextIndent(); + + FX_FLOAT fVal = 0; + FX_FLOAT fMin = 0; + FX_FLOAT fMax = 0; if (GetWidth(fVal)) { - size.x = fVal; + size.width = fVal; } else { - if (GetMinWidth(fMin)) { - size.x = std::max(size.x, fMin); - } - if (GetMaxWidth(fMax) && fMax > 0) { - size.x = std::min(size.x, fMax); - } - } - fVal = 0, fMin = 0, fMax = 0; + if (GetMinWidth(fMin)) + size.width = std::max(size.width, fMin); + if (GetMaxWidth(fMax) && fMax > 0) + size.width = std::min(size.width, fMax); + } + fVal = 0; + fMin = 0; + fMax = 0; if (GetHeight(fVal)) { - size.y = fVal; + size.height = fVal; } else { - if (GetMinHeight(fMin)) { - size.y = std::max(size.y, fMin); - } - if (GetMaxHeight(fMax) && fMax > 0) { - size.y = std::min(size.y, fMax); - } + if (GetMinHeight(fMin)) + size.height = std::max(size.height, fMin); + if (GetMaxHeight(fMax) && fMax > 0) + size.height = std::min(size.height, fMax); } return true; } + void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { FX_FLOAT fFontSize = GetFontSize(); CFX_WideString wsText; GetValue(wsText, XFA_VALUEPICTURE_Display); if (wsText.IsEmpty()) { - size.y += fFontSize; + size.height += fFontSize; return; } + FX_WCHAR wcEnter = '\n'; FX_WCHAR wsLast = wsText.GetAt(wsText.GetLength() - 1); if (wsLast == wcEnter) { @@ -862,11 +863,11 @@ void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { size); } bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { - if (size.x > 0) { + if (size.width > 0) { CFX_SizeF szOrz = size; CFX_SizeF szCap; CalcCaptionSize(szCap); - bool bCapExit = szCap.x > 0.01 && szCap.y > 0.01; + bool bCapExit = szCap.width > 0.01 && szCap.height > 0.01; int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; if (bCapExit) { iCapPlacement = GetCaption().GetPlacementType(); @@ -874,39 +875,39 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { case XFA_ATTRIBUTEENUM_Left: case XFA_ATTRIBUTEENUM_Right: case XFA_ATTRIBUTEENUM_Inline: { - size.x -= szCap.x; + size.width -= szCap.width; } default: break; } } CFX_RectF rtUIMargin = GetUIMargin(); - size.x -= rtUIMargin.left + rtUIMargin.width; + size.width -= rtUIMargin.left + rtUIMargin.width; CXFA_Margin mgWidget = GetMargin(); if (mgWidget) { FX_FLOAT fLeftInset, fRightInset; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); - size.x -= fLeftInset + fRightInset; + size.width -= fLeftInset + fRightInset; } CalculateTextContentSize(size); - size.y += rtUIMargin.top + rtUIMargin.height; + size.height += rtUIMargin.top + rtUIMargin.height; if (bCapExit) { switch (iCapPlacement) { case XFA_ATTRIBUTEENUM_Left: case XFA_ATTRIBUTEENUM_Right: case XFA_ATTRIBUTEENUM_Inline: { - size.y = std::max(size.y, szCap.y); + size.height = std::max(size.height, szCap.height); } break; case XFA_ATTRIBUTEENUM_Top: case XFA_ATTRIBUTEENUM_Bottom: { - size.y += szCap.y; + size.height += szCap.height; } default: break; } } - size.x = szOrz.x; + size.width = szOrz.width; return CalculateWidgetAutoSize(size); } CalculateTextContentSize(size); @@ -914,7 +915,7 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { } bool CXFA_WidgetAcc::CalculateCheckButtonAutoSize(CFX_SizeF& size) { FX_FLOAT fCheckSize = GetCheckButtonSize(); - size.x = size.y = fCheckSize; + size = CFX_SizeF(fCheckSize, fCheckSize); return CalculateFieldAutoSize(size); } bool CXFA_WidgetAcc::CalculatePushButtonAutoSize(CFX_SizeF& size) { @@ -946,8 +947,7 @@ bool CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) { } else { rtFit.height = rtImage.height; } - size.x = rtFit.width; - size.y = rtFit.height; + size = rtFit.Size(); } return CalculateWidgetAutoSize(size); } @@ -976,8 +976,8 @@ bool CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) { } else { rtFit.height = rtImage.height; } - size.x = rtFit.width; - size.y = rtFit.height; + size.width = rtFit.width; + size.height = rtFit.height; } return CalculateFieldAutoSize(size); } @@ -1008,8 +1008,8 @@ bool CXFA_WidgetAcc::CalculateTextAutoSize(CFX_SizeF& size) { CXFA_TextLayout* pTextLayout = static_cast(m_pLayoutData.get())->GetTextLayout(); if (pTextLayout) { - size.x = pTextLayout->StartLayout(size.x); - size.y = pTextLayout->GetLayoutHeight(); + size.width = pTextLayout->StartLayout(size.width); + size.height = pTextLayout->GetLayoutHeight(); } return CalculateWidgetAutoSize(size); } @@ -1139,9 +1139,9 @@ void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_Element eUIType, default: break; } - fWidth = sz.x; - m_pLayoutData->m_fWidgetHeight = sz.y; - fCalcHeight = sz.y; + fWidth = sz.width; + m_pLayoutData->m_fWidgetHeight = sz.height; + fCalcHeight = sz.height; } bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { XFA_Element eUIType = GetUIType(); diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 3398c8a25c..73abaecbc8 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -215,8 +215,8 @@ CFX_SizeF CXFA_FWLTheme::GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); if (CXFA_Para para = pWidgetAcc->GetPara()) { - sizeAboveBelow.x = para.GetSpaceAbove(); - sizeAboveBelow.y = para.GetSpaceBelow(); + sizeAboveBelow.width = para.GetSpaceAbove(); + sizeAboveBelow.height = para.GetSpaceBelow(); } } return sizeAboveBelow; diff --git a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp index dd759b699a..5ef29f14cf 100644 --- a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp @@ -34,7 +34,7 @@ CFX_SizeF CXFA_ContainerLayoutItem::GetPageSize() const { pMedium->GetMeasure(XFA_ATTRIBUTE_Long).ToUnit(XFA_UNIT_Pt)); if (pMedium->GetEnum(XFA_ATTRIBUTE_Orientation) == XFA_ATTRIBUTEENUM_Landscape) { - size = CFX_SizeF(size.y, size.x); + size = CFX_SizeF(size.height, size.width); } return size; } diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index 169ed04c70..f38ef0ebfd 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -664,7 +664,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { pContentChildLayoutItem->m_pNextSibling) { if (CXFA_ContentLayoutItem* pContent = pContentChildLayoutItem->AsContentLayoutItem()) { - fUsedHeight += pContent->m_sSize.y; + fUsedHeight += pContent->m_sSize.height; } } rgUsedHeights.Add(fUsedHeight); diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index b2f6df585c..dd38c963d6 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -59,9 +59,9 @@ void UpdateWidgetSize(CXFA_ContentLayoutItem* pLayoutItem, case XFA_Element::ExclGroup: case XFA_Element::SubformSet: { if (*fWidth < -XFA_LAYOUT_FLOAT_PERCISION) - *fWidth = pLayoutItem->m_sSize.x; + *fWidth = pLayoutItem->m_sSize.width; if (*fHeight < -XFA_LAYOUT_FLOAT_PERCISION) - *fHeight = pLayoutItem->m_sSize.y; + *fHeight = pLayoutItem->m_sSize.height; break; } case XFA_Element::Draw: @@ -87,25 +87,25 @@ CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode, if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, false) && mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.x = mTmpValue.ToUnit(XFA_UNIT_Pt); + containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt); *bContainerWidthAutoSize = false; } if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && pFormNode->TryMeasure(XFA_ATTRIBUTE_H, mTmpValue, false) && mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.y = mTmpValue.ToUnit(XFA_UNIT_Pt); + containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt); *bContainerHeightAutoSize = false; } if (*bContainerWidthAutoSize && eType == XFA_Element::Subform && pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxW, mTmpValue, false) && mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.x = mTmpValue.ToUnit(XFA_UNIT_Pt); + containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt); *bContainerWidthAutoSize = false; } if (*bContainerHeightAutoSize && eType == XFA_Element::Subform && pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxH, mTmpValue, false) && mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { - containerSize.y = mTmpValue.ToUnit(XFA_UNIT_Pt); + containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt); *bContainerHeightAutoSize = false; } return containerSize; @@ -122,23 +122,23 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize( CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); CXFA_Measurement mTmpValue; if (bContainerWidthAutoSize) { - componentSize.x = fContentCalculatedWidth; + componentSize.width = fContentCalculatedWidth; if (pMarginNode) { if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_LeftInset, mTmpValue, false)) - componentSize.x += mTmpValue.ToUnit(XFA_UNIT_Pt); + componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt); if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_RightInset, mTmpValue, false)) - componentSize.x += mTmpValue.ToUnit(XFA_UNIT_Pt); + componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt); } } if (bContainerHeightAutoSize) { - componentSize.y = fContentCalculatedHeight; + componentSize.height = fContentCalculatedHeight; if (pMarginNode) { if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_TopInset, mTmpValue, false)) - componentSize.y += mTmpValue.ToUnit(XFA_UNIT_Pt); + componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt); if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_BottomInset, mTmpValue, false)) { - componentSize.y += mTmpValue.ToUnit(XFA_UNIT_Pt); + componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt); } } } @@ -173,9 +173,9 @@ void RelocateTableRowCells( FX_FLOAT fContentWidthLimit = bContainerWidthAutoSize ? FLT_MAX - : containerSize.x - fLeftInset - fRightInset; + : containerSize.width - fLeftInset - fRightInset; FX_FLOAT fContentCurrentHeight = - pLayoutRow->m_sSize.y - fTopInset - fBottomInset; + pLayoutRow->m_sSize.height - fTopInset - fBottomInset; FX_FLOAT fContentCalculatedWidth = 0; FX_FLOAT fContentCalculatedHeight = 0; FX_FLOAT fCurrentColX = 0; @@ -198,14 +198,15 @@ void RelocateTableRowCells( fColSpanWidth += rgSpecifiedColumnWidths[nCurrentColIdx + i]; if (nColSpan != nOriginalColSpan) { - fColSpanWidth = bMetWholeRowCell ? 0 : std::max(fColSpanWidth, - pLayoutChild->m_sSize.y); + fColSpanWidth = + bMetWholeRowCell ? 0 : std::max(fColSpanWidth, + pLayoutChild->m_sSize.height); } if (nOriginalColSpan == -1) bMetWholeRowCell = true; pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0); - pLayoutChild->m_sSize.x = fColSpanWidth; + pLayoutChild->m_sSize.width = fColSpanWidth; if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) continue; @@ -213,10 +214,10 @@ void RelocateTableRowCells( nCurrentColIdx += nColSpan; FX_FLOAT fNewHeight = bContainerHeightAutoSize ? -1 : fContentCurrentHeight; UpdateWidgetSize(pLayoutChild, &fColSpanWidth, &fNewHeight); - pLayoutChild->m_sSize.y = fNewHeight; + pLayoutChild->m_sSize.height = fNewHeight; if (bContainerHeightAutoSize) { fContentCalculatedHeight = - std::max(fContentCalculatedHeight, pLayoutChild->m_sSize.y); + std::max(fContentCalculatedHeight, pLayoutChild->m_sSize.height); } } @@ -225,10 +226,10 @@ void RelocateTableRowCells( (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; pLayoutChild; pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { - UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.x, + UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.width, &fContentCalculatedHeight); - FX_FLOAT fOldChildHeight = pLayoutChild->m_sSize.y; - pLayoutChild->m_sSize.y = fContentCalculatedHeight; + FX_FLOAT fOldChildHeight = pLayoutChild->m_sSize.height; + pLayoutChild->m_sSize.height = fContentCalculatedHeight; CXFA_Node* pParaNode = pLayoutChild->m_pFormNode->GetFirstChildByClass(XFA_Element::Para); if (pParaNode && pLayoutChild->m_pFirstChild) { @@ -267,7 +268,7 @@ void RelocateTableRowCells( fContentCalculatedWidth = std::max(fContentCalculatedWidth, fChildSuppliedWidth); } else { - fContentCalculatedWidth = containerSize.x - fLeftInset - fRightInset; + fContentCalculatedWidth = containerSize.width - fLeftInset - fRightInset; } if (pLayoutRow->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) == @@ -277,7 +278,8 @@ void RelocateTableRowCells( pLayoutChild; pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { pLayoutChild->m_sPos.x = fContentCalculatedWidth - - pLayoutChild->m_sPos.x - pLayoutChild->m_sSize.x; + pLayoutChild->m_sPos.x - + pLayoutChild->m_sSize.width; } } pLayoutRow->m_sSize = CalculateContainerComponentSizeFromContentSize( @@ -307,7 +309,7 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, if (!pTrailerLayoutItem) return; - FX_FLOAT fHeight = pTrailerLayoutItem->m_sSize.y; + FX_FLOAT fHeight = pTrailerLayoutItem->m_sSize.height; if (bUseInherited) { FX_FLOAT fNewSplitPos = 0; if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION) @@ -338,7 +340,8 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, if (!pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem)) { pTrailerLayoutItem->m_sPos.y = pProcessor->m_fLastRowY; pTrailerLayoutItem->m_sPos.x = pProcessor->m_fLastRowWidth; - pProcessor->m_pLayoutItem->m_sSize.x += pTrailerLayoutItem->m_sSize.x; + pProcessor->m_pLayoutItem->m_sSize.width += + pTrailerLayoutItem->m_sSize.width; pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem); return; } @@ -356,14 +359,14 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, switch (pTrailerLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { case XFA_ATTRIBUTEENUM_Right: - pTrailerLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.x - + pTrailerLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width - fRightInset - - pTrailerLayoutItem->m_sSize.x; + pTrailerLayoutItem->m_sSize.width; break; case XFA_ATTRIBUTEENUM_Center: pTrailerLayoutItem->m_sPos.x = - (pProcessor->m_pLayoutItem->m_sSize.x - fLeftInset - fRightInset - - pTrailerLayoutItem->m_sSize.x) / + (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset - + pTrailerLayoutItem->m_sSize.width) / 2; break; case XFA_ATTRIBUTEENUM_Left: @@ -371,7 +374,7 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, pTrailerLayoutItem->m_sPos.x = fLeftInset; break; } - pProcessor->m_pLayoutItem->m_sSize.y += fHeight; + pProcessor->m_pLayoutItem->m_sSize.height += fHeight; pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem); } @@ -390,7 +393,7 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); } - FX_FLOAT fHeight = pLeaderLayoutItem->m_sSize.y; + FX_FLOAT fHeight = pLeaderLayoutItem->m_sSize.height; for (CXFA_ContentLayoutItem* pChildItem = (CXFA_ContentLayoutItem*)pProcessor->m_pLayoutItem->m_pFirstChild; pChildItem; @@ -401,13 +404,14 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, switch (pLeaderLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { case XFA_ATTRIBUTEENUM_Right: - pLeaderLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.x - - fRightInset - pLeaderLayoutItem->m_sSize.x; + pLeaderLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width - + fRightInset - + pLeaderLayoutItem->m_sSize.width; break; case XFA_ATTRIBUTEENUM_Center: pLeaderLayoutItem->m_sPos.x = - (pProcessor->m_pLayoutItem->m_sSize.x - fLeftInset - fRightInset - - pLeaderLayoutItem->m_sSize.x) / + (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset - + pLeaderLayoutItem->m_sSize.width) / 2; break; case XFA_ATTRIBUTEENUM_Left: @@ -415,7 +419,7 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, pLeaderLayoutItem->m_sPos.x = fLeftInset; break; } - pProcessor->m_pLayoutItem->m_sSize.y += fHeight; + pProcessor->m_pLayoutItem->m_sSize.height += fHeight; pProcessor->m_pLayoutItem->AddChild(pLeaderLayoutItem); } @@ -450,7 +454,7 @@ FX_FLOAT InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor, if (pPendingLayoutItem) { AddLeaderAfterSplit(pProcessor, pPendingLayoutItem); if (pProcessor->m_bBreakPending) - fTotalHeight += pPendingLayoutItem->m_sSize.y; + fTotalHeight += pPendingLayoutItem->m_sSize.height; } } return fTotalHeight; @@ -681,8 +685,8 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( fRealHeight = FLT_MAX; fAvailHeight = FLT_MAX; } - if (bTakeSpace && - (childSize.x > *fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) && + if (bTakeSpace && (childSize.width > + *fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) && (fContentWidthLimit - *fContentCurRowAvailWidth > XFA_LAYOUT_FLOAT_PERCISION)) { return XFA_ItemLayoutProcessorResult::RowFullBreak; @@ -720,7 +724,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( ? pThis->IsAddNewRowForTrailer(pTrailerLayoutItem) : pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem); if (bIsAddTrailerHeight) { - childSize.y += pTrailerLayoutItem->m_sSize.y; + childSize.height += pTrailerLayoutItem->m_sSize.height; bIsAddTrailerHeight = true; } } @@ -728,7 +732,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( } if (!bTakeSpace || - *fContentCurRowY + childSize.y <= + *fContentCurRowY + childSize.height <= fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION || (!bContainerHeightAutoSize && pThis->m_fUsedSize + fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION >= @@ -736,15 +740,15 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( if (!bTakeSpace || eRetValue == XFA_ItemLayoutProcessorResult::Done) { if (pProcessor->m_bUseInheriated) { if (pTrailerLayoutItem) - AddTrailerBeforeSplit(pProcessor, childSize.y, pTrailerLayoutItem, - false); + AddTrailerBeforeSplit(pProcessor, childSize.height, + pTrailerLayoutItem, false); if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) AddPendingNode(pProcessor, pOverflowLeaderNode, false); pProcessor->m_bUseInheriated = false; } else { if (bIsAddTrailerHeight) - childSize.y -= pTrailerLayoutItem->m_sSize.y; + childSize.height -= pTrailerLayoutItem->m_sSize.height; pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, pOverflowTrailerNode, @@ -762,8 +766,9 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( rgCurLineLayoutItems[uHAlign].Add(pChildLayoutItem); *bAddedItemInRow = true; if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = + std::max(*fContentCurRowHeight, childSize.height); } return XFA_ItemLayoutProcessorResult::Done; } @@ -771,8 +776,8 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( if (eRetValue == XFA_ItemLayoutProcessorResult::PageFullBreak) { if (pProcessor->m_bUseInheriated) { if (pTrailerLayoutItem) { - AddTrailerBeforeSplit(pProcessor, childSize.y, pTrailerLayoutItem, - false); + AddTrailerBeforeSplit(pProcessor, childSize.height, + pTrailerLayoutItem, false); } if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) AddPendingNode(pProcessor, pOverflowLeaderNode, false); @@ -780,7 +785,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( pProcessor->m_bUseInheriated = false; } else { if (bIsAddTrailerHeight) - childSize.y -= pTrailerLayoutItem->m_sSize.y; + childSize.height -= pTrailerLayoutItem->m_sSize.height; pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, pOverflowTrailerNode, @@ -789,8 +794,8 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( } rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); *bAddedItemInRow = true; - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); return eRetValue; } @@ -816,8 +821,9 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); *bAddedItemInRow = true; if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = + std::max(*fContentCurRowHeight, childSize.height); } return XFA_ItemLayoutProcessorResult::PageFullBreak; } @@ -859,8 +865,9 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); *bAddedItemInRow = true; if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = + std::max(*fContentCurRowHeight, childSize.height); } } return XFA_ItemLayoutProcessorResult::PageFullBreak; @@ -868,7 +875,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( if (*fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) { childSize = pProcessor->GetCurrentComponentSize(); - if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(childSize.y)) { + if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(childSize.height)) { CXFA_Node* pTempLeaderNode = nullptr; CXFA_Node* pTempTrailerNode = nullptr; if (pThis->m_pPageMgr) { @@ -890,8 +897,8 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); *bAddedItemInRow = true; if (bTakeSpace) { - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); } if (eRetValue == XFA_ItemLayoutProcessorResult::Done) *bForceEndPage = false; @@ -939,7 +946,7 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, bool bCalculateMargin) { CXFA_Node* pFormNode = pLayoutItem->m_pFormNode; if (*fProposedSplitPos <= fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION || - *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.y - + *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.height - XFA_LAYOUT_FLOAT_PERCISION) { return false; } @@ -1062,20 +1069,20 @@ CFX_PointF CalculatePositionedContainerPos(CXFA_Node* pNode, int32_t nAbsoluteAnchorType = nNextPos[nRotate][nAnchorType]; switch (nAbsoluteAnchorType / 3) { case 1: - pos.y -= size.y / 2; + pos.y -= size.height / 2; break; case 2: - pos.y -= size.y; + pos.y -= size.height; break; default: break; } switch (nAbsoluteAnchorType % 3) { case 1: - pos.x -= size.x / 2; + pos.x -= size.width / 2; break; case 2: - pos.x -= size.x; + pos.x -= size.width; break; default: break; @@ -1184,21 +1191,21 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->m_pFormNode); } pSecondLayoutItem->m_sPos.x = pLayoutItem->m_sPos.x; - pSecondLayoutItem->m_sSize.x = pLayoutItem->m_sSize.x; + pSecondLayoutItem->m_sSize.width = pLayoutItem->m_sSize.width; pSecondLayoutItem->m_sPos.y = 0; - pSecondLayoutItem->m_sSize.y = pLayoutItem->m_sSize.y - fSplitPos; - pLayoutItem->m_sSize.y -= pSecondLayoutItem->m_sSize.y; + pSecondLayoutItem->m_sSize.height = pLayoutItem->m_sSize.height - fSplitPos; + pLayoutItem->m_sSize.height -= pSecondLayoutItem->m_sSize.height; if (pLayoutItem->m_pFirstChild) - pSecondLayoutItem->m_sSize.y += fCurTopMargin; + pSecondLayoutItem->m_sSize.height += fCurTopMargin; if (pSecondParent) { pSecondParent->AddChild(pSecondLayoutItem); if (fCurTopMargin > 0 && pLayoutItem->m_pFirstChild) { - pSecondParent->m_sSize.y += fCurTopMargin; + pSecondParent->m_sSize.height += fCurTopMargin; CXFA_ContentLayoutItem* pParentItem = (CXFA_ContentLayoutItem*)pSecondParent->m_pParent; while (pParentItem) { - pParentItem->m_sSize.y += fCurTopMargin; + pParentItem->m_sSize.height += fCurTopMargin; pParentItem = (CXFA_ContentLayoutItem*)pParentItem->m_pParent; } } @@ -1236,12 +1243,12 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( if (pPreItem->m_sPos.y < 0) pPreItem->m_sPos.y = 0; - if (pPreItem->m_sPos.y + pPreItem->m_sSize.y > lHeightForKeep) { + if (pPreItem->m_sPos.y + pPreItem->m_sSize.height > lHeightForKeep) { pPreItem->m_sPos.y = lHeightForKeep; - lHeightForKeep += pPreItem->m_sSize.y; - pSecondLayoutItem->m_sSize.y += pPreItem->m_sSize.y; + lHeightForKeep += pPreItem->m_sSize.height; + pSecondLayoutItem->m_sSize.height += pPreItem->m_sSize.height; if (pSecondParent) - pSecondParent->m_sSize.y += pPreItem->m_sSize.y; + pSecondParent->m_sSize.height += pPreItem->m_sSize.height; } pSecondLayoutItem->AddChild(pPreItem); } @@ -1256,7 +1263,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( if (fSplitPos + XFA_LAYOUT_FLOAT_PERCISION >= fCurTopMargin + fCurBottomMargin + pChildItem->m_sPos.y + - pChildItem->m_sSize.y) { + pChildItem->m_sSize.height) { pLayoutItem->AddChild(pChildItem); if (ExistContainerKeep(pChildItem->m_pFormNode, false)) keepLayoutItems.Add(pChildItem); @@ -1266,11 +1273,11 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( continue; } - FX_FLOAT fOldHeight = pSecondLayoutItem->m_sSize.y; + FX_FLOAT fOldHeight = pSecondLayoutItem->m_sSize.height; SplitLayoutItem( pChildItem, pSecondLayoutItem, fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y); - fAddMarginHeight = pSecondLayoutItem->m_sSize.y - fOldHeight; + fAddMarginHeight = pSecondLayoutItem->m_sSize.height - fOldHeight; pLayoutItem->AddChild(pChildItem); } } @@ -1671,7 +1678,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( pProcessor->SetCurrentComponentPos(absolutePos); if (bContainerWidthAutoSize) { - FX_FLOAT fChildSuppliedWidth = absolutePos.x + size.x; + FX_FLOAT fChildSuppliedWidth = absolutePos.x + size.width; if (bChangeParentSize) { fContentCalculatedWidth = std::max(fContentCalculatedWidth, fChildSuppliedWidth); @@ -1684,7 +1691,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( } if (bContainerHeightAutoSize) { - FX_FLOAT fChildSuppliedHeight = absolutePos.y + size.y; + FX_FLOAT fChildSuppliedHeight = absolutePos.y + size.height; if (bChangeParentSize) { fContentCalculatedHeight = std::max(fContentCalculatedHeight, fChildSuppliedHeight); @@ -1738,7 +1745,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { FX_FLOAT fContentWidthLimit = bContainerWidthAutoSize ? FLT_MAX - : containerSize.x - fLeftInset - fRightInset; + : containerSize.width - fLeftInset - fRightInset; CFX_WideStringC wsColumnWidths; if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { auto widths = SeparateStringW(wsColumnWidths.c_str(), @@ -1806,7 +1813,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { int32_t iColSpan = pRowLayoutCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); rgRowItemsSpan.Add(iColSpan); - rgRowItemsWidth.Add(pRowLayoutCell->m_sSize.x); + rgRowItemsWidth.Add(pRowLayoutCell->m_sSize.width); } } @@ -1831,7 +1838,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { pNewCell ? pNewCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan) : 0; - rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.x : 0; + rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.width : 0; } CXFA_ContentLayoutItem* pCell = rgRowItems[i]; if (!pCell) @@ -1895,10 +1902,11 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { switch (pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) { case XFA_ATTRIBUTEENUM_Center: pLayoutChild->m_sPos.x = - (fContentWidthLimit - pLayoutChild->m_sSize.x) / 2; + (fContentWidthLimit - pLayoutChild->m_sSize.width) / 2; break; case XFA_ATTRIBUTEENUM_Right: - pLayoutChild->m_sPos.x = fContentWidthLimit - pLayoutChild->m_sSize.x; + pLayoutChild->m_sPos.x = + fContentWidthLimit - pLayoutChild->m_sSize.width; break; case XFA_ATTRIBUTEENUM_Left: default: @@ -1909,7 +1917,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { if (bContainerWidthAutoSize) { FX_FLOAT fChildSuppliedWidth = - pLayoutChild->m_sPos.x + pLayoutChild->m_sSize.x; + pLayoutChild->m_sPos.x + pLayoutChild->m_sSize.width; if (fContentWidthLimit < FLT_MAX && fContentWidthLimit > fChildSuppliedWidth) { fChildSuppliedWidth = fContentWidthLimit; @@ -1917,7 +1925,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { fContentCalculatedWidth = std::max(fContentCalculatedWidth, fChildSuppliedWidth); } - fCurrentRowY += pLayoutChild->m_sSize.y; + fCurrentRowY += pLayoutChild->m_sSize.height; } if (bContainerHeightAutoSize) @@ -1934,7 +1942,7 @@ bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer( if (!pTrailerItem) return false; - FX_FLOAT fWidth = pTrailerItem->m_sSize.x; + FX_FLOAT fWidth = pTrailerItem->m_sSize.width; XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); return eLayout == XFA_ATTRIBUTEENUM_Tb || m_fWidthLimite <= fWidth; } @@ -1952,7 +1960,7 @@ FX_FLOAT CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() { for (auto iter = m_arrayKeepItems.rbegin(); iter != m_arrayKeepItems.rend(); iter++) { AddLeaderAfterSplit(this, *iter); - fTotalHeight += (*iter)->m_sSize.y; + fTotalHeight += (*iter)->m_sSize.height; } m_arrayKeepItems.clear(); @@ -1984,12 +1992,12 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit( CFX_SizeF childSize = pChildProcessor->GetCurrentComponentSize(); std::vector keepLayoutItems; if (pParentProcessor->JudgePutNextPage(pParentProcessor->m_pLayoutItem, - childSize.y, &keepLayoutItems)) { + childSize.height, &keepLayoutItems)) { m_arrayKeepItems.clear(); for (auto item : keepLayoutItems) { pParentProcessor->m_pLayoutItem->RemoveChild(item); - *fContentCurRowY -= item->m_sSize.y; + *fContentCurRowY -= item->m_sSize.height; m_arrayKeepItems.push_back(item); } *bAddedItemInRow = true; @@ -2000,8 +2008,8 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit( rgCurLineLayoutItem->Add(pChildProcessor->ExtractLayoutItem()); *bAddedItemInRow = true; - *fContentCurRowAvailWidth -= childSize.x; - *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.y); + *fContentCurRowAvailWidth -= childSize.width; + *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height); *result = eRetValue; return true; @@ -2022,7 +2030,7 @@ bool CXFA_ItemLayoutProcessor::JudgePutNextPage( (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) { if (ExistContainerKeep(pChildLayoutItem->m_pFormNode, false)) { pKeepItems->push_back(pChildLayoutItem); - fItemsHeight += pChildLayoutItem->m_sSize.y; + fItemsHeight += pChildLayoutItem->m_sSize.height; } else { pKeepItems->clear(); fItemsHeight = 0; @@ -2095,10 +2103,10 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize); if (pContext && pContext->m_bCurColumnWidthAvaiable) { bContainerWidthAutoSize = false; - containerSize.x = pContext->m_fCurColumnWidth; + containerSize.width = pContext->m_fCurColumnWidth; } if (!bContainerHeightAutoSize) - containerSize.y -= m_fUsedSize; + containerSize.height -= m_fUsedSize; if (!bContainerHeightAutoSize) { CXFA_Node* pParentNode = m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent); @@ -2110,7 +2118,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (pChildContainer && pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, XFA_ObjectType::ContainerNode)) { - containerSize.y = 0; + containerSize.height = 0; bContainerHeightAutoSize = true; } } @@ -2118,7 +2126,10 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( CXFA_Node* pMarginNode = m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); - FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; + FX_FLOAT fLeftInset = 0; + FX_FLOAT fTopInset = 0; + FX_FLOAT fRightInset = 0; + FX_FLOAT fBottomInset = 0; if (pMarginNode) { fLeftInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); @@ -2131,7 +2142,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } FX_FLOAT fContentWidthLimit = bContainerWidthAutoSize ? FLT_MAX - : containerSize.x - fLeftInset - fRightInset; + : containerSize.width - fLeftInset - fRightInset; FX_FLOAT fContentCalculatedWidth = 0; FX_FLOAT fContentCalculatedHeight = 0; FX_FLOAT fAvailHeight = fHeightLimit - fTopInset - fBottomInset; @@ -2160,12 +2171,12 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutTempChild->m_pFormNode)) continue; - fContentCalculatedWidth = - std::max(fContentCalculatedWidth, - pLayoutTempChild->m_sPos.x + pLayoutTempChild->m_sSize.x); - fContentCalculatedHeight = - std::max(fContentCalculatedHeight, - pLayoutTempChild->m_sPos.y + pLayoutTempChild->m_sSize.y); + fContentCalculatedWidth = std::max( + fContentCalculatedWidth, + pLayoutTempChild->m_sPos.x + pLayoutTempChild->m_sSize.width); + fContentCalculatedHeight = std::max( + fContentCalculatedHeight, + pLayoutTempChild->m_sPos.y + pLayoutTempChild->m_sSize.height); } if (pLayoutChild) @@ -2216,9 +2227,9 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( uCurHAlignState = uHAlign; } if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutNext->m_pFormNode)) { - if (pLayoutNext->m_sSize.y > fContentCurRowHeight) - fContentCurRowHeight = pLayoutNext->m_sSize.y; - fContentCurRowAvailWidth -= pLayoutNext->m_sSize.x; + if (pLayoutNext->m_sSize.height > fContentCurRowHeight) + fContentCurRowHeight = pLayoutNext->m_sSize.height; + fContentCurRowAvailWidth -= pLayoutNext->m_sSize.width; } } @@ -2262,7 +2273,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( case XFA_ItemLayoutProcessorStages::BreakBefore: { for (auto item : m_arrayKeepItems) { m_pLayoutItem->RemoveChild(item); - fContentCalculatedHeight -= item->m_sSize.y; + fContentCalculatedHeight -= item->m_sSize.height; } CXFA_Node* pLeaderNode = nullptr; @@ -2291,7 +2302,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( nullptr); InsertFlowedItem( this, pTempProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.y, eFlowStrategy, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX, fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, &fContentCurRowHeight, @@ -2319,13 +2330,13 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { auto pTempProcessor = pdfium::MakeUnique( pTrailerNode, nullptr); - InsertFlowedItem(this, pTempProcessor.get(), - bContainerWidthAutoSize, bContainerHeightAutoSize, - containerSize.y, eFlowStrategy, &uCurHAlignState, - rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX, - fContentWidthLimit, &fContentCurRowY, - &fContentCurRowAvailWidth, &fContentCurRowHeight, - &bAddedItemInRow, &bForceEndPage, pContext, false); + InsertFlowedItem( + this, pTempProcessor.get(), bContainerWidthAutoSize, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, + &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX, + fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, + &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage, + pContext, false); } if (!bCreatePage) { if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { @@ -2340,7 +2351,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( nullptr); InsertFlowedItem( this, pTempProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.y, eFlowStrategy, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX, fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, &fContentCurRowHeight, @@ -2376,12 +2387,13 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (pProcessor) { if (InsertFlowedItem( this, pProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.y, eFlowStrategy, - &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, - fAvailHeight, fRealHeight, fContentWidthLimit, - &fContentCurRowY, &fContentCurRowAvailWidth, - &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage, - pContext, false) != XFA_ItemLayoutProcessorResult::Done) { + bContainerHeightAutoSize, containerSize.height, + eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, + bUseBreakControl, fAvailHeight, fRealHeight, + fContentWidthLimit, &fContentCurRowY, + &fContentCurRowAvailWidth, &fContentCurRowHeight, + &bAddedItemInRow, &bForceEndPage, pContext, + false) != XFA_ItemLayoutProcessorResult::Done) { goto SuspendAndCreateNewRow; } else { pProcessor.reset(); @@ -2403,12 +2415,13 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( if (pProcessor) { if (InsertFlowedItem( this, pProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.y, eFlowStrategy, - &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, - fAvailHeight, fRealHeight, fContentWidthLimit, - &fContentCurRowY, &fContentCurRowAvailWidth, - &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage, - pContext, false) != XFA_ItemLayoutProcessorResult::Done) { + bContainerHeightAutoSize, containerSize.height, + eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, + bUseBreakControl, fAvailHeight, fRealHeight, + fContentWidthLimit, &fContentCurRowY, + &fContentCurRowAvailWidth, &fContentCurRowHeight, + &bAddedItemInRow, &bForceEndPage, pContext, + false) != XFA_ItemLayoutProcessorResult::Done) { goto SuspendAndCreateNewRow; } else { pProcessor.reset(); @@ -2441,7 +2454,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( InsertPendingItems(pProcessor.get(), m_pCurChildNode); XFA_ItemLayoutProcessorResult rs = InsertFlowedItem( this, pProcessor.get(), bContainerWidthAutoSize, - bContainerHeightAutoSize, containerSize.y, eFlowStrategy, + bContainerHeightAutoSize, containerSize.height, eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, fAvailHeight, fRealHeight, fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth, &fContentCurRowHeight, @@ -2498,17 +2511,17 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, bContainerHeightAutoSize, fContentCalculatedHeight, containerSize); - if (containerSize.y >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || + if (containerSize.height >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || bRetValue) { if (!m_pLayoutItem) m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); - containerSize.y = std::max(containerSize.y, 0.f); + containerSize.height = std::max(containerSize.height, 0.f); SetCurrentComponentSize(containerSize); if (bForceEndPage) m_fUsedSize = 0; else - m_fUsedSize += m_pLayoutItem->m_sSize.y; + m_fUsedSize += m_pLayoutItem->m_sSize.height; } return bRetValue @@ -2537,7 +2550,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( nTotalLength++; if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[i][j]->m_pFormNode)) { - fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.x; + fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.width; } } } @@ -2566,7 +2579,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( CFX_PointF(fCurPos, *fContentCurRowY); if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[0][j]->m_pFormNode)) { - fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.x; + fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.width; } } m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]); @@ -2585,7 +2598,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( CFX_PointF(fCurPos, *fContentCurRowY); if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[1][j]->m_pFormNode)) { - fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.x; + fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.width; } } m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]); @@ -2602,7 +2615,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( CFX_PointF(fCurPos, *fContentCurRowY); if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[2][j]->m_pFormNode)) { - fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.x; + fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.width; } } m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]); @@ -2614,7 +2627,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[0][j]->m_pFormNode)) { - fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.x; + fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.width; } rgCurLineLayoutItems[0][j]->m_sPos = CFX_PointF(fCurPos, *fContentCurRowY); @@ -2627,7 +2640,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) { if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[1][j]->m_pFormNode)) { - fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.x; + fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.width; } rgCurLineLayoutItems[1][j]->m_sPos = CFX_PointF(fCurPos, *fContentCurRowY); @@ -2638,7 +2651,7 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) { if (XFA_ItemLayoutProcessor_IsTakingSpace( rgCurLineLayoutItems[2][j]->m_pFormNode)) { - fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.x; + fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.width; } rgCurLineLayoutItems[2][j]->m_sPos = CFX_PointF(fCurPos, *fContentCurRowY); @@ -2689,13 +2702,13 @@ void CXFA_ItemLayoutProcessor::DoLayoutField() { CXFA_Document* pDocument = m_pFormNode->GetDocument(); CXFA_FFNotify* pNotify = pDocument->GetNotify(); CFX_SizeF size(-1, -1); - pNotify->StartFieldDrawLayout(m_pFormNode, size.x, size.y); + pNotify->StartFieldDrawLayout(m_pFormNode, size.width, size.height); int32_t nRotate = FXSYS_round(m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue()); nRotate = XFA_MapRotation(nRotate); if (nRotate == 90 || nRotate == 270) - std::swap(size.x, size.y); + std::swap(size.width, size.height); SetCurrentComponentSize(size); } @@ -2746,8 +2759,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( } CFX_SizeF CXFA_ItemLayoutProcessor::GetCurrentComponentSize() { - ASSERT(m_pLayoutItem); - return CFX_SizeF(m_pLayoutItem->m_sSize.x, m_pLayoutItem->m_sSize.y); + return CFX_SizeF(m_pLayoutItem->m_sSize.width, m_pLayoutItem->m_sSize.height); } void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(const CFX_PointF& pos) { -- cgit v1.2.3