summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-04 14:11:13 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-04 14:11:13 -0700
commitb7675f63684ebff68c688a1c7b160596b6747c3e (patch)
treeb677ff8fd5eb74ad27ffefb97681ffe92e1bb89b
parentef43608928148bac9b73f6919188efd87feccf95 (diff)
downloadpdfium-b7675f63684ebff68c688a1c7b160596b6747c3e.tar.xz
Cleanup CFWL_ThemePart data.
The m_dwData pointer was being used as a generic way to pass around data. There were only two places we were reading that data. This Cl changes to have two specific flags and removes the generic pointer. Review-Url: https://codereview.chromium.org/1950973003
-rw-r--r--xfa/fwl/basewidget/fwl_editimp.cpp5
-rw-r--r--xfa/fwl/basewidget/fwl_listboximp.cpp13
-rw-r--r--xfa/fwl/basewidget/ifwl_edit.h2
-rw-r--r--xfa/fwl/basewidget/ifwl_listbox.h6
-rw-r--r--xfa/fwl/core/cfwl_themepart.h6
-rw-r--r--xfa/fwl/core/fwl_formimp.cpp4
-rw-r--r--xfa/fwl/theme/cfwl_edittp.cpp4
-rw-r--r--xfa/fwl/theme/cfwl_formtp.cpp4
-rw-r--r--xfa/fwl/theme/cfwl_formtp.h2
9 files changed, 18 insertions, 28 deletions
diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp
index 8deec9beb2..01557ba2cc 100644
--- a/xfa/fwl/basewidget/fwl_editimp.cpp
+++ b/xfa/fwl/basewidget/fwl_editimp.cpp
@@ -930,7 +930,7 @@ void CFWL_EditImp::DrawTextBk(CFX_Graphics* pGraphics,
CFWL_ThemeBackground param;
param.m_pWidget = m_pInterface;
param.m_iPart = CFWL_Part::Background;
- param.m_dwData = FWL_PARTDATA_EDT_Background;
+ param.m_bStaticBackground = false;
param.m_dwStates = m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly
? CFWL_PartState_ReadOnly
: CFWL_PartState_Normal;
@@ -951,7 +951,8 @@ void CFWL_EditImp::DrawTextBk(CFX_Graphics* pGraphics,
rtStatic.Set(m_rtClient.right() - rtScorll.height,
m_rtClient.bottom() - rtScorll.height, rtScorll.height,
rtScorll.height);
- param.m_dwData = FWL_PARTDATA_EDT_StaticBackground;
+ param.m_bStaticBackground = true;
+ param.m_bMaximize = true;
param.m_rtPart = rtStatic;
pTheme->DrawBackground(&param);
}
diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp
index b2a4e2c20c..3a0df152c2 100644
--- a/xfa/fwl/basewidget/fwl_listboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_listboximp.cpp
@@ -637,9 +637,6 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
dwItemStyles & FWL_ITEMSTATE_LTB_Focused) {
dwPartStates |= CFWL_PartState_Focused;
}
- FWL_ListBoxItemData itemData;
- itemData.pDataProvider = pData;
- itemData.iIndex = Index;
{
CFWL_ThemeBackground param;
param.m_pWidget = m_pInterface;
@@ -648,7 +645,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
param.m_pGraphics = pGraphics;
param.m_matrix.Concat(*pMatrix);
param.m_rtPart = rtItem;
- param.m_dwData = (uint32_t)(uintptr_t)(&itemData);
+ param.m_bMaximize = true;
CFX_RectF rtFocus(rtItem);
param.m_pData = &rtFocus;
if (m_pVertScrollBar && !m_pHorzScrollBar &&
@@ -672,7 +669,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
param.m_pGraphics = pGraphics;
param.m_matrix.Concat(*pMatrix);
param.m_rtPart = rtDIB;
- param.m_dwData = (uint32_t)(uintptr_t)(&itemData);
+ param.m_bMaximize = true;
param.m_pImage = pDib;
pTheme->DrawBackground(&param);
}
@@ -694,7 +691,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
}
param.m_matrix.Concat(*pMatrix);
param.m_rtPart = rtCheck;
- param.m_dwData = (uint32_t)(uintptr_t)(&itemData);
+ param.m_bMaximize = true;
pTheme->DrawBackground(&param);
}
CFX_WideString wsText;
@@ -717,7 +714,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
textParam.m_wsText = wsText;
textParam.m_dwTTOStyles = m_dwTTOStyles;
textParam.m_iTTOAlign = m_iTTOAligns;
- textParam.m_dwData = (uint32_t)(uintptr_t)(&itemData);
+ textParam.m_bMaximize = true;
pTheme->DrawText(&textParam);
}
}
@@ -751,7 +748,7 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
itemPart.m_pWidget = m_pInterface;
itemPart.m_iPart = CFWL_Part::ListItem;
itemPart.m_pData = m_pProperties->m_pDataProvider;
- itemPart.m_dwData = i;
+ itemPart.m_bMaximize = i > 0;
CFX_RectF r;
m_pProperties->m_pThemeProvider->GetPartRect(&itemPart, r);
if (!bAutoSize) {
diff --git a/xfa/fwl/basewidget/ifwl_edit.h b/xfa/fwl/basewidget/ifwl_edit.h
index eb8c77b8a6..3b25eaf548 100644
--- a/xfa/fwl/basewidget/ifwl_edit.h
+++ b/xfa/fwl/basewidget/ifwl_edit.h
@@ -48,8 +48,6 @@
#define FWL_STYLEEXT_EDT_ShowScrollbarFocus (1L << 25)
#define FWL_STYLEEXT_EDT_OuterScrollbar (1L << 26)
#define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27)
-#define FWL_PARTDATA_EDT_Background 0
-#define FWL_PARTDATA_EDT_StaticBackground 1
typedef struct FWL_HEDTFIND_ { void* pData; } * FWL_HEDTFIND;
diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h
index 87d11a3c56..d32b020810 100644
--- a/xfa/fwl/basewidget/ifwl_listbox.h
+++ b/xfa/fwl/basewidget/ifwl_listbox.h
@@ -34,12 +34,6 @@
typedef struct FWL_HLISTITEM_ { void* pData; } * FWL_HLISTITEM;
class CFX_DIBitmap;
-class IFWL_ListBoxDP;
-
-struct FWL_ListBoxItemData {
- IFWL_ListBoxDP* pDataProvider;
- int32_t iIndex;
-};
BEGIN_FWL_EVENT_DEF(CFWL_EvtLtbSelChanged, CFWL_EventType::SelectChanged)
CFX_Int32Array iarraySels;
diff --git a/xfa/fwl/core/cfwl_themepart.h b/xfa/fwl/core/cfwl_themepart.h
index df75a94f85..5bdf1530a5 100644
--- a/xfa/fwl/core/cfwl_themepart.h
+++ b/xfa/fwl/core/cfwl_themepart.h
@@ -85,7 +85,8 @@ class CFWL_ThemePart {
: m_pWidget(nullptr),
m_iPart(CFWL_Part::None),
m_dwStates(CFWL_PartState_Normal),
- m_dwData(0),
+ m_bMaximize(false),
+ m_bStaticBackground(false),
m_pData(nullptr) {
m_rtPart.Reset();
m_matrix.SetIdentity();
@@ -96,7 +97,8 @@ class CFWL_ThemePart {
IFWL_Widget* m_pWidget;
CFWL_Part m_iPart;
uint32_t m_dwStates;
- uint32_t m_dwData;
+ bool m_bMaximize;
+ bool m_bStaticBackground;
void* m_pData;
};
diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp
index 34663d7e0d..539a48dde0 100644
--- a/xfa/fwl/core/fwl_formimp.cpp
+++ b/xfa/fwl/core/fwl_formimp.cpp
@@ -330,7 +330,7 @@ FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics,
param.m_dwStates = CFWL_PartState_Hovered;
}
param.m_rtPart = m_pMaxBox->m_rtBtn;
- param.m_dwData = m_bMaximized;
+ param.m_bMaximize = m_bMaximized;
pTheme->DrawBackground(&param);
}
if (m_pMinBox) {
@@ -358,7 +358,7 @@ FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics,
param.m_iPart = CFWL_Part::MaximizeBox;
param.m_dwStates = m_pMaxBox->GetPartState();
param.m_rtPart = m_pMaxBox->m_rtBtn;
- param.m_dwData = m_bMaximized;
+ param.m_bMaximize = m_bMaximized;
pTheme->DrawBackground(&param);
}
if (m_pMinBox) {
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp
index 8f060ee6bf..e557e6606b 100644
--- a/xfa/fwl/theme/cfwl_edittp.cpp
+++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -43,14 +43,12 @@ FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) {
&pParams->m_matrix);
pGraphics->RestoreGraphState();
} else {
- FX_BOOL bStatic =
- pParams->m_dwData == FWL_PARTDATA_EDT_StaticBackground;
CFX_Path path;
path.Create();
path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top,
pParams->m_rtPart.width, pParams->m_rtPart.height);
CFX_Color cr(FWLTHEME_COLOR_Background);
- if (!bStatic) {
+ if (!pParams->m_bStaticBackground) {
if (pParams->m_dwStates & CFWL_PartState_Disabled)
cr.Set(FWLTHEME_COLOR_EDGERB1);
else if (pParams->m_dwStates & CFWL_PartState_ReadOnly)
diff --git a/xfa/fwl/theme/cfwl_formtp.cpp b/xfa/fwl/theme/cfwl_formtp.cpp
index 65d070b6b7..6fd3453e69 100644
--- a/xfa/fwl/theme/cfwl_formtp.cpp
+++ b/xfa/fwl/theme/cfwl_formtp.cpp
@@ -137,7 +137,7 @@ FX_BOOL CFWL_FormTP::DrawBackground(CFWL_ThemeBackground* pParams) {
}
case CFWL_Part::MaximizeBox: {
DrawMaximizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState,
- pParams->m_dwData, &pParams->m_matrix, iActive);
+ pParams->m_bMaximize, &pParams->m_matrix, iActive);
break;
}
case CFWL_Part::Icon: {
@@ -515,7 +515,7 @@ void CFWL_FormTP::DrawMinimizeBox(CFX_Graphics* pGraphics,
void CFWL_FormTP::DrawMaximizeBox(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_STATE eState,
- FX_BOOL bMax,
+ bool bMax,
CFX_Matrix* pMatrix,
int32_t iActive) {
DrawMinMaxBoxCommon(pGraphics, pRect, eState, pMatrix);
diff --git a/xfa/fwl/theme/cfwl_formtp.h b/xfa/fwl/theme/cfwl_formtp.h
index 24eaed8f85..6086eca80e 100644
--- a/xfa/fwl/theme/cfwl_formtp.h
+++ b/xfa/fwl/theme/cfwl_formtp.h
@@ -67,7 +67,7 @@ class CFWL_FormTP : public CFWL_WidgetTP {
void DrawMaximizeBox(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_STATE eState,
- FX_BOOL bMax,
+ bool bMax,
CFX_Matrix* pMatrix,
int32_t iActive = 0);
void DrawIconImage(CFX_Graphics* pGraphics,