From 007e6c0f9559412788b903bcb6a7601e220c3be8 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 26 Feb 2016 14:31:56 -0800 Subject: Remove some FX_BOOLs Grepping for FX_BOOL and |==| on the same line gives a very strong clue that the expression won't be out of range of the |bool| type iteself. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1736323003 . --- xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp | 12 +++++------- xfa/src/fwl/src/basewidget/fwl_listboximp.cpp | 6 +++--- xfa/src/fwl/src/theme/checkboxtp.cpp | 9 ++++----- 3 files changed, 12 insertions(+), 15 deletions(-) (limited to 'xfa/src/fwl') diff --git a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp index b963e1daf8..88add897b7 100644 --- a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp @@ -1526,15 +1526,13 @@ void CFWL_ComboBoxImpDelegate::OnKey(CFWL_MsgKey* pMsg) { m_pOwner->DispatchKeyEvent(pMsg); return; } - FX_BOOL bSubCtrlKey = pMsg->m_pDstTarget == m_pOwner->m_pInterface; - if (bSubCtrlKey) { + if (pMsg->m_pDstTarget == m_pOwner->m_pInterface) DoSubCtrlKey(pMsg); - } } void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; - FX_BOOL bUp = dwKeyCode == FWL_VKEY_Up; - FX_BOOL bDown = dwKeyCode == FWL_VKEY_Down; + const bool bUp = dwKeyCode == FWL_VKEY_Up; + const bool bDown = dwKeyCode == FWL_VKEY_Down; if (bUp || bDown) { int32_t iCount = static_cast( m_pOwner->m_pListBox->GetImpl())->CountItems(); @@ -1684,8 +1682,8 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg, } void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) { FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; - FX_BOOL bUp = dwKeyCode == FWL_VKEY_Up; - FX_BOOL bDown = dwKeyCode == FWL_VKEY_Down; + const bool bUp = dwKeyCode == FWL_VKEY_Up; + const bool bDown = dwKeyCode == FWL_VKEY_Down; if (bUp || bDown) { CFWL_ComboListImp* pComboList = static_cast(m_pOwner->m_pListBox->GetImpl()); diff --git a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp index e924b8b791..1f77f7ad94 100644 --- a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp @@ -332,9 +332,9 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem, case FWL_VKEY_Down: case FWL_VKEY_Home: case FWL_VKEY_End: { - FX_BOOL bUp = dwKeyCode == FWL_VKEY_Up; - FX_BOOL bDown = dwKeyCode == FWL_VKEY_Down; - FX_BOOL bHome = dwKeyCode == FWL_VKEY_Home; + const bool bUp = dwKeyCode == FWL_VKEY_Up; + const bool bDown = dwKeyCode == FWL_VKEY_Down; + const bool bHome = dwKeyCode == FWL_VKEY_Home; IFWL_ListBoxDP* pData = static_cast(m_pProperties->m_pDataProvider); int32_t iDstItem = -1; diff --git a/xfa/src/fwl/src/theme/checkboxtp.cpp b/xfa/src/fwl/src/theme/checkboxtp.cpp index 85dd01f85f..b288e5f19f 100644 --- a/xfa/src/fwl/src/theme/checkboxtp.cpp +++ b/xfa/src/fwl/src/theme/checkboxtp.cpp @@ -49,11 +49,10 @@ FX_DWORD CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { if (!m_pTextOut) return FALSE; - FX_BOOL bDisable = (pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Disabled; - FX_ARGB argText = - bDisable ? FWLTHEME_CAPACITY_TextDisColor : FWLTHEME_CAPACITY_TextColor; - m_pTextOut->SetTextColor(argText); + m_pTextOut->SetTextColor((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) == + FWL_PARTSTATE_CKB_Disabled + ? FWLTHEME_CAPACITY_TextDisColor + : FWLTHEME_CAPACITY_TextColor); return CFWL_WidgetTP::DrawText(pParams); } FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { -- cgit v1.2.3