summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_ffwidgetacc.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-02-07 20:46:32 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-08 02:13:33 +0000
commit071d78690a4e2becffaeeb32fe210ee58ab3e532 (patch)
tree60484551e89fa689e9af6ee7008bcd8e737ea10c /xfa/fxfa/app/xfa_ffwidgetacc.cpp
parentbba2a7cf30da9e84bcc14ef32dbb0bb944229219 (diff)
downloadpdfium-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/xfa_ffwidgetacc.cpp')
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp118
1 files changed, 59 insertions, 59 deletions
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();