diff options
author | tsepez <tsepez@chromium.org> | 2016-05-04 13:38:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-04 13:38:11 -0700 |
commit | 7d89e728a450c681c53d40d7f67ee2eef0400705 (patch) | |
tree | a82e90ff7b65382965395a7b323cfbc7ea5009f4 /xfa/fwl | |
parent | 10b01bf44695ce9a354660b16f607da70727a846 (diff) | |
download | pdfium-7d89e728a450c681c53d40d7f67ee2eef0400705.tar.xz |
Return bool rather than bitwise-and for FX_BOOL
Investigate results of:
git grep -ni 'return [(]*[a-z0-9_]* &[^&]'
git grep -ni 'BOOL.*= [(]*[a-z0-9_]* &[^&]'
Review-Url: https://codereview.chromium.org/1951653002
Diffstat (limited to 'xfa/fwl')
-rw-r--r-- | xfa/fwl/basewidget/fwl_comboboximp.cpp | 8 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_editimp.cpp | 2 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_listboximp.cpp | 7 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_formimp.h | 2 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_noteimp.cpp | 56 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_widgetmgrimp.cpp | 9 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_widgetmgrimp.h | 4 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_checkboxtp.cpp | 2 |
8 files changed, 35 insertions, 55 deletions
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index fd7c6d6266..35ac5fa240 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -557,8 +557,8 @@ FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } - FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; - FX_BOOL bRemoveDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; + bool bAddDropDown = !!(dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown); + bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown); if (bAddDropDown && !m_pEdit) { CFWL_WidgetImpProperties prop; m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr)); @@ -1232,8 +1232,8 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, if (!m_pEdit) { DisForm_InitComboEdit(); } - FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; - FX_BOOL bDelDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; + bool bAddDropDown = !!(dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown); + bool bDelDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown); dwStylesExRemoved &= ~FWL_STYLEEXT_CMB_DropDown; m_pProperties->m_dwStyleExes |= FWL_STYLEEXT_CMB_DropDown; if (bAddDropDown) { diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index 8b4dd39321..a80b89f9a7 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -1831,7 +1831,7 @@ void CFWL_EditImpDelegate::DoButtonDown(CFWL_MsgMouse* pMsg) { } void CFWL_EditImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { uint32_t dwStyleEx = m_pOwner->GetStylesEx(); - FX_BOOL bRepaint = dwStyleEx & FWL_STYLEEXT_EDT_InnerCaret; + bool bRepaint = !!(dwStyleEx & FWL_STYLEEXT_EDT_InnerCaret); if (bSet) { m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; if (!m_pOwner->m_pEdtEngine) { diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index dd017e215f..d514f7e1e3 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -399,14 +399,11 @@ void CFWL_ListBoxImp::ClearSelection() { for (int32_t i = 0; i < iCount; i++) { FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i); uint32_t dwState = pData->GetItemStyles(m_pInterface, hItem); - FX_BOOL bFindSel = dwState & FWL_ITEMSTATE_LTB_Selected; - if (!bFindSel) { + if (!(dwState & FWL_ITEMSTATE_LTB_Selected)) continue; - } SetSelectionDirect(hItem, FALSE); - if (!bMulti) { + if (!bMulti) return; - } } } void CFWL_ListBoxImp::SelectAll() { diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h index 4ee3e0ddae..d8bc80522e 100644 --- a/xfa/fwl/core/fwl_formimp.h +++ b/xfa/fwl/core/fwl_formimp.h @@ -32,7 +32,7 @@ class CFWL_SysBtn { m_dwState = 0; } - FX_BOOL IsDisabled() { return m_dwState & FWL_SYSBUTTONSTATE_Disabled; } + bool IsDisabled() { return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); } void SetNormal() { m_dwState &= 0xFFF0; } void SetPressed() { diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index 39afa783c0..41e749fc9a 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -810,47 +810,27 @@ FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { if (dwFilter == FWL_EVENT_ALL_MASK) return TRUE; - FX_BOOL bRet = FALSE; switch (pEvent->GetClassID()) { - case CFWL_EventType::Mouse: { - bRet = dwFilter & FWL_EVENT_MOUSE_MASK; - break; - } - case CFWL_EventType::MouseWheel: { - bRet = dwFilter & FWL_EVENT_MOUSEWHEEL_MASK; - break; - } - case CFWL_EventType::Key: { - bRet = dwFilter & FWL_EVENT_KEY_MASK; - break; - } + case CFWL_EventType::Mouse: + return !!(dwFilter & FWL_EVENT_MOUSE_MASK); + case CFWL_EventType::MouseWheel: + return !!(dwFilter & FWL_EVENT_MOUSEWHEEL_MASK); + case CFWL_EventType::Key: + return !!(dwFilter & FWL_EVENT_KEY_MASK); case CFWL_EventType::SetFocus: - case CFWL_EventType::KillFocus: { - bRet = dwFilter & FWL_EVENT_FOCUSCHANGED_MASK; - break; - } - case CFWL_EventType::Draw: { - bRet = dwFilter & FWL_EVENT_DRAW_MASK; - break; - } - case CFWL_EventType::Close: { - bRet = dwFilter & FWL_EVENT_CLOSE_MASK; - break; - } - case CFWL_EventType::SizeChanged: { - bRet = dwFilter & FWL_EVENT_SIZECHANGED_MASK; - break; - } - case CFWL_EventType::Idle: { - bRet = dwFilter & FWL_EVENT_IDLE_MASK; - break; - } - default: { - bRet = dwFilter & FWL_EVENT_CONTROL_MASK; - break; - } + case CFWL_EventType::KillFocus: + return !!(dwFilter & FWL_EVENT_FOCUSCHANGED_MASK); + case CFWL_EventType::Draw: + return !!(dwFilter & FWL_EVENT_DRAW_MASK); + case CFWL_EventType::Close: + return !!(dwFilter & FWL_EVENT_CLOSE_MASK); + case CFWL_EventType::SizeChanged: + return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); + case CFWL_EventType::Idle: + return !!(dwFilter & FWL_EVENT_IDLE_MASK); + default: + return !!(dwFilter & FWL_EVENT_CONTROL_MASK); } - return bRet; } CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = NULL; diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp index 02b63862e5..1985cbdeaf 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.cpp +++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp @@ -667,12 +667,15 @@ FX_BOOL CFWL_WidgetMgr::IsAbleNative(IFWL_Widget* pWidget) { FWL_WGTSTYLE_OverLapper) || (dwStyles & FWL_WGTSTYLE_Popup); } -FX_BOOL CFWL_WidgetMgr::IsThreadEnabled() { + +bool CFWL_WidgetMgr::IsThreadEnabled() { return !(m_dwCapability & FWL_WGTMGR_DisableThread); } -FX_BOOL CFWL_WidgetMgr::IsFormDisabled() { - return m_dwCapability & FWL_WGTMGR_DisableForm; + +bool CFWL_WidgetMgr::IsFormDisabled() { + return !!(m_dwCapability & FWL_WGTMGR_DisableForm); } + FX_BOOL CFWL_WidgetMgr::GetAdapterPopupPos(IFWL_Widget* pWidget, FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, diff --git a/xfa/fwl/core/fwl_widgetmgrimp.h b/xfa/fwl/core/fwl_widgetmgrimp.h index 0b4e2bf79d..0fcd057aeb 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.h +++ b/xfa/fwl/core/fwl_widgetmgrimp.h @@ -120,8 +120,8 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr { IFWL_AdapterWidgetMgr* GetAdapterWidgetMgr() { return m_pAdapter; } CFWL_WidgetMgrDelegate* GetDelegate() { return m_pDelegate; } CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget); - FX_BOOL IsThreadEnabled(); - FX_BOOL IsFormDisabled(); + bool IsThreadEnabled(); + bool IsFormDisabled(); FX_BOOL GetAdapterPopupPos(IFWL_Widget* pWidget, FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index ac94c80d6d..a6d70eb452 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -114,7 +114,7 @@ void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget, path.Create(); FX_FLOAT fRight = pRect->right(); FX_FLOAT fBottom = pRect->bottom(); - FX_BOOL bClipSign = dwStates & CFWL_PartState_Hovered; + bool bClipSign = !!(dwStates & CFWL_PartState_Hovered); if ((dwStyleEx == FWL_STYLEEXT_CKB_ShapeSolidSquare) || (dwStyleEx == FWL_STYLEEXT_CKB_ShapeSunkenSquare)) { path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); |