diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-04-20 13:38:38 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-04-20 13:38:38 -0700 |
commit | 19ae17578f99621100a26dac3e2c7c3dbf7c7cd1 (patch) | |
tree | 0ac0a753395a88ae5f733a8fb465e8b50bfdc26c /fpdfsdk | |
parent | bc580c69403169afa656aabb06a56b26d3b729cf (diff) | |
download | pdfium-19ae17578f99621100a26dac3e2c7c3dbf7c7cd1.tar.xz |
Remove release method from CBA_AnnotItetator.chromium/2377
Also remove virtual methods, since this is neither subclassed nor a
subclass.
BUG=https://code.google.com/p/pdfium/issues/detail?id=140
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1097843003
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/include/fsdk_baseform.h | 23 | ||||
-rw-r--r-- | fpdfsdk/src/fsdk_baseform.cpp | 22 |
2 files changed, 16 insertions, 29 deletions
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index b15fba6475..16a23bfea3 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -261,32 +261,27 @@ private: #define CPDFSDK_Annots CFX_ArrayTemplate<CPDFSDK_Annot*> #define CPDFSDK_SortAnnots CGW_ArrayTemplate<CPDFSDK_Annot*> -class CBA_AnnotIterator +class CBA_AnnotIterator { public: CBA_AnnotIterator(CPDFSDK_PageView* pPageView, const CFX_ByteString& sType, const CFX_ByteString& sSubType); - virtual ~CBA_AnnotIterator(); - - virtual CPDFSDK_Annot* GetFirstAnnot(); - virtual CPDFSDK_Annot* GetLastAnnot(); - virtual CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pAnnot); - virtual CPDFSDK_Annot* GetPrevAnnot(CPDFSDK_Annot* pAnnot); - - virtual void Release(){delete this;} - + ~CBA_AnnotIterator(); + + CPDFSDK_Annot* GetFirstAnnot(); + CPDFSDK_Annot* GetLastAnnot(); + CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pAnnot); + CPDFSDK_Annot* GetPrevAnnot(CPDFSDK_Annot* pAnnot); + private: void GenerateResults(); static int CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2); static int CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2); - static CPDF_Rect GetAnnotRect(CPDFSDK_Annot* pAnnot); - -private: + CPDFSDK_PageView* m_pPageView; CFX_ByteString m_sType; CFX_ByteString m_sSubType; int m_nTabs; - CPDFSDK_Annots m_Annots; }; diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index 6c8069b92a..0c0492d723 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -4,6 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "../../third_party/base/nonstd_unique_ptr.h" #include "../include/fsdk_define.h" #include "../include/fsdk_mgr.h" #include "../include/fsdk_baseannot.h" @@ -1727,22 +1728,13 @@ FX_BOOL CPDFSDK_InterForm::HighlightWidgets() CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const { - ASSERT(pWidget != NULL); - - CBA_AnnotIterator* pIterator = new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", ""); - ASSERT(pIterator != NULL); - - CPDFSDK_Widget* pRet = NULL; - - if (bNext) - pRet = (CPDFSDK_Widget*)pIterator->GetNextAnnot(pWidget); - else - pRet = (CPDFSDK_Widget*)pIterator->GetPrevAnnot(pWidget); - - pIterator->Release(); - - return pRet; + nonstd::unique_ptr<CBA_AnnotIterator> pIterator( + new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", "")); + if (bNext) { + return (CPDFSDK_Widget*)pIterator->GetNextAnnot(pWidget); + } + return (CPDFSDK_Widget*)pIterator->GetPrevAnnot(pWidget); } CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const |