summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_margin.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-03 11:11:16 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-03 17:21:40 +0000
commitcbd4410908e2a4898fdd5e0d6d17591fc2c71f54 (patch)
tree85ee81736d4c8de97e117a6500fafe6ac3c726fb /xfa/fxfa/parser/cxfa_margin.cpp
parentcf3d40d10276686f972761bafd005a7715f6eb1c (diff)
downloadpdfium-cbd4410908e2a4898fdd5e0d6d17591fc2c71f54.tar.xz
Fold CXFA_MarginData into CXFA_Marginchromium/3311
This CL removes the CXFA_MarginData wrapper and moves the methods directly to CXFA_Margin. Change-Id: I7c9e979fb78d0d356605f1318489daabcb8c32cd Reviewed-on: https://pdfium-review.googlesource.com/22110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_margin.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_margin.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/xfa/fxfa/parser/cxfa_margin.cpp b/xfa/fxfa/parser/cxfa_margin.cpp
index 6a50d13e4d..6dd4d39ee4 100644
--- a/xfa/fxfa/parser/cxfa_margin.cpp
+++ b/xfa/fxfa/parser/cxfa_margin.cpp
@@ -39,3 +39,35 @@ CXFA_Margin::CXFA_Margin(CXFA_Document* doc, XFA_PacketType packet)
pdfium::MakeUnique<CJX_Margin>(this)) {}
CXFA_Margin::~CXFA_Margin() {}
+
+float CXFA_Margin::GetLeftInset() const {
+ return TryLeftInset().value_or(0);
+}
+
+float CXFA_Margin::GetTopInset() const {
+ return TryTopInset().value_or(0);
+}
+
+float CXFA_Margin::GetRightInset() const {
+ return TryRightInset().value_or(0);
+}
+
+float CXFA_Margin::GetBottomInset() const {
+ return TryBottomInset().value_or(0);
+}
+
+pdfium::Optional<float> CXFA_Margin::TryLeftInset() const {
+ return JSObject()->TryMeasureAsFloat(XFA_Attribute::LeftInset);
+}
+
+pdfium::Optional<float> CXFA_Margin::TryTopInset() const {
+ return JSObject()->TryMeasureAsFloat(XFA_Attribute::TopInset);
+}
+
+pdfium::Optional<float> CXFA_Margin::TryRightInset() const {
+ return JSObject()->TryMeasureAsFloat(XFA_Attribute::RightInset);
+}
+
+pdfium::Optional<float> CXFA_Margin::TryBottomInset() const {
+ return JSObject()->TryMeasureAsFloat(XFA_Attribute::BottomInset);
+}