summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_widgetdata.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-21 16:25:40 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-21 16:25:40 +0000
commitddc9965f60823a63c1d402e2f35e7ce093bf3ee8 (patch)
treea827bd50c477678c1d5d8759827bd865acfef99e /xfa/fxfa/parser/cxfa_widgetdata.cpp
parente6e262844037dfc66e5118bcedf1c84d57f78706 (diff)
downloadpdfium-ddc9965f60823a63c1d402e2f35e7ce093bf3ee8.tar.xz
Make CXFA_MarginData::Try* methods return Optional
This CL converts the CXFA_MarginData::Try{Left|Right|Top|Bottom}Inset methods to return an Optional instead of a bool with an out param. Change-Id: Ib48384c1670db7255b2b6388ced41f2f10fe4385 Reviewed-on: https://pdfium-review.googlesource.com/18890 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_widgetdata.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 98e81f3c2b..1828854500 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -373,32 +373,28 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() {
return CFX_RectF();
}
- float fLeftInset = 0;
- float fTopInset = 0;
- float fRightInset = 0;
- float fBottomInset = 0;
- bool bLeft = mgUI.TryLeftInset(fLeftInset);
- bool bTop = mgUI.TryTopInset(fTopInset);
- bool bRight = mgUI.TryRightInset(fRightInset);
- bool bBottom = mgUI.TryBottomInset(fBottomInset);
+ pdfium::Optional<float> left = mgUI.TryLeftInset();
+ pdfium::Optional<float> top = mgUI.TryTopInset();
+ pdfium::Optional<float> right = mgUI.TryRightInset();
+ pdfium::Optional<float> bottom = mgUI.TryBottomInset();
if (borderData.HasValidNode()) {
bool bVisible = false;
float fThickness = 0;
int32_t iType = 0;
std::tie(iType, bVisible, fThickness) = borderData.Get3DStyle();
- if (!bLeft || !bTop || !bRight || !bBottom) {
+ if (!left || !top || !right || !bottom) {
std::vector<CXFA_StrokeData> strokes = borderData.GetStrokes();
- if (!bTop)
- fTopInset = GetEdgeThickness(strokes, bVisible, 0);
- if (!bRight)
- fRightInset = GetEdgeThickness(strokes, bVisible, 1);
- if (!bBottom)
- fBottomInset = GetEdgeThickness(strokes, bVisible, 2);
- if (!bLeft)
- fLeftInset = GetEdgeThickness(strokes, bVisible, 3);
+ if (!top)
+ top = GetEdgeThickness(strokes, bVisible, 0);
+ if (!right)
+ right = GetEdgeThickness(strokes, bVisible, 1);
+ if (!bottom)
+ bottom = GetEdgeThickness(strokes, bVisible, 2);
+ if (!left)
+ left = GetEdgeThickness(strokes, bVisible, 3);
}
}
- return CFX_RectF(fLeftInset, fTopInset, fRightInset, fBottomInset);
+ return CFX_RectF(*left, *top, *right, *bottom);
}
XFA_ATTRIBUTEENUM CXFA_WidgetData::GetButtonHighlight() {