Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1210)

Unified Diff: fpdfsdk/cpdfsdk_pageview.cpp

Issue 2626073005: Use observed pointers in CPDFSDK_AnnotIterator. (Closed)
Patch Set: remove local Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/cpdfsdk_baannot.h ('k') | fpdfsdk/javascript/Document.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/cpdfsdk_pageview.cpp
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index fedc95a6adb6be351784ea5344a1050b8480cc3b..416adffbe610e4ab614117654adab259a76da2cc 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -15,7 +15,7 @@
#include "core/fpdfdoc/cpdf_interform.h"
#include "fpdfsdk/cpdfsdk_annot.h"
#include "fpdfsdk/cpdfsdk_annothandlermgr.h"
-#include "fpdfsdk/cpdfsdk_annotiterator.h"
+#include "fpdfsdk/cpdfsdk_annotiteration.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_interform.h"
#include "third_party/base/ptr_util.h"
@@ -124,48 +124,44 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
#endif // PDF_ENABLE_XFA
// for pdf/static xfa.
- CPDFSDK_AnnotIterator annotIterator(this, true);
- while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
- m_pFormFillEnv->GetAnnotHandlerMgr();
- pAnnotHandlerMgr->Annot_OnDraw(this, pSDKAnnot, pDevice, pUser2Device,
- pOptions->m_bDrawAnnots);
+ CPDFSDK_AnnotIteration annotIteration(this, true);
+ for (const auto& pSDKAnnot : annotIteration) {
+ m_pFormFillEnv->GetAnnotHandlerMgr()->Annot_OnDraw(
+ this, pSDKAnnot.Get(), pDevice, pUser2Device, pOptions->m_bDrawAnnots);
}
}
CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX,
FX_FLOAT pageY) {
CPDFSDK_AnnotHandlerMgr* pAnnotMgr = m_pFormFillEnv->GetAnnotHandlerMgr();
- CPDFSDK_AnnotIterator annotIterator(this, false);
- while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
- CFX_FloatRect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
+ CPDFSDK_AnnotIteration annotIteration(this, false);
+ for (const auto& pSDKAnnot : annotIteration) {
+ CFX_FloatRect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot.Get());
if (pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::POPUP)
continue;
if (rc.Contains(pageX, pageY))
- return pSDKAnnot;
+ return pSDKAnnot.Get();
}
-
return nullptr;
}
CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX,
FX_FLOAT pageY) {
CPDFSDK_AnnotHandlerMgr* pAnnotMgr = m_pFormFillEnv->GetAnnotHandlerMgr();
- CPDFSDK_AnnotIterator annotIterator(this, false);
- while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
+ CPDFSDK_AnnotIteration annotIteration(this, false);
+ for (const auto& pSDKAnnot : annotIteration) {
bool bHitTest = pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET;
#ifdef PDF_ENABLE_XFA
bHitTest = bHitTest ||
pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::XFAWIDGET;
#endif // PDF_ENABLE_XFA
if (bHitTest) {
- pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
+ pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot.Get());
CFX_FloatPoint point(pageX, pageY);
- if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot, point))
- return pSDKAnnot;
+ if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot.Get(), point))
+ return pSDKAnnot.Get();
}
}
-
return nullptr;
}
« no previous file with comments | « fpdfsdk/cpdfsdk_baannot.h ('k') | fpdfsdk/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698