From 5c818b62f4b17ea18f4fc5805ba11e1936e6bc62 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 11 Jan 2018 18:29:02 +0000 Subject: Rename CXFA_Caption methods for clarity This CL renames the CXFA_Caption methods to make it clearer they can return nullptr. Change-Id: I1b4945fcd2615f16a128709b7fe07e1236a5461a Reviewed-on: https://pdfium-review.googlesource.com/22743 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/cxfa_widgetacc.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'xfa/fxfa/cxfa_widgetacc.cpp') diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 39aa378a52..d61d8989fb 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -510,7 +510,7 @@ void CXFA_WidgetAcc::CalcCaptionSize(CXFA_FFDoc* doc, CFX_SizeF& szCap) { bVert ? szCap.height = fCapReserve : szCap.width = fCapReserve; } else { float fFontSize = 10.0f; - CXFA_Font* font = caption->GetFont(); + CXFA_Font* font = caption->GetFontIfExists(); if (font) { fFontSize = font->GetFontSize(); } else { @@ -527,19 +527,20 @@ void CXFA_WidgetAcc::CalcCaptionSize(CXFA_FFDoc* doc, CFX_SizeF& szCap) { } } - CXFA_Margin* captionMargin = caption->GetMargin(); - if (captionMargin) { - float fLeftInset = captionMargin->GetLeftInset(); - float fTopInset = captionMargin->GetTopInset(); - float fRightInset = captionMargin->GetRightInset(); - float fBottomInset = captionMargin->GetBottomInset(); - if (bReserveExit) { - bVert ? (szCap.width += fLeftInset + fRightInset) - : (szCap.height += fTopInset + fBottomInset); - } else { - szCap.width += fLeftInset + fRightInset; - szCap.height += fTopInset + fBottomInset; - } + CXFA_Margin* captionMargin = caption->GetMarginIfExists(); + if (!captionMargin) + return; + + float fLeftInset = captionMargin->GetLeftInset(); + float fTopInset = captionMargin->GetTopInset(); + float fRightInset = captionMargin->GetRightInset(); + float fBottomInset = captionMargin->GetBottomInset(); + if (bReserveExit) { + bVert ? (szCap.width += fLeftInset + fRightInset) + : (szCap.height += fTopInset + fBottomInset); + } else { + szCap.width += fLeftInset + fRightInset; + szCap.height += fTopInset + fBottomInset; } } -- cgit v1.2.3