From 0ed26b29690bf65055ee40e611bb3f58c428d4f8 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 21 Nov 2016 11:15:32 -0800 Subject: Remove theme id from themeproviders The theme ID is never set, so it's always 0. This CL removes the Set/Get methods and updates the code to use 0 in place of m_dwThemeId. Review-Url: https://codereview.chromium.org/2519113002 --- xfa/fwl/theme/cfwl_checkboxtp.cpp | 6 ------ xfa/fwl/theme/cfwl_checkboxtp.h | 1 - xfa/fwl/theme/cfwl_comboboxtp.cpp | 4 +--- xfa/fwl/theme/cfwl_edittp.cpp | 2 +- xfa/fwl/theme/cfwl_listboxtp.cpp | 2 +- xfa/fwl/theme/cfwl_monthcalendartp.cpp | 7 ------- xfa/fwl/theme/cfwl_monthcalendartp.h | 1 - xfa/fwl/theme/cfwl_pushbuttontp.cpp | 5 ----- xfa/fwl/theme/cfwl_pushbuttontp.h | 1 - xfa/fwl/theme/cfwl_scrollbartp.cpp | 7 ------- xfa/fwl/theme/cfwl_scrollbartp.h | 1 - xfa/fwl/theme/cfwl_widgettp.cpp | 30 +++++++----------------------- xfa/fwl/theme/cfwl_widgettp.h | 3 --- 13 files changed, 10 insertions(+), 60 deletions(-) (limited to 'xfa/fwl/theme') diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index da3790a1df..731790c616 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -39,12 +39,6 @@ bool CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::CheckBox; } -uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) { - if (m_pThemeData) - SetThemeData(FWL_GetThemeColor(dwThemeID)); - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); -} - void CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { if (!m_pTextOut) return; diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h index 37a8686170..b04262edc2 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.h +++ b/xfa/fwl/theme/cfwl_checkboxtp.h @@ -21,7 +21,6 @@ class CFWL_CheckBoxTP : public CFWL_WidgetTP { void Initialize() override; void Finalize() override; bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; void DrawText(CFWL_ThemeText* pParams) override; void DrawBackground(CFWL_ThemeBackground* pParams) override; diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp index cdb892dc05..3a4b88036b 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.cpp +++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp @@ -19,9 +19,7 @@ const float kComboFormHandler = 8.0f; } // namespace -CFWL_ComboBoxTP::CFWL_ComboBoxTP() { - m_dwThemeID = 0; -} +CFWL_ComboBoxTP::CFWL_ComboBoxTP() {} CFWL_ComboBoxTP::~CFWL_ComboBoxTP() {} diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index 45d097dbfc..a83b1b4bdf 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp @@ -54,7 +54,7 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (pParams->m_pPath) { CFX_Graphics* pGraphics = pParams->m_pGraphics; pGraphics->SaveGraphState(); - CFX_Color crSelected(FWL_GetThemeColor(m_dwThemeID) == 0 + CFX_Color crSelected(FWL_GetThemeColor(0) == 0 ? FWLTHEME_COLOR_BKSelected : FWLTHEME_COLOR_Green_BKSelected); pGraphics->SetFillColor(&crSelected); diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp index 304c3a8397..3731097f24 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.cpp +++ b/xfa/fwl/theme/cfwl_listboxtp.cpp @@ -85,7 +85,7 @@ void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics, CFX_Matrix* pMatrix) { if (dwStates & CFWL_PartState_Selected) { pGraphics->SaveGraphState(); - CFX_Color crFill(FWL_GetThemeColor(m_dwThemeID) == 0 + CFX_Color crFill(FWL_GetThemeColor(0) == 0 ? FWLTHEME_COLOR_BKSelected : FWLTHEME_COLOR_Green_BKSelected); pGraphics->SetFillColor(&crFill); diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index b50d492ade..402b237b21 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp @@ -59,13 +59,6 @@ bool CFWL_MonthCalendarTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::MonthCalendar; } -uint32_t CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID) { - if (m_pThemeData) - SetThemeData(FWL_GetThemeColor(dwThemeID)); - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); -} - void CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return; diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h index 7feb0f337a..5e30bf272b 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.h +++ b/xfa/fwl/theme/cfwl_monthcalendartp.h @@ -20,7 +20,6 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP { void Initialize() override; void Finalize() override; bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; void DrawBackground(CFWL_ThemeBackground* pParams) override; void DrawText(CFWL_ThemeText* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index 20446da54b..f5c5004f07 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp @@ -24,11 +24,6 @@ CFWL_PushButtonTP::~CFWL_PushButtonTP() {} bool CFWL_PushButtonTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::PushButton; } -uint32_t CFWL_PushButtonTP::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID) { - SetThemeData(FWL_GetThemeColor(dwThemeID)); - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); -} void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { switch (pParams->m_iPart) { diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h index 317d0d2336..db17e9cac6 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.h +++ b/xfa/fwl/theme/cfwl_pushbuttontp.h @@ -20,7 +20,6 @@ class CFWL_PushButtonTP : public CFWL_WidgetTP { void Initialize() override; void Finalize() override; bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; void DrawBackground(CFWL_ThemeBackground* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index 5a1ae5cfb6..f966d2de99 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -38,13 +38,6 @@ void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart, return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); } -uint32_t CFWL_ScrollBarTP::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID) { - if (m_pThemeData) - SetThemeData(FWL_GetThemeColor(dwThemeID)); - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); -} - void CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return; diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h index 128eeb4d76..839a71b034 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.h +++ b/xfa/fwl/theme/cfwl_scrollbartp.h @@ -18,7 +18,6 @@ class CFWL_ScrollBarTP : public CFWL_WidgetTP { // CFWL_WidgetTP bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; void DrawBackground(CFWL_ThemeBackground* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 9eb598bc8c..2b713979ba 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -41,18 +41,6 @@ bool CFWL_WidgetTP::IsValidWidget(IFWL_Widget* pWidget) { return false; } -uint32_t CFWL_WidgetTP::GetThemeID(IFWL_Widget* pWidget) { - return m_dwThemeID; -} - -uint32_t CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) { - uint32_t dwOld = m_dwThemeID; - m_dwThemeID = dwThemeID; - if (CFWL_ArrowData::HasInstance()) - CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(dwThemeID)); - return dwOld; -} - void CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) {} void CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { @@ -112,8 +100,7 @@ void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, return m_pFDEFont; } case CFWL_WidgetCapacity::TextSelColor: { - m_dwValue = (m_dwThemeID == 0) ? FWLTHEME_CAPACITY_TextSelColor - : FWLTHEME_COLOR_Green_BKSelected; + m_dwValue = FWLTHEME_CAPACITY_TextSelColor; return &m_dwValue; } case CFWL_WidgetCapacity::LineHeight: { @@ -131,7 +118,7 @@ void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, } bool CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { - return !!FWL_GetThemeLayout(m_dwThemeID); + return !!FWL_GetThemeLayout(0); } void CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { @@ -144,9 +131,7 @@ void CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { pParams->m_wsText.GetLength(), rect); } -void CFWL_WidgetTP::Initialize() { - m_dwThemeID = 0; -} +void CFWL_WidgetTP::Initialize() {} void CFWL_WidgetTP::Finalize() { if (!m_pTextOut) @@ -184,8 +169,7 @@ CFGAS_GEFont* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) { return m_pFDEFont; } -CFWL_WidgetTP::CFWL_WidgetTP() - : m_dwRefCount(1), m_pFDEFont(nullptr), m_dwThemeID(0) {} +CFWL_WidgetTP::CFWL_WidgetTP() : m_dwRefCount(1), m_pFDEFont(nullptr) {} void CFWL_WidgetTP::InitTTO() { if (m_pTextOut) @@ -213,7 +197,7 @@ void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, if (!pRect) return; pGraphics->SaveGraphState(); - CFX_Color crStroke(FWL_GetThemeColor(m_dwThemeID) == 0 + CFX_Color crStroke(FWL_GetThemeColor(0) == 0 ? ArgbEncode(255, 127, 157, 185) : FWLTHEME_COLOR_Green_BKSelected); pGraphics->SetStrokeColor(&crStroke); @@ -611,7 +595,7 @@ void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics, CFX_Path path; path.Create(); if (!CFWL_ArrowData::HasInstance()) { - CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); + CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(0)); } CFWL_ArrowData::CColorData* pColorData = CFWL_ArrowData::GetInstance()->m_pColorData.get(); @@ -635,7 +619,7 @@ void CFWL_WidgetTP::DrawArrowBtn(CFX_Graphics* pGraphics, CFX_Matrix* pMatrix) { DrawBtn(pGraphics, pRect, eState, pMatrix); if (!CFWL_ArrowData::HasInstance()) { - CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); + CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(0)); } CFWL_ArrowData::CColorData* pColorData = CFWL_ArrowData::GetInstance()->m_pColorData.get(); diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index 4a9ef1347b..b269fb2b04 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -111,8 +111,6 @@ class CFWL_WidgetTP { virtual void Finalize(); virtual bool IsValidWidget(IFWL_Widget* pWidget); - virtual uint32_t GetThemeID(IFWL_Widget* pWidget); - virtual uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID); virtual void DrawBackground(CFWL_ThemeBackground* pParams); virtual void DrawText(CFWL_ThemeText* pParams); @@ -218,7 +216,6 @@ class CFWL_WidgetTP { FX_FLOAT m_fValue; uint32_t m_dwValue; CFX_RectF m_rtMargin; - uint32_t m_dwThemeID; }; void FWLTHEME_Release(); -- cgit v1.2.3