From 78d841011655b868486a45e0fe865a972742aa0c Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 10 Jan 2018 19:44:26 +0000 Subject: Rename GetMargin to GetMarginIfExists This CL makes it explicit that GetMargin may return a nullptr. Change-Id: I46780e8df9e966accc38baf56f8aa5149533db87 Reviewed-on: https://pdfium-review.googlesource.com/22675 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/cxfa_ffarc.cpp | 2 +- xfa/fxfa/cxfa_ffcheckbutton.cpp | 2 +- xfa/fxfa/cxfa_fffield.cpp | 2 +- xfa/fxfa/cxfa_ffimage.cpp | 2 +- xfa/fxfa/cxfa_ffline.cpp | 2 +- xfa/fxfa/cxfa_ffpushbutton.cpp | 2 +- xfa/fxfa/cxfa_ffrectangle.cpp | 2 +- xfa/fxfa/cxfa_fftext.cpp | 4 ++-- xfa/fxfa/cxfa_widgetacc.cpp | 14 +++++++------- xfa/fxfa/parser/cxfa_node.cpp | 2 +- xfa/fxfa/parser/cxfa_node.h | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/cxfa_ffarc.cpp b/xfa/fxfa/cxfa_ffarc.cpp index 0fc8239983..0b1647b915 100644 --- a/xfa/fxfa/cxfa_ffarc.cpp +++ b/xfa/fxfa/cxfa_ffarc.cpp @@ -24,7 +24,7 @@ void CXFA_FFArc::RenderWidget(CXFA_Graphics* pGS, return; CFX_RectF rtArc = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) XFA_RectWithoutMargin(rtArc, margin); diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp index 001a3c1279..96d7431ad4 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.cpp +++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp @@ -91,7 +91,7 @@ bool CXFA_FFCheckButton::PerformLayout() { CXFA_FFWidget::PerformLayout(); float fCheckSize = m_pNode->GetWidgetAcc()->GetCheckButtonSize(); - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); CFX_RectF rtWidget = GetRectWithoutRotate(); if (margin) XFA_RectWithoutMargin(rtWidget, margin); diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index 5988d5b876..cf6c96a85d 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -170,7 +170,7 @@ bool CXFA_FFField::PerformLayout() { void CXFA_FFField::CapPlacement() { CFX_RectF rtWidget = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) { CXFA_LayoutItem* pItem = this; float fLeftInset = margin->GetLeftInset(); diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp index 946defb8d3..a2c21a1a7b 100644 --- a/xfa/fxfa/cxfa_ffimage.cpp +++ b/xfa/fxfa/cxfa_ffimage.cpp @@ -55,7 +55,7 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, return; CFX_RectF rtImage = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) XFA_RectWithoutMargin(rtImage, margin); diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp index 20f6552244..45ff95380d 100644 --- a/xfa/fxfa/cxfa_ffline.cpp +++ b/xfa/fxfa/cxfa_ffline.cpp @@ -111,7 +111,7 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS, mtRotate.Concat(matrix); CFX_RectF rtLine = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) XFA_RectWithoutMargin(rtLine, margin); diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index 4bcd1553b9..779fada905 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -100,7 +100,7 @@ bool CXFA_FFPushButton::PerformLayout() { CFX_RectF rtWidget = GetRectWithoutRotate(); m_rtUI = rtWidget; - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) XFA_RectWithoutMargin(rtWidget, margin); diff --git a/xfa/fxfa/cxfa_ffrectangle.cpp b/xfa/fxfa/cxfa_ffrectangle.cpp index f3f2a5a2b2..93c4ea2afb 100644 --- a/xfa/fxfa/cxfa_ffrectangle.cpp +++ b/xfa/fxfa/cxfa_ffrectangle.cpp @@ -24,7 +24,7 @@ void CXFA_FFRectangle::RenderWidget(CXFA_Graphics* pGS, return; CFX_RectF rect = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) XFA_RectWithoutMargin(rect, margin); diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp index b2ec840504..7ae3cb6f5c 100644 --- a/xfa/fxfa/cxfa_fftext.cpp +++ b/xfa/fxfa/cxfa_fftext.cpp @@ -41,7 +41,7 @@ void CXFA_FFText::RenderWidget(CXFA_Graphics* pGS, CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); CFX_RectF rtText = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) { CXFA_LayoutItem* pItem = this; if (!pItem->GetPrev() && !pItem->GetNext()) { @@ -86,7 +86,7 @@ bool CXFA_FFText::PerformLayout() { pItem = pItem->GetFirst(); while (pItem) { CFX_RectF rtText = pItem->GetRect(false); - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) { if (!pItem->GetPrev()) rtText.height -= margin->GetTopInset(); diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 034f59113d..9f9b29fe3b 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -573,7 +573,7 @@ bool CXFA_WidgetAcc::CalculateFieldAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size) { } bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) { size.width += margin->GetLeftInset() + margin->GetRightInset(); size.height += margin->GetTopInset() + margin->GetBottomInset(); @@ -669,7 +669,7 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CXFA_FFDoc* doc, } CFX_RectF rtUIMargin = GetUIMargin(); size.width -= rtUIMargin.left + rtUIMargin.width; - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) size.width -= margin->GetLeftInset() + margin->GetRightInset(); @@ -806,7 +806,7 @@ void CXFA_WidgetAcc::LoadText(CXFA_FFDoc* doc) { } float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) { - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) fWidthCalc += margin->GetLeftInset() + margin->GetRightInset(); @@ -822,14 +822,14 @@ float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) { } float CXFA_WidgetAcc::GetWidthWithoutMargin(float fWidthCalc) { - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) fWidthCalc -= margin->GetLeftInset() + margin->GetRightInset(); return fWidthCalc; } float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) { - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) fHeightCalc += margin->GetTopInset() + margin->GetBottomInset(); @@ -845,7 +845,7 @@ float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) { } float CXFA_WidgetAcc::GetHeightWithoutMargin(float fHeightCalc) { - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) fHeightCalc -= margin->GetTopInset() + margin->GetBottomInset(); return fHeightCalc; @@ -956,7 +956,7 @@ bool CXFA_WidgetAcc::FindSplitPos(CXFA_FFDocView* docView, float fTopInset = 0; float fBottomInset = 0; if (iBlockIndex == 0) { - CXFA_Margin* margin = m_pNode->GetMargin(); + CXFA_Margin* margin = m_pNode->GetMarginIfExists(); if (margin) { fTopInset = margin->GetTopInset(); fBottomInset = margin->GetBottomInset(); diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index d44b203f8c..d2c1e6fe8b 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1572,7 +1572,7 @@ FX_ARGB CXFA_Node::GetTextColor() const { return font ? font->GetColor() : 0xFF000000; } -CXFA_Margin* CXFA_Node::GetMargin() const { +CXFA_Margin* CXFA_Node::GetMarginIfExists() const { return JSObject()->GetProperty(0, XFA_Element::Margin); } diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index 69cd12c86b..1972da9183 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -246,7 +246,7 @@ class CXFA_Node : public CXFA_Object { FX_ARGB GetTextColor() const; float GetLineHeight() const; - CXFA_Margin* GetMargin() const; + CXFA_Margin* GetMarginIfExists() const; CXFA_Para* GetPara() const; CXFA_Calculate* GetCalculate() const; CXFA_Validate* GetValidate() const; -- cgit v1.2.3