From c635c93c974db1c55032c36e81e98f3d214a249f Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 3 Jan 2017 15:46:55 -0500 Subject: Remove the ::GetCapacity methods. The GetCapacity methods return a void* because they return different types of internal class memory based on what the calling parameter was. This is confusing and makes it difficult to tell when then enum values can be removed. This CL removes GetCapacity and adds methods as needed to get the real values. Change-Id: I64c2edc858220624880e27f4ed49c2dae080f462 Reviewed-on: https://pdfium-review.googlesource.com/2137 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fwl/cfwl_listbox.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'xfa/fwl/cfwl_listbox.cpp') diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index d79e48991e..a7a568cd14 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp @@ -477,12 +477,12 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { CFX_RectF rtUIMargin; rtUIMargin.Set(0, 0, 0, 0); if (!m_pOuter) { - CFX_RectF* pUIMargin = static_cast( - GetThemeCapacity(CFWL_WidgetCapacity::UIMargin)); - if (pUIMargin) { - m_rtConent.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, - pUIMargin->height); - } + CFWL_ThemePart part; + part.m_pWidget = this; + IFWL_ThemeProvider* theme = GetAvailableTheme(); + CFX_RectF pUIMargin = theme ? theme->GetUIMargin(&part) : CFX_RectF(); + m_rtConent.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width, + pUIMargin.height); } FX_FLOAT fWidth = GetMaxTextWidth(); @@ -612,19 +612,15 @@ FX_FLOAT CFWL_ListBox::GetMaxTextWidth() { } FX_FLOAT CFWL_ListBox::GetScrollWidth() { - FX_FLOAT* pfWidth = static_cast( - GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); - if (!pfWidth) - return 0; - return *pfWidth; + IFWL_ThemeProvider* theme = GetAvailableTheme(); + return theme ? theme->GetScrollBarWidth() : 0.0f; } FX_FLOAT CFWL_ListBox::CalcItemHeight() { - FX_FLOAT* pfFont = - static_cast(GetThemeCapacity(CFWL_WidgetCapacity::FontSize)); - if (!pfFont) - return 20; - return *pfFont + 2 * kItemTextMargin; + IFWL_ThemeProvider* theme = GetAvailableTheme(); + CFWL_ThemePart part; + part.m_pWidget = this; + return (theme ? theme->GetFontSize(&part) : 20.0f) + 2 * kItemTextMargin; } void CFWL_ListBox::InitVerticalScrollBar() { -- cgit v1.2.3