summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_widgetdata.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-21 16:32:30 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-21 16:32:30 +0000
commit0d54f09ae49c0cf85de5fe2bd3da885c16523018 (patch)
treea94e3738194f4ba944229a6eef55218c3b35df80 /xfa/fxfa/parser/cxfa_widgetdata.cpp
parent4debddffd0c4cad48ecf153e2584b311b0a16791 (diff)
downloadpdfium-0d54f09ae49c0cf85de5fe2bd3da885c16523018.tar.xz
Convert CXFA_WidgetData methods to Optional
This CL converts the CXFA_WidgetData size methods to return Optionals instead of boolean with an out parameter. Change-Id: Ibf2fef5a58896abfea9865e086029377c051bdb6 Reviewed-on: https://pdfium-review.googlesource.com/18892 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.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 72c2d7fd34..3938884d0d 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -327,28 +327,46 @@ CXFA_BindData CXFA_WidgetData::GetBindData() {
m_pNode->JSNode()->GetProperty(0, XFA_Element::Bind, false));
}
-bool CXFA_WidgetData::TryWidth(float& fWidth) {
- return TryMeasure(XFA_Attribute::W, fWidth);
+pdfium::Optional<float> CXFA_WidgetData::TryWidth() {
+ float width = 0;
+ if (TryMeasure(XFA_Attribute::W, width))
+ return {width};
+ return {};
}
-bool CXFA_WidgetData::TryHeight(float& fHeight) {
- return TryMeasure(XFA_Attribute::H, fHeight);
+pdfium::Optional<float> CXFA_WidgetData::TryHeight() {
+ float height = 0;
+ if (TryMeasure(XFA_Attribute::H, height))
+ return {height};
+ return {};
}
-bool CXFA_WidgetData::TryMinWidth(float& fMinWidth) {
- return TryMeasure(XFA_Attribute::MinW, fMinWidth);
+pdfium::Optional<float> CXFA_WidgetData::TryMinWidth() {
+ float minWidth = 0;
+ if (TryMeasure(XFA_Attribute::MinW, minWidth))
+ return {minWidth};
+ return {};
}
-bool CXFA_WidgetData::TryMinHeight(float& fMinHeight) {
- return TryMeasure(XFA_Attribute::MinH, fMinHeight);
+pdfium::Optional<float> CXFA_WidgetData::TryMinHeight() {
+ float minHeight = 0;
+ if (TryMeasure(XFA_Attribute::MinH, minHeight))
+ return {minHeight};
+ return {};
}
-bool CXFA_WidgetData::TryMaxWidth(float& fMaxWidth) {
- return TryMeasure(XFA_Attribute::MaxW, fMaxWidth);
+pdfium::Optional<float> CXFA_WidgetData::TryMaxWidth() {
+ float maxWidth = 0;
+ if (TryMeasure(XFA_Attribute::MaxW, maxWidth))
+ return {maxWidth};
+ return {};
}
-bool CXFA_WidgetData::TryMaxHeight(float& fMaxHeight) {
- return TryMeasure(XFA_Attribute::MaxH, fMaxHeight);
+pdfium::Optional<float> CXFA_WidgetData::TryMaxHeight() {
+ float maxHeight = 0;
+ if (TryMeasure(XFA_Attribute::MaxH, maxHeight))
+ return {maxHeight};
+ return {};
}
CXFA_BorderData CXFA_WidgetData::GetUIBorderData() {