summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-19 17:14:41 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-19 17:14:41 -0700
commitd77f417f0c82f16b4f370b913b80dd2b8dcf0f67 (patch)
tree6ba1f5537ae7122bd888410ae494b37d0e453e62
parentbc2f0c5c4e3bbb5f317c29716c2b94af03c38329 (diff)
downloadpdfium-d77f417f0c82f16b4f370b913b80dd2b8dcf0f67.tar.xz
Remove CFX_MapPtrToPtr in xfa_ffdocview.h
Review-Url: https://codereview.chromium.org/1993313005
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp39
-rw-r--r--xfa/fxfa/include/xfa_ffdocview.h5
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 <map>
+#include <memory>
+
#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<CXFA_FFPageView*, std::unique_ptr<CFX_RectF>> m_mapPageInvalidate;
CFX_ArrayTemplate<CXFA_WidgetAcc*> m_ValidateAccs;
CFX_ArrayTemplate<CXFA_WidgetAcc*> m_CalculateAccs;
CFX_ArrayTemplate<CXFA_Node*> m_BindItems;