diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-05-02 21:14:27 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-02 21:14:27 +0000 |
commit | 6312bf94bb44e2edeb855008da0921c13103f66a (patch) | |
tree | edafcb079272c4a20abc587861d5df492846a5fc | |
parent | fceaf42fb5930070415703e448ecce39e9dc0522 (diff) | |
download | pdfium-6312bf94bb44e2edeb855008da0921c13103f66a.tar.xz |
Use pointer instead of ref for XFA_RectWithoutMargin param.chromium/3418
Removed many null checks since XFA_RectWithoutMargin already checks
if the margin is null internally.
Change-Id: I21f5101fe38559eb02f4c3aaf081ff29ce293e47
Reviewed-on: https://pdfium-review.googlesource.com/31993
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r-- | xfa/fxfa/cxfa_ffarc.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcheckbutton.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fffield.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffimage.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffline.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffpushbutton.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffrectangle.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftext.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.h | 4 |
10 files changed, 21 insertions, 33 deletions
diff --git a/xfa/fxfa/cxfa_ffarc.cpp b/xfa/fxfa/cxfa_ffarc.cpp index 0c842e4f64..a832f14d8d 100644 --- a/xfa/fxfa/cxfa_ffarc.cpp +++ b/xfa/fxfa/cxfa_ffarc.cpp @@ -25,8 +25,7 @@ void CXFA_FFArc::RenderWidget(CXFA_Graphics* pGS, CFX_RectF rtArc = GetRectWithoutRotate(); CXFA_Margin* margin = m_pNode->GetMarginIfExists(); - if (margin) - XFA_RectWithoutMargin(rtArc, margin); + XFA_RectWithoutMargin(&rtArc, margin); CFX_Matrix mtRotate = GetRotateMatrix(); mtRotate.Concat(matrix); diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp index f5f840847b..c78fa1336d 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.cpp +++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp @@ -95,8 +95,7 @@ bool CXFA_FFCheckButton::PerformLayout() { float fCheckSize = m_pNode->GetCheckButtonSize(); CXFA_Margin* margin = m_pNode->GetMarginIfExists(); CFX_RectF rtWidget = GetRectWithoutRotate(); - if (margin) - XFA_RectWithoutMargin(rtWidget, margin); + XFA_RectWithoutMargin(&rtWidget, margin); XFA_AttributeEnum iCapPlacement = XFA_AttributeEnum::Unknown; float fCapReserve = 0; @@ -135,7 +134,7 @@ bool CXFA_FFCheckButton::PerformLayout() { } case XFA_AttributeEnum::Top: { m_rtCaption.height = fCapReserve; - XFA_RectWithoutMargin(m_rtCaption, captionMargin); + XFA_RectWithoutMargin(&m_rtCaption, captionMargin); m_rtUI.height -= fCapReserve; m_rtUI.top += fCapReserve; break; @@ -150,7 +149,7 @@ bool CXFA_FFCheckButton::PerformLayout() { case XFA_AttributeEnum::Bottom: { m_rtCaption.top = m_rtCaption.bottom() - fCapReserve; m_rtCaption.height = fCapReserve; - XFA_RectWithoutMargin(m_rtCaption, captionMargin); + XFA_RectWithoutMargin(&m_rtCaption, captionMargin); m_rtUI.height -= fCapReserve; break; } @@ -178,8 +177,7 @@ bool CXFA_FFCheckButton::PerformLayout() { CXFA_Border* borderUI = m_pNode->GetUIBorder(); if (borderUI) { CXFA_Margin* borderMargin = borderUI->GetMarginIfExists(); - if (borderMargin) - XFA_RectWithoutMargin(m_rtUI, borderMargin); + XFA_RectWithoutMargin(&m_rtUI, borderMargin); } m_rtUI.Normalize(); @@ -193,7 +191,7 @@ bool CXFA_FFCheckButton::PerformLayout() { void CXFA_FFCheckButton::CapLeftRightPlacement( const CXFA_Margin* captionMargin) { - XFA_RectWithoutMargin(m_rtCaption, captionMargin); + XFA_RectWithoutMargin(&m_rtCaption, captionMargin); if (m_rtCaption.height < 0) m_rtCaption.top += m_rtCaption.height; if (m_rtCaption.width < 0) { diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index e9a3c49c5c..ce8e70ea0c 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -212,7 +212,7 @@ void CXFA_FFField::CapPlacement() { m_rtCaption.height += pItem->GetRect(false).Height(); pItem = pItem->GetNext(); } - XFA_RectWithoutMargin(m_rtCaption, margin); + XFA_RectWithoutMargin(&m_rtCaption, margin); } CXFA_TextLayout* pCapTextLayout = m_pNode->GetCaptionTextLayout(); @@ -270,8 +270,7 @@ void CXFA_FFField::CapPlacement() { CXFA_Border* borderUI = m_pNode->GetUIBorder(); if (borderUI) { CXFA_Margin* borderMargin = borderUI->GetMarginIfExists(); - if (borderMargin) - XFA_RectWithoutMargin(m_rtUI, borderMargin); + XFA_RectWithoutMargin(&m_rtUI, borderMargin); } m_rtUI.Normalize(); } @@ -282,7 +281,7 @@ void CXFA_FFField::CapTopBottomPlacement(const CXFA_Margin* margin, CFX_RectF rtUIMargin = m_pNode->GetUIMargin(); m_rtCaption.left += rtUIMargin.left; if (margin) { - XFA_RectWithoutMargin(m_rtCaption, margin); + XFA_RectWithoutMargin(&m_rtCaption, margin); if (m_rtCaption.height < 0) m_rtCaption.top += m_rtCaption.height; } @@ -309,7 +308,7 @@ void CXFA_FFField::CapLeftRightPlacement(const CXFA_Margin* margin, m_rtCaption.top += rtUIMargin.top; m_rtCaption.height -= rtUIMargin.top; if (margin) { - XFA_RectWithoutMargin(m_rtCaption, margin); + XFA_RectWithoutMargin(&m_rtCaption, margin); if (m_rtCaption.height < 0) m_rtCaption.top += m_rtCaption.height; } diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp index 9d9010158e..cb4990eb81 100644 --- a/xfa/fxfa/cxfa_ffimage.cpp +++ b/xfa/fxfa/cxfa_ffimage.cpp @@ -54,8 +54,7 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, CFX_RectF rtImage = GetRectWithoutRotate(); CXFA_Margin* margin = m_pNode->GetMarginIfExists(); - if (margin) - XFA_RectWithoutMargin(rtImage, margin); + XFA_RectWithoutMargin(&rtImage, margin); XFA_AttributeEnum iHorzAlign = XFA_AttributeEnum::Left; XFA_AttributeEnum iVertAlign = XFA_AttributeEnum::Top; diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp index 75d142cb8c..4061eb8cd9 100644 --- a/xfa/fxfa/cxfa_ffline.cpp +++ b/xfa/fxfa/cxfa_ffline.cpp @@ -116,8 +116,7 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS, CFX_RectF rtLine = GetRectWithoutRotate(); CXFA_Margin* margin = m_pNode->GetMarginIfExists(); - if (margin) - XFA_RectWithoutMargin(rtLine, margin); + XFA_RectWithoutMargin(&rtLine, margin); GetRectFromHand(rtLine, line ? line->GetHand() : XFA_AttributeEnum::Left, fLineWidth); diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index 7c556b81a8..a40b1ef1f1 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -102,15 +102,13 @@ bool CXFA_FFPushButton::PerformLayout() { m_rtUI = rtWidget; CXFA_Margin* margin = m_pNode->GetMarginIfExists(); - if (margin) - XFA_RectWithoutMargin(rtWidget, margin); + XFA_RectWithoutMargin(&rtWidget, margin); m_rtCaption = rtWidget; CXFA_Caption* caption = m_pNode->GetCaptionIfExists(); CXFA_Margin* captionMargin = caption ? caption->GetMarginIfExists() : nullptr; - if (captionMargin) - XFA_RectWithoutMargin(m_rtCaption, captionMargin); + XFA_RectWithoutMargin(&m_rtCaption, captionMargin); LayoutHighlightCaption(); SetFWLRect(); diff --git a/xfa/fxfa/cxfa_ffrectangle.cpp b/xfa/fxfa/cxfa_ffrectangle.cpp index e02a630568..ba9b950154 100644 --- a/xfa/fxfa/cxfa_ffrectangle.cpp +++ b/xfa/fxfa/cxfa_ffrectangle.cpp @@ -25,8 +25,7 @@ void CXFA_FFRectangle::RenderWidget(CXFA_Graphics* pGS, CFX_RectF rect = GetRectWithoutRotate(); CXFA_Margin* margin = m_pNode->GetMarginIfExists(); - if (margin) - XFA_RectWithoutMargin(rect, margin); + XFA_RectWithoutMargin(&rect, margin); CFX_Matrix mtRotate = GetRotateMatrix(); mtRotate.Concat(matrix); diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp index 5d6152e7a4..453a74b3b9 100644 --- a/xfa/fxfa/cxfa_fftext.cpp +++ b/xfa/fxfa/cxfa_fftext.cpp @@ -44,7 +44,7 @@ void CXFA_FFText::RenderWidget(CXFA_Graphics* pGS, if (margin) { CXFA_LayoutItem* pItem = this; if (!pItem->GetPrev() && !pItem->GetNext()) { - XFA_RectWithoutMargin(rtText, margin); + XFA_RectWithoutMargin(&rtText, margin); } else { float fTopInset = 0; float fBottomInset = 0; diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 96c611e3f7..8b2e826165 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -209,12 +209,12 @@ RetainPtr<CFX_DIBitmap> XFA_LoadImageFromBuffer( return pBitmap; } -void XFA_RectWithoutMargin(CFX_RectF& rt, const CXFA_Margin* margin, bool bUI) { +void XFA_RectWithoutMargin(CFX_RectF* rt, const CXFA_Margin* margin) { if (!margin) return; - rt.Deflate(margin->GetLeftInset(), margin->GetTopInset(), - margin->GetRightInset(), margin->GetBottomInset()); + rt->Deflate(margin->GetLeftInset(), margin->GetTopInset(), + margin->GetRightInset(), margin->GetBottomInset()); } CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem) { @@ -298,8 +298,7 @@ void CXFA_FFWidget::RenderWidget(CXFA_Graphics* pGS, CFX_RectF rtBorder = GetRectWithoutRotate(); CXFA_Margin* margin = border->GetMarginIfExists(); - if (margin) - XFA_RectWithoutMargin(rtBorder, margin); + XFA_RectWithoutMargin(&rtBorder, margin); rtBorder.Normalize(); DrawBorder(pGS, border, rtBorder, matrix); diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index 9c6215627d..9b8402c343 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -49,9 +49,7 @@ RetainPtr<CFX_DIBitmap> XFA_LoadImageFromBuffer( int32_t& iImageXDpi, int32_t& iImageYDpi); -void XFA_RectWithoutMargin(CFX_RectF& rt, - const CXFA_Margin* margin, - bool bUI = false); +void XFA_RectWithoutMargin(CFX_RectF* rt, const CXFA_Margin* margin); CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem); class CXFA_CalcData { |