From a54bc400fa69491ad72ad97f74742ec28cbe849a Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 27 May 2016 11:13:09 -0700 Subject: Add back-pointer to "Associated widget" to CFWL_WidgetImp. This is the last use of CFX_PrivateData, which is now removed. Review-Url: https://codereview.chromium.org/2016743002 --- xfa/fwl/lightwidget/cfwl_widget.cpp | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'xfa/fwl/lightwidget') diff --git a/xfa/fwl/lightwidget/cfwl_widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp index 239796d03a..8022f0afb0 100644 --- a/xfa/fwl/lightwidget/cfwl_widget.cpp +++ b/xfa/fwl/lightwidget/cfwl_widget.cpp @@ -41,12 +41,11 @@ FX_BOOL CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { return m_pIface->IsInstance(wsClass); } -static void* gs_pFWLWidget = (void*)FXBSTR_ID('l', 'i', 'g', 't'); - FWL_Error CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) { if (!m_pIface) return FWL_Error::Indefinite; - return m_pIface->SetPrivateData(gs_pFWLWidget, this, nullptr); + m_pIface->SetAssociateWidget(this); + return FWL_Error::Succeeded; } FWL_Error CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { @@ -78,9 +77,10 @@ CFWL_Widget* CFWL_Widget::GetParent() { return nullptr; IFWL_Widget* parent = m_pIface->GetParent(); - if (parent) - return static_cast(parent->GetPrivateData(gs_pFWLWidget)); - return nullptr; + if (!parent) + return nullptr; + + return static_cast(parent->GetAssociateWidget()); } FWL_Error CFWL_Widget::SetParent(CFWL_Widget* pParent) { @@ -141,20 +141,6 @@ void CFWL_Widget::SetLayoutItem(void* pItem) { m_pIface->SetLayoutItem(pItem); } -FWL_Error CFWL_Widget::SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->SetPrivateData(module_id, pData, callback); -} - -void* CFWL_Widget::GetPrivateData(void* module_id) { - if (!m_pIface) - return nullptr; - return m_pIface->GetPrivateData(module_id); -} - FWL_Error CFWL_Widget::Update() { if (!m_pIface) return FWL_Error::Indefinite; -- cgit v1.2.3