summaryrefslogtreecommitdiff
path: root/fxjs/xfa/cjx_object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/xfa/cjx_object.cpp')
-rw-r--r--fxjs/xfa/cjx_object.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 304b861dcf..b1e3030020 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -431,6 +431,14 @@ pdfium::Optional<CXFA_Measurement> CJX_Object::TryMeasure(
return ToNode(GetXFAObject())->GetDefaultMeasurement(eAttr);
}
+pdfium::Optional<float> CJX_Object::TryMeasureAsFloat(
+ XFA_Attribute attr) const {
+ pdfium::Optional<CXFA_Measurement> measure = TryMeasure(attr, false);
+ if (measure)
+ return {measure->ToUnit(XFA_Unit::Pt)};
+ return {};
+}
+
CXFA_Measurement CJX_Object::GetMeasure(XFA_Attribute eAttr) const {
return TryMeasure(eAttr, true).value_or(CXFA_Measurement());
}