summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/fwl_noteimp.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-01 08:33:02 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-01 08:33:02 -0700
commit9ec22175f945d227e71c459e7e0b7c464159c18b (patch)
tree1c4836aa35a9e8a1da1761562088b1f9df6aa94f /xfa/fwl/core/fwl_noteimp.cpp
parent5a22582ca1dbe1d66b18d5253bfa1d202fcc3b4a (diff)
downloadpdfium-9ec22175f945d227e71c459e7e0b7c464159c18b.tar.xz
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
Diffstat (limited to 'xfa/fwl/core/fwl_noteimp.cpp')
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp17
1 files changed, 7 insertions, 10 deletions
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) {