From 54ab2343c338f55735c37ed6751040791e1df1e2 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 26 May 2016 17:35:54 -0700 Subject: Add opaque "layout item" to widgets for caller's use. This avoids another use of CFX_PrivateData. Note that in the old code, we'd be calling through a m_pImpl onto the same underlying object as we passed as the "key" argument when setting the value, which explains why the get calls, happening one object lower, pass the same argument as which they are being inovked against. Review-Url: https://codereview.chromium.org/2010923002 --- xfa/fxfa/app/xfa_fwltheme.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'xfa/fxfa/app/xfa_fwltheme.cpp') diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index df09fb504a..14649f1b80 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -35,14 +35,13 @@ const FX_WCHAR* const g_FWLTheme_CalFonts[] = { CXFA_FFWidget* XFA_ThemeGetOuterWidget(IFWL_Widget* pWidget) { IFWL_Widget* pOuter = pWidget; - while (pOuter->GetOuter()) { + while (pOuter && pOuter->GetOuter()) pOuter = pOuter->GetOuter(); - } - if (pOuter) { - return (CXFA_FFWidget*)pOuter->GetPrivateData(pOuter); - } - return NULL; + + return pOuter ? static_cast(pOuter->GetLayoutItem()) + : nullptr; } + CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) : m_pApp(pApp) { m_dwCapacity = 0; m_fCapacity = 0; -- cgit v1.2.3