From e6e262844037dfc66e5118bcedf1c84d57f78706 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 21 Nov 2017 16:25:01 +0000 Subject: Add CXFA_MarginData::Get*Inset helpers This CL adds Get*Inset helpers to CXFA_MarginData which just return a default value of 0 if the Try*Inset method fails. Change-Id: I03b00b7a371c39e521f95952e965b4a3ef71d517 Reviewed-on: https://pdfium-review.googlesource.com/18870 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_margindata.cpp | 24 ++++++++++++++++++++++++ xfa/fxfa/parser/cxfa_margindata.h | 5 +++++ 2 files changed, 29 insertions(+) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cxfa_margindata.cpp b/xfa/fxfa/parser/cxfa_margindata.cpp index 2c5689cfa0..4eedaeb7e7 100644 --- a/xfa/fxfa/parser/cxfa_margindata.cpp +++ b/xfa/fxfa/parser/cxfa_margindata.cpp @@ -8,6 +8,30 @@ CXFA_MarginData::CXFA_MarginData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} +float CXFA_MarginData::GetLeftInset() const { + float left = 0; + TryLeftInset(left); + return left; +} + +float CXFA_MarginData::GetTopInset() const { + float top = 0; + TryTopInset(top); + return top; +} + +float CXFA_MarginData::GetRightInset() const { + float right = 0; + TryRightInset(right); + return right; +} + +float CXFA_MarginData::GetBottomInset() const { + float bottom = 0; + TryBottomInset(bottom); + return bottom; +} + bool CXFA_MarginData::TryLeftInset(float& fInset) const { return TryMeasure(XFA_Attribute::LeftInset, fInset); } diff --git a/xfa/fxfa/parser/cxfa_margindata.h b/xfa/fxfa/parser/cxfa_margindata.h index 6933c3d078..1a8b4d8be1 100644 --- a/xfa/fxfa/parser/cxfa_margindata.h +++ b/xfa/fxfa/parser/cxfa_margindata.h @@ -16,6 +16,11 @@ class CXFA_MarginData : public CXFA_DataData { public: explicit CXFA_MarginData(CXFA_Node* pNode); + float GetLeftInset() const; + float GetTopInset() const; + float GetRightInset() const; + float GetBottomInset() const; + bool TryLeftInset(float& fInset) const; bool TryTopInset(float& fInset) const; bool TryRightInset(float& fInset) const; -- cgit v1.2.3