From 2501ae2474c1f097a06634d647de2eb3fb730864 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 20 Nov 2017 21:19:13 +0000 Subject: Remove CXFA_DataData operator bool override This CL removes CXFA_DataData::operator bool in favour of an explicit HasValidNode method. This makes the call sites a lot clearer. Change-Id: I6fae14fdeec4674ca7916e21b9e5703070fc3069 Reviewed-on: https://pdfium-review.googlesource.com/18830 Commit-Queue: dsinclair Reviewed-by: Ryan Harrison --- xfa/fxfa/cxfa_ffwidget.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'xfa/fxfa/cxfa_ffwidget.cpp') diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index bb2d2e8a1c..88c1fea971 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -485,8 +485,10 @@ void XFA_BOX_Fill(const CXFA_BoxData& boxData, const CFX_Matrix& matrix, uint32_t dwFlags) { CXFA_FillData fillData = boxData.GetFillData(false); - if (!fillData || fillData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) + if (!fillData.HasValidNode() || + fillData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { return; + } pGS->SaveGraphState(); CXFA_GEPath fillPath; @@ -528,7 +530,7 @@ void XFA_BOX_StrokePath(const CXFA_StrokeData& strokeData, CXFA_GEPath* pPath, CXFA_Graphics* pGS, const CFX_Matrix& matrix) { - if (!strokeData || !strokeData.IsVisible()) + if (!strokeData.HasValidNode() || !strokeData.IsVisible()) return; float fThickness = strokeData.GetThickness(); @@ -555,7 +557,7 @@ void XFA_BOX_StrokeArc(const CXFA_BoxData& boxData, const CFX_Matrix& matrix, uint32_t dwFlags) { CXFA_EdgeData edgeData = boxData.GetEdgeData(0); - if (!edgeData || !edgeData.IsVisible()) + if (!edgeData.HasValidNode() || !edgeData.IsVisible()) return; bool bVisible = false; @@ -879,8 +881,10 @@ void XFA_DrawBox(CXFA_BoxData boxData, const CFX_RectF& rtWidget, const CFX_Matrix& matrix, uint32_t dwFlags) { - if (!boxData || boxData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) + if (!boxData.HasValidNode() || + boxData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { return; + } XFA_Element eType = boxData.GetElementType(); if (eType != XFA_Element::Arc && eType != XFA_Element::Border && @@ -980,12 +984,12 @@ void CXFA_FFWidget::RenderWidget(CXFA_Graphics* pGS, return; CXFA_BorderData borderData = m_pDataAcc->GetBorderData(false); - if (!borderData) + if (!borderData.HasValidNode()) return; CFX_RectF rtBorder = GetRectWithoutRotate(); CXFA_MarginData marginData = borderData.GetMarginData(); - if (marginData) + if (marginData.HasValidNode()) XFA_RectWidthoutMargin(rtBorder, marginData); rtBorder.Normalize(); @@ -2019,7 +2023,7 @@ RetainPtr XFA_LoadImageFromBuffer( void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_MarginData& marginData, bool bUI) { - if (!marginData) + if (!marginData.HasValidNode()) return; float fLeftInset; -- cgit v1.2.3