diff options
Diffstat (limited to 'xfa/fxfa/parser/cxfa_occurdata.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_occurdata.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/xfa/fxfa/parser/cxfa_occurdata.cpp b/xfa/fxfa/parser/cxfa_occurdata.cpp index 4538919d10..ffad9fdf00 100644 --- a/xfa/fxfa/parser/cxfa_occurdata.cpp +++ b/xfa/fxfa/parser/cxfa_occurdata.cpp @@ -10,7 +10,7 @@ CXFA_OccurData::CXFA_OccurData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} -int32_t CXFA_OccurData::GetMax() { +int32_t CXFA_OccurData::GetMax() const { if (!m_pNode) return 1; @@ -19,7 +19,7 @@ int32_t CXFA_OccurData::GetMax() { return max ? *max : GetMin(); } -int32_t CXFA_OccurData::GetMin() { +int32_t CXFA_OccurData::GetMin() const { if (!m_pNode) return 1; @@ -28,25 +28,21 @@ int32_t CXFA_OccurData::GetMin() { return min && *min >= 0 ? *min : 1; } -bool CXFA_OccurData::GetOccurInfo(int32_t& iMin, - int32_t& iMax, - int32_t& iInit) { - if (!m_pNode) - return false; +std::tuple<int32_t, int32_t, int32_t> CXFA_OccurData::GetOccurInfo() const { + ASSERT(m_pNode); - iMin = GetMin(); - iMax = GetMax(); + int32_t iMin = GetMin(); + int32_t iMax = GetMax(); pdfium::Optional<int32_t> init = m_pNode->JSNode()->TryInteger(XFA_Attribute::Initial, false); - iInit = init && *init >= iMin ? *init : iMin; - - return true; + return {iMin, iMax, init && *init >= iMin ? *init : iMin}; } void CXFA_OccurData::SetMax(int32_t iMax) { iMax = (iMax != -1 && iMax < 1) ? 1 : iMax; m_pNode->JSNode()->SetInteger(XFA_Attribute::Max, iMax, false); + int32_t iMin = GetMin(); if (iMax != -1 && iMax < iMin) { iMin = iMax; @@ -57,6 +53,7 @@ void CXFA_OccurData::SetMax(int32_t iMax) { void CXFA_OccurData::SetMin(int32_t iMin) { iMin = (iMin < 0) ? 1 : iMin; m_pNode->JSNode()->SetInteger(XFA_Attribute::Min, iMin, false); + int32_t iMax = GetMax(); if (iMax > 0 && iMax < iMin) { iMax = iMin; |