From 120c19b6a19377c341658c342c4351eccbb59741 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 20 Nov 2017 22:23:50 +0000 Subject: Rename CXFA_MarginData methods This CL renames the CXFA_MarginData::Get*Inset methods to CXFA_MarginData::Try*Inset to match the fact that they may fail. The default value has been removed and all the callers correctly set the default values. Change-Id: Ib0dc8dc35807b60a0ddc0e5724604cb39845fcea Reviewed-on: https://pdfium-review.googlesource.com/18771 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_margindata.cpp | 12 ++++-------- xfa/fxfa/parser/cxfa_margindata.h | 8 ++++---- xfa/fxfa/parser/cxfa_widgetdata.cpp | 13 ++++++++----- 3 files changed, 16 insertions(+), 17 deletions(-) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cxfa_margindata.cpp b/xfa/fxfa/parser/cxfa_margindata.cpp index 08cc9fd844..2c5689cfa0 100644 --- a/xfa/fxfa/parser/cxfa_margindata.cpp +++ b/xfa/fxfa/parser/cxfa_margindata.cpp @@ -8,22 +8,18 @@ CXFA_MarginData::CXFA_MarginData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} -bool CXFA_MarginData::GetLeftInset(float& fInset, float fDefInset) const { - fInset = fDefInset; +bool CXFA_MarginData::TryLeftInset(float& fInset) const { return TryMeasure(XFA_Attribute::LeftInset, fInset); } -bool CXFA_MarginData::GetTopInset(float& fInset, float fDefInset) const { - fInset = fDefInset; +bool CXFA_MarginData::TryTopInset(float& fInset) const { return TryMeasure(XFA_Attribute::TopInset, fInset); } -bool CXFA_MarginData::GetRightInset(float& fInset, float fDefInset) const { - fInset = fDefInset; +bool CXFA_MarginData::TryRightInset(float& fInset) const { return TryMeasure(XFA_Attribute::RightInset, fInset); } -bool CXFA_MarginData::GetBottomInset(float& fInset, float fDefInset) const { - fInset = fDefInset; +bool CXFA_MarginData::TryBottomInset(float& fInset) const { return TryMeasure(XFA_Attribute::BottomInset, fInset); } diff --git a/xfa/fxfa/parser/cxfa_margindata.h b/xfa/fxfa/parser/cxfa_margindata.h index 5695fcc5f5..6933c3d078 100644 --- a/xfa/fxfa/parser/cxfa_margindata.h +++ b/xfa/fxfa/parser/cxfa_margindata.h @@ -16,10 +16,10 @@ class CXFA_MarginData : public CXFA_DataData { public: explicit CXFA_MarginData(CXFA_Node* pNode); - bool GetLeftInset(float& fInset, float fDefInset = 0) const; - bool GetTopInset(float& fInset, float fDefInset = 0) const; - bool GetRightInset(float& fInset, float fDefInset = 0) const; - bool GetBottomInset(float& fInset, float fDefInset = 0) const; + bool TryLeftInset(float& fInset) const; + bool TryTopInset(float& fInset) const; + bool TryRightInset(float& fInset) const; + bool TryBottomInset(float& fInset) const; }; #endif // XFA_FXFA_PARSER_CXFA_MARGINDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index b5ceb4a4d4..98e81f3c2b 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -373,11 +373,14 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() { return CFX_RectF(); } - float fLeftInset, fTopInset, fRightInset, fBottomInset; - bool bLeft = mgUI.GetLeftInset(fLeftInset); - bool bTop = mgUI.GetTopInset(fTopInset); - bool bRight = mgUI.GetRightInset(fRightInset); - bool bBottom = mgUI.GetBottomInset(fBottomInset); + 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); if (borderData.HasValidNode()) { bool bVisible = false; float fThickness = 0; -- cgit v1.2.3