diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-10 19:44:26 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-10 19:44:26 +0000 |
commit | 78d841011655b868486a45e0fe865a972742aa0c (patch) | |
tree | e2bb52e930000b90d77aaf82af8903d106d63d58 | |
parent | ccd7899b2d662c0a1be6cd52c6b6068472c27375 (diff) | |
download | pdfium-78d841011655b868486a45e0fe865a972742aa0c.tar.xz |
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 <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | xfa/fxfa/cxfa_ffarc.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcheckbutton.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fffield.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffimage.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffline.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffpushbutton.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffrectangle.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftext.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 14 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.h | 2 |
11 files changed, 18 insertions, 18 deletions
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<CXFA_Margin>(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; |