diff options
author | Jun Fang <jun_fang@foxitsoftware.com> | 2016-02-23 09:17:30 +0800 |
---|---|---|
committer | Jun Fang <jun_fang@foxitsoftware.com> | 2016-02-23 09:17:30 +0800 |
commit | 6add19c6e183363f543585ce316b54ee9f50592a (patch) | |
tree | 554e4d8ab3bedacfdb669af3463b8783c1c828e4 /xfa | |
parent | db6d0600d59654f6e4a55a9e8933157ce03af10a (diff) | |
download | pdfium-6add19c6e183363f543585ce316b54ee9f50592a.tar.xz |
Fix a crasher in CXFA_LayoutPageMgr::GetAvailHeight()
BUG=pdfium:407
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1717243002 .
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp index 832e1ba5d1..4030326964 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp @@ -251,19 +251,19 @@ void CXFA_LayoutPageMgr::SubmitContentItem( } } FX_FLOAT CXFA_LayoutPageMgr::GetAvailHeight() { + CXFA_ContainerLayoutItem* pLayoutItem = + GetCurrentContainerRecord()->pCurContentArea; + if (!pLayoutItem || !pLayoutItem->m_pFormNode) + return 0.0f; FX_FLOAT fAvailHeight = - GetCurrentContainerRecord() - ->pCurContentArea->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_H) - .ToUnit(XFA_UNIT_Pt); - if (fAvailHeight < XFA_LAYOUT_FLOAT_PERCISION) { - if (m_pCurrentContainerRecord == - m_rgProposedContainerRecord.GetHeadPosition()) { - fAvailHeight = 0; - } else { - fAvailHeight = XFA_LAYOUT_FLOAT_MAX; - } - } - return fAvailHeight; + pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt); + if (fAvailHeight >= XFA_LAYOUT_FLOAT_PERCISION) + return fAvailHeight; + if (m_pCurrentContainerRecord == + m_rgProposedContainerRecord.GetHeadPosition()) { + return 0.0f; + } + return XFA_LAYOUT_FLOAT_MAX; } static CXFA_Node* XFA_ResolveBreakTarget(CXFA_Node* pPageSetRoot, FX_BOOL bNewExprStyle, |