Make CWFL_ThemePart::m_pData be a CFX_RectF* and not a void*.
Because the only types ever assigned to it are CFX_RectF* (or
nullptr). This reveals a bad cast in a codepath which is likely
not hit (and has been removed).
Change-Id: I1a7ed5cc86aa2c9d3d0a7af55acd5da5de6d3c6c
Reviewed-on: https://pdfium-review.googlesource.com/c/48431
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index 1529062..35445a9 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -76,7 +76,7 @@
param.m_matrix.Concat(matrix);
param.m_rtPart = m_rtClient;
if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)
- param.m_pData = &m_rtFocus;
+ param.m_pRtData = &m_rtFocus;
pTheme->DrawBackground(¶m);
param.m_iPart = CFWL_Part::CheckBox;
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 5ef5682..9e718fe 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -357,7 +357,7 @@
param.m_matrix.Concat(*pMatrix);
param.m_rtPart = m_rtClient;
if (IsShowScrollBar(false) && IsShowScrollBar(true))
- param.m_pData = &m_rtStatic;
+ param.m_pRtData = &m_rtStatic;
if (!IsEnabled())
param.m_dwStates = CFWL_PartState_Disabled;
@@ -424,7 +424,7 @@
bg_param.m_rtPart = rtItem;
bg_param.m_bMaximize = true;
CFX_RectF rtFocus(rtItem);
- bg_param.m_pData = &rtFocus;
+ bg_param.m_pRtData = &rtFocus;
if (m_pVertScrollBar && !m_pHorzScrollBar &&
(dwPartStates & CFWL_PartState_Focused)) {
bg_param.m_rtPart.left += 1;
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index 4856029..a977a7b 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -74,7 +74,7 @@
param.m_matrix.Concat(*pMatrix);
param.m_rtPart = m_rtClient;
if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)
- param.m_pData = &m_rtCaption;
+ param.m_pRtData = &m_rtCaption;
pTheme->DrawBackground(¶m);
}
diff --git a/xfa/fwl/cfwl_themepart.cpp b/xfa/fwl/cfwl_themepart.cpp
index 44251ad..831e494 100644
--- a/xfa/fwl/cfwl_themepart.cpp
+++ b/xfa/fwl/cfwl_themepart.cpp
@@ -12,5 +12,4 @@
m_dwStates(CFWL_PartState_Normal),
m_bMaximize(false),
m_bStaticBackground(false),
- m_pData(nullptr) {
-}
+ m_pRtData(nullptr) {}
diff --git a/xfa/fwl/cfwl_themepart.h b/xfa/fwl/cfwl_themepart.h
index 1bb87e9..942fd71 100644
--- a/xfa/fwl/cfwl_themepart.h
+++ b/xfa/fwl/cfwl_themepart.h
@@ -88,7 +88,7 @@
uint32_t m_dwStates;
bool m_bMaximize;
bool m_bStaticBackground;
- void* m_pData;
+ CFX_RectF* m_pRtData;
};
#endif // XFA_FWL_CFWL_THEMEPART_H_
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp
index 186d658..3cc8355 100644
--- a/xfa/fwl/theme/cfwl_carettp.cpp
+++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -24,9 +24,8 @@
if (!(pParams->m_dwStates & CFWL_PartState_HightLight))
return;
- DrawCaretBK(
- pParams->m_pGraphics.Get(), pParams->m_dwStates, &pParams->m_rtPart,
- static_cast<CXFA_GEColor*>(pParams->m_pData), &pParams->m_matrix);
+ DrawCaretBK(pParams->m_pGraphics.Get(), pParams->m_dwStates,
+ &pParams->m_rtPart, &pParams->m_matrix);
break;
}
default:
@@ -37,15 +36,10 @@
void CFWL_CaretTP::DrawCaretBK(CXFA_Graphics* pGraphics,
uint32_t dwStates,
const CFX_RectF* pRect,
- CXFA_GEColor* crFill,
CFX_Matrix* pMatrix) {
CXFA_GEPath path;
CFX_RectF rect = *pRect;
path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
- if (crFill) {
- pGraphics->SetFillColor(*crFill);
- } else {
- pGraphics->SetFillColor(CXFA_GEColor(ArgbEncode(255, 0, 0, 0)));
- }
+ pGraphics->SetFillColor(CXFA_GEColor(ArgbEncode(255, 0, 0, 0)));
pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
}
diff --git a/xfa/fwl/theme/cfwl_carettp.h b/xfa/fwl/theme/cfwl_carettp.h
index 2fe01be..633abf0 100644
--- a/xfa/fwl/theme/cfwl_carettp.h
+++ b/xfa/fwl/theme/cfwl_carettp.h
@@ -21,7 +21,6 @@
void DrawCaretBK(CXFA_Graphics* pGraphics,
uint32_t dwStates,
const CFX_RectF* pRect,
- CXFA_GEColor* crFill,
CFX_Matrix* pMatrix);
};
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index 9b8cd0d..fc0f54e 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -29,16 +29,16 @@
case CFWL_Part::Background: {
FillSolidRect(pParams->m_pGraphics.Get(), ArgbEncode(255, 255, 255, 255),
&pParams->m_rtPart, &pParams->m_matrix);
- if (pParams->m_pData) {
+ if (pParams->m_pRtData) {
FillSolidRect(pParams->m_pGraphics.Get(), FWLTHEME_COLOR_Background,
- static_cast<CFX_RectF*>(pParams->m_pData),
- &pParams->m_matrix);
+ pParams->m_pRtData, &pParams->m_matrix);
}
break;
}
case CFWL_Part::ListItem: {
DrawListBoxItem(pParams->m_pGraphics.Get(), pParams->m_dwStates,
- &pParams->m_rtPart, pParams->m_pData, &pParams->m_matrix);
+ &pParams->m_rtPart, pParams->m_pRtData,
+ &pParams->m_matrix);
break;
}
case CFWL_Part::Check: {