summaryrefslogtreecommitdiff
path: root/xfa/fwl/theme/cfwl_formtp.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-05-27 14:48:10 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-27 14:48:10 -0700
commitbbff41927ecce2ff93668aa615307f548ca896eb (patch)
treefd0d8b7a0c535fb3fb5c0fff0167810f1b9050eb /xfa/fwl/theme/cfwl_formtp.cpp
parentd23df55b95716a4b6021ab600b99fd31954c8052 (diff)
downloadpdfium-bbff41927ecce2ff93668aa615307f548ca896eb.tar.xz
Fix two bugs found by /analyze tool
The first one is about bitwise AND on zero, the result would always be zero. The second one is about using wrong bitmasks, the result would cause branches never get executed. BUG=chromium:613623, chromium:427616 Review-Url: https://codereview.chromium.org/2016243003
Diffstat (limited to 'xfa/fwl/theme/cfwl_formtp.cpp')
-rw-r--r--xfa/fwl/theme/cfwl_formtp.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/xfa/fwl/theme/cfwl_formtp.cpp b/xfa/fwl/theme/cfwl_formtp.cpp
index 971e738765..033375911b 100644
--- a/xfa/fwl/theme/cfwl_formtp.cpp
+++ b/xfa/fwl/theme/cfwl_formtp.cpp
@@ -78,25 +78,17 @@ FX_BOOL CFWL_FormTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return FALSE;
int32_t iActive = 0;
- if (pParams->m_dwStates & CFWL_PartState_Inactive) {
+ if (pParams->m_dwStates & CFWL_PartState_Inactive)
iActive = 1;
- }
+
FWLTHEME_STATE eState = FWLTHEME_STATE_Normal;
- switch (pParams->m_dwStates & 0x03) {
- case CFWL_PartState_Hovered: {
- eState = FWLTHEME_STATE_Hover;
- break;
- }
- case CFWL_PartState_Pressed: {
- eState = FWLTHEME_STATE_Pressed;
- break;
- }
- case CFWL_PartState_Disabled: {
- eState = FWLTHEME_STATE_Disabale;
- break;
- }
- default: {}
- }
+ if (pParams->m_dwStates & CFWL_PartState_Hovered)
+ eState = FWLTHEME_STATE_Hover;
+ else if (pParams->m_dwStates & CFWL_PartState_Pressed)
+ eState = FWLTHEME_STATE_Pressed;
+ else if (pParams->m_dwStates & CFWL_PartState_Disabled)
+ eState = FWLTHEME_STATE_Disabale;
+
switch (pParams->m_iPart) {
case CFWL_Part::Border: {
DrawFormBorder(pParams->m_pGraphics, &pParams->m_rtPart, eState,