diff options
author | tsepez <tsepez@chromium.org> | 2016-04-27 15:28:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-27 15:28:25 -0700 |
commit | b174aa37b6a99461dc581c63a93a1d706705dd16 (patch) | |
tree | 90167be30ea92203dfc48564af5c408cbcd1e4bd /xfa/fwl | |
parent | 590f2d9e057a0d5b17a9706affd3c6115265021b (diff) | |
download | pdfium-b174aa37b6a99461dc581c63a93a1d706705dd16.tar.xz |
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
Diffstat (limited to 'xfa/fwl')
-rw-r--r-- | xfa/fwl/basewidget/fwl_datetimepickerimp.cpp | 10 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_monthcalendarimp.h | 4 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_noteimp.cpp | 11 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_noteimp.h | 3 |
4 files changed, 15 insertions, 13 deletions
diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp index c70ad691a4..94fa549fe4 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp @@ -311,11 +311,10 @@ void CFWL_DateTimeCalendarImpDelegate::OnLButtonUpEx(CFWL_MsgMouse* pMsg) { pPicker->m_pForm->GetWidgetRect(rt); rt.Set(0, 0, rt.width, rt.height); if (iCurSel > 0) { - FWL_DATEINFO* lpDatesInfo = - (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iCurSel - 1); + FWL_DATEINFO* lpDatesInfo = m_pOwner->m_arrDates.GetAt(iCurSel - 1); CFX_RectF rtInvalidate(lpDatesInfo->rect); if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) { - lpDatesInfo = (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iOldSel - 1); + lpDatesInfo = m_pOwner->m_arrDates.GetAt(iOldSel - 1); rtInvalidate.Union(lpDatesInfo->rect); } m_pOwner->AddSelDay(iCurSel); @@ -406,11 +405,10 @@ void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx( } int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); if (iCurSel > 0) { - FWL_DATEINFO* lpDatesInfo = - (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iCurSel - 1); + FWL_DATEINFO* lpDatesInfo = m_pOwner->m_arrDates.GetAt(iCurSel - 1); CFX_RectF rtInvalidate(lpDatesInfo->rect); if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) { - lpDatesInfo = (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iOldSel - 1); + lpDatesInfo = m_pOwner->m_arrDates.GetAt(iOldSel - 1); rtInvalidate.Union(lpDatesInfo->rect); } m_pOwner->AddSelDay(iCurSel); diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.h b/xfa/fwl/basewidget/fwl_monthcalendarimp.h index c67848fd1d..a7deb9a098 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.h +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.h @@ -15,6 +15,8 @@ class CFWL_MsgMouse; class CFWL_WidgetImpProperties; class IFWL_Widget; +struct FWL_DATEINFO; + extern uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth); class CFWL_MonthCalendarImp : public CFWL_WidgetImp { @@ -160,7 +162,7 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp { CFX_WideString m_wsHead; CFX_WideString m_wsToday; CFX_DateTime* m_pDateTime; - CFX_PtrArray m_arrDates; + CFX_ArrayTemplate<FWL_DATEINFO*> m_arrDates; int32_t m_iCurYear; int32_t m_iCurMonth; int32_t m_iYear; 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<CFWL_NoteLoop*>(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<CFWL_WidgetMgr*>(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<CFWL_TargetImp*> m_forms; CFX_PtrArray m_noteQueue; CFX_PtrArray m_noteLoopQueue; CFX_MapPtrToPtr m_eventTargets; |