From d77f417f0c82f16b4f370b913b80dd2b8dcf0f67 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 19 May 2016 17:14:41 -0700 Subject: Remove CFX_MapPtrToPtr in xfa_ffdocview.h Review-Url: https://codereview.chromium.org/1993313005 --- xfa/fxfa/app/xfa_ffdocview.cpp | 39 ++++++++++++++------------------------- xfa/fxfa/include/xfa_ffdocview.h | 5 ++++- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index faf5c8baff..d8543fa511 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -540,42 +540,31 @@ FX_BOOL CXFA_FFDocView::IsUpdateLocked() { return m_iLock; } void CXFA_FFDocView::ClearInvalidateList() { - FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); - while (ps) { - void* pPageView = NULL; - CFX_RectF* pRect = NULL; - m_mapPageInvalidate.GetNextAssoc(ps, pPageView, (void*&)pRect); - delete pRect; - } - m_mapPageInvalidate.RemoveAll(); + m_mapPageInvalidate.clear(); } void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate) { AddInvalidateRect(pWidget->GetPageView(), rtInvalidate); } + void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView, const CFX_RectF& rtInvalidate) { - CFX_RectF* pRect = (CFX_RectF*)m_mapPageInvalidate.GetValueAt(pPageView); - if (!pRect) { - pRect = new CFX_RectF; - pRect->Set(rtInvalidate.left, rtInvalidate.top, rtInvalidate.width, - rtInvalidate.height); - m_mapPageInvalidate.SetAt(pPageView, pRect); - } else { - pRect->Union(rtInvalidate); + if (m_mapPageInvalidate[pPageView]) { + m_mapPageInvalidate[pPageView]->Union(rtInvalidate); + return; } + CFX_RectF* pRect = new CFX_RectF; + pRect->Set(rtInvalidate.left, rtInvalidate.top, rtInvalidate.width, + rtInvalidate.height); + m_mapPageInvalidate[pPageView].reset(pRect); } + void CXFA_FFDocView::RunInvalidate() { - FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); - while (ps) { - CXFA_FFPageView* pPageView = NULL; - CFX_RectF* pRect = NULL; - m_mapPageInvalidate.GetNextAssoc(ps, (void*&)pPageView, (void*&)pRect); - m_pDoc->GetDocProvider()->InvalidateRect(pPageView, *pRect); - delete pRect; - } - m_mapPageInvalidate.RemoveAll(); + for (const auto& pair : m_mapPageInvalidate) + m_pDoc->GetDocProvider()->InvalidateRect(pair.first, *pair.second); + m_mapPageInvalidate.clear(); } + FX_BOOL CXFA_FFDocView::RunLayout() { LockUpdate(); m_bInLayoutStatus = TRUE; diff --git a/xfa/fxfa/include/xfa_ffdocview.h b/xfa/fxfa/include/xfa_ffdocview.h index 0210d2a4ff..2117b91589 100644 --- a/xfa/fxfa/include/xfa_ffdocview.h +++ b/xfa/fxfa/include/xfa_ffdocview.h @@ -7,6 +7,9 @@ #ifndef XFA_FXFA_INCLUDE_XFA_FFDOCVIEW_H_ #define XFA_FXFA_INCLUDE_XFA_FFDOCVIEW_H_ +#include +#include + #include "xfa/fxfa/include/xfa_ffdoc.h" class CXFA_FFWidgetHandler; @@ -115,7 +118,7 @@ class CXFA_FFDocView { CXFA_WidgetAcc* m_pFocusAcc; CXFA_FFWidget* m_pFocusWidget; CXFA_FFWidget* m_pOldFocusWidget; - CFX_MapPtrToPtr m_mapPageInvalidate; + std::map> m_mapPageInvalidate; CFX_ArrayTemplate m_ValidateAccs; CFX_ArrayTemplate m_CalculateAccs; CFX_ArrayTemplate m_BindItems; -- cgit v1.2.3