diff options
author | dan sinclair <dsinclair@chromium.org> | 2017-02-07 20:46:32 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-08 02:13:33 +0000 |
commit | 071d78690a4e2becffaeeb32fe210ee58ab3e532 (patch) | |
tree | 60484551e89fa689e9af6ee7008bcd8e737ea10c /xfa/fxfa/app | |
parent | bba2a7cf30da9e84bcc14ef32dbb0bb944229219 (diff) | |
download | pdfium-071d78690a4e2becffaeeb32fe210ee58ab3e532.tar.xz |
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 <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r-- | xfa/fxfa/app/cxfa_textlayout.cpp | 20 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fffield.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffpageview.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidget.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidgetacc.cpp | 118 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fwltheme.cpp | 4 |
6 files changed, 81 insertions, 77 deletions
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<CXFA_TextLayoutData*>(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; |