From b174aa37b6a99461dc581c63a93a1d706705dd16 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 27 Apr 2016 15:28:25 -0700 Subject: Replace CFX_PtrArray with type-safe CFX_ArrayTemplate<>, Part 1. Ideally, these will become std::vector<>, but in the mean time this is quicker and allow us to remove casts. Doing so has already turned up one place where the wrong type of object was being used. Review-Url: https://codereview.chromium.org/1924073002 --- xfa/fwl/core/fwl_noteimp.cpp | 11 ++++++----- xfa/fwl/core/fwl_noteimp.h | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'xfa/fwl/core') diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index b2e7440761..5cd643a81b 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -698,25 +698,26 @@ FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) { int32_t iTrackLoop = m_noteLoopQueue.GetSize(); if (iTrackLoop <= 0) - return NULL; - IFWL_Widget* pMessageForm = NULL; + return nullptr; + IFWL_Widget* pMessageForm = nullptr; if (iTrackLoop > 1) { CFWL_NoteLoop* pNootLoop = static_cast(m_noteLoopQueue[iTrackLoop - 1]); pMessageForm = pNootLoop->GetForm()->GetInterface(); - } else { - pMessageForm = (m_forms.Find(pDstTarget) < 0) ? NULL : pDstTarget; + } else if (m_forms.Find(pDstTarget->GetImpl()) < 0) { + pMessageForm = pDstTarget; } if (!pMessageForm && pDstTarget) { CFWL_WidgetMgr* pWidgetMgr = static_cast(FWL_GetWidgetMgr()); if (!pWidgetMgr) - return NULL; + return nullptr; pMessageForm = pWidgetMgr->GetWidget(pDstTarget, FWL_WGTRELATION_SystemForm); } return pMessageForm; } + void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) { FX_POSITION pos = m_eventTargets.GetStartPosition(); while (pos) { diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h index 334c70535b..927afd6c9d 100644 --- a/xfa/fwl/core/fwl_noteimp.h +++ b/xfa/fwl/core/fwl_noteimp.h @@ -22,6 +22,7 @@ class CFWL_MsgMouseWheel; class CFWL_MsgSetFocus; class CFWL_MsgSize; class CFWL_MsgWindowMove; +class CFWL_TargetImp; class CFWL_ToolTipImp; class CFWL_WidgetImp; class IFWL_ToolTipTarget; @@ -95,7 +96,7 @@ class CFWL_NoteDriver : public IFWL_NoteDriver { FX_BOOL IsValidMessage(CFWL_Message* pMessage); IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget); void ClearInvalidEventTargets(FX_BOOL bRemoveAll); - CFX_PtrArray m_forms; + CFX_ArrayTemplate m_forms; CFX_PtrArray m_noteQueue; CFX_PtrArray m_noteLoopQueue; CFX_MapPtrToPtr m_eventTargets; -- cgit v1.2.3