From 9ec22175f945d227e71c459e7e0b7c464159c18b Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 1 Nov 2016 08:33:02 -0700 Subject: Rename IFWL_Widget::SetDelegate The ::SetDelegate method was misleading. The primary use was SetDelegate(nullptr) which returned the current delegate and didn't actually set anything. When a value was passed it would set the |m_pCurDelegate| not the |m_pDelegate|. This Cl breaks ::SetDelegate into ::GetCurrentDelegate and ::SetCurrentDelegate to make it clear what is happening and that this does not effect the |m_pDelegate| variable. Review-Url: https://codereview.chromium.org/2459423003 --- xfa/fwl/core/fwl_noteimp.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'xfa/fwl/core/fwl_noteimp.cpp') diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index 318fd9f6fc..22579571d4 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -144,10 +144,8 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { if (bNotify) { ms.m_dwExtend = 1; } - IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(nullptr); - if (pDelegate) { + if (IFWL_WidgetDelegate* pDelegate = pPrev->GetCurrentDelegate()) pDelegate->OnProcessMessage(&ms); - } } if (pFocus) { IFWL_Widget* pWidget = @@ -161,10 +159,9 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { if (bNotify) { ms.m_dwExtend = 1; } - IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(nullptr); - if (pDelegate) { + + if (IFWL_WidgetDelegate* pDelegate = pFocus->GetCurrentDelegate()) pDelegate->OnProcessMessage(&ms); - } } return TRUE; } @@ -363,10 +360,10 @@ FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, } } if (bRet) { - IFWL_WidgetDelegate* pDelegate = - pMessage->m_pDstTarget->SetDelegate(nullptr); - if (pDelegate) + if (IFWL_WidgetDelegate* pDelegate = + pMessage->m_pDstTarget->GetCurrentDelegate()) { pDelegate->OnProcessMessage(pMessage); + } } return bRet; } @@ -710,7 +707,7 @@ int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, } FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { - IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(nullptr); + IFWL_WidgetDelegate* pDelegate = m_pListener->GetCurrentDelegate(); if (!pDelegate) return FALSE; if (m_eventSources.GetCount() == 0) { -- cgit v1.2.3