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/parser/cxfa_widgetdata.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_widgetdata.cpp') diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index cff2d6b004..b5ceb4a4d4 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -364,19 +364,21 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() { pUIChild ? pUIChild->JSNode()->GetProperty(0, XFA_Element::Margin, false) : nullptr); - if (!mgUI) + if (!mgUI.HasValidNode()) return CFX_RectF(); CXFA_BorderData borderData = GetUIBorderData(); - if (borderData && borderData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) + if (borderData.HasValidNode() && + borderData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { return CFX_RectF(); + } float fLeftInset, fTopInset, fRightInset, fBottomInset; bool bLeft = mgUI.GetLeftInset(fLeftInset); bool bTop = mgUI.GetTopInset(fTopInset); bool bRight = mgUI.GetRightInset(fRightInset); bool bBottom = mgUI.GetBottomInset(fBottomInset); - if (borderData) { + if (borderData.HasValidNode()) { bool bVisible = false; float fThickness = 0; int32_t iType = 0; @@ -492,7 +494,7 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { CXFA_WidgetData exclGroup(GetExclGroupNode()); - if (exclGroup) { + if (exclGroup.HasValidNode()) { WideString wsValue; if (eCheckState != XFA_CHECKSTATE_Off) { if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items, false)) { @@ -1504,7 +1506,7 @@ WideString CXFA_WidgetData::GetPictureContent(XFA_VALUEPICTURE ePicture) { } case XFA_VALUEPICTURE_DataBind: { CXFA_BindData bindData = GetBindData(); - if (bindData) + if (bindData.HasValidNode()) return bindData.GetPicture(); break; } -- cgit v1.2.3