From a4fbc2814c231da29104bb8922811127a59bd6e7 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 20 Apr 2015 15:12:39 -0700 Subject: Remove Release() from IFX_Edit_UndoItem. Also delete unused CFFL_Edit_UndoItem class. BUG=https://code.google.com/p/pdfium/issues/detail?id=140 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1098043002 --- fpdfsdk/include/formfiller/FFL_TextField.h | 16 +--------------- fpdfsdk/include/fxedit/fx_edit.h | 6 ++---- fpdfsdk/include/fxedit/fxet_edit.h | 17 ++++++----------- fpdfsdk/src/formfiller/FFL_TextField.cpp | 29 ----------------------------- fpdfsdk/src/fxedit/fxet_edit.cpp | 25 ++++--------------------- 5 files changed, 13 insertions(+), 80 deletions(-) diff --git a/fpdfsdk/include/formfiller/FFL_TextField.h b/fpdfsdk/include/formfiller/FFL_TextField.h index e31a9e5462..58ac5943eb 100644 --- a/fpdfsdk/include/formfiller/FFL_TextField.h +++ b/fpdfsdk/include/formfiller/FFL_TextField.h @@ -15,19 +15,6 @@ class CBA_FontMap; - -class CFFL_EditUndoItem -{ -public: - CFFL_EditUndoItem(CPWL_Edit* pEdit); - virtual ~CFFL_EditUndoItem(); - - virtual void Undo(); - virtual void Redo(); - virtual CFX_WideString GetDescr(); - virtual void Release(); -}; - struct FFL_TextFieldState { int nStart; @@ -79,9 +66,8 @@ public: private: CBA_FontMap* m_pFontMap; -// CBA_SpellCheck* m_pSpellCheck; FFL_TextFieldState m_State; -// CFFL_IM_BOX m_IMBox; + }; #endif // !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_) diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h index a842fd6284..bf00995ea9 100644 --- a/fpdfsdk/include/fxedit/fx_edit.h +++ b/fpdfsdk/include/fxedit/fx_edit.h @@ -164,13 +164,11 @@ public: class IFX_Edit_UndoItem { public: - virtual void Release() = 0; + virtual ~IFX_Edit_UndoItem() { } + virtual void Undo() = 0; virtual void Redo() = 0; virtual CFX_WideString GetUndoTitle() = 0; - -protected: - ~IFX_Edit_UndoItem() { } }; class FXET_CLASS IFX_Edit diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h index 8aa44a4bed..9e5c40f5ff 100644 --- a/fpdfsdk/include/fxedit/fxet_edit.h +++ b/fpdfsdk/include/fxedit/fxet_edit.h @@ -325,12 +325,9 @@ class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { public: CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {} - virtual ~CFX_Edit_UndoItem(){} - virtual CFX_WideString GetUndoTitle() {return L"";} - virtual void Release(){delete this;} + CFX_WideString GetUndoTitle() override { return L""; } -public: void SetFirst(FX_BOOL bFirst){m_bFirst = bFirst;} FX_BOOL IsFirst(){return m_bFirst;} void SetLast(FX_BOOL bLast){m_bLast = bLast;} @@ -345,17 +342,15 @@ class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem { public: CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle); - virtual ~CFX_Edit_GroupUndoItem(); + ~CFX_Edit_GroupUndoItem() override; + + void Undo() override; + void Redo() override; + CFX_WideString GetUndoTitle() override; void AddUndoItem(CFX_Edit_UndoItem* pUndoItem); void UpdateItems(); -public: - virtual void Undo(); - virtual void Redo(); - virtual CFX_WideString GetUndoTitle(); - virtual void Release(); - private: CFX_WideString m_sTitle; CFX_ArrayTemplate m_Items; diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp index 6a70981e4f..f45d95364d 100644 --- a/fpdfsdk/src/formfiller/FFL_TextField.cpp +++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp @@ -4,37 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -//#include "../include/FormFiller.h" -//#include "../include/FFL_FormFiller.h" #include "../../include/formfiller/FFL_TextField.h" #include "../../include/formfiller/FFL_CBA_Fontmap.h" -//#include "../include/FFL_Notify.h" - -CFFL_EditUndoItem::CFFL_EditUndoItem(CPWL_Edit* pEdit) -{ -} - -CFFL_EditUndoItem::~CFFL_EditUndoItem() -{ -} - -void CFFL_EditUndoItem::Undo() -{ -} - -void CFFL_EditUndoItem::Redo() -{ -} - -CFX_WideString CFFL_EditUndoItem::GetDescr() -{ - return L"Input"; -} - -void CFFL_EditUndoItem::Release() -{ - delete this; -} /* ------------------------------- CFFL_TextField ------------------------------- */ diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp index 2d25ba3383..c7f7ce5b04 100644 --- a/fpdfsdk/src/fxedit/fxet_edit.cpp +++ b/fpdfsdk/src/fxedit/fxet_edit.cpp @@ -453,10 +453,7 @@ void CFX_Edit_Undo::RemoveHeads() { ASSERT(m_UndoItemStack.GetSize() > 1); - IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(0); - ASSERT(pItem != NULL); - - pItem->Release(); + delete m_UndoItemStack.GetAt(0); m_UndoItemStack.RemoveAt(0); } @@ -464,10 +461,7 @@ void CFX_Edit_Undo::RemoveTails() { for (FX_INT32 i = m_UndoItemStack.GetSize()-1; i >= m_nCurUndoPos; i--) { - IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(i); - ASSERT(pItem != NULL); - - pItem->Release(); + delete m_UndoItemStack.GetAt(i); m_UndoItemStack.RemoveAt(i); } } @@ -476,10 +470,7 @@ void CFX_Edit_Undo::Reset() { for (FX_INT32 i=0, sz=m_UndoItemStack.GetSize(); i < sz; i++) { - IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(i); - ASSERT(pItem != NULL); - - pItem->Release(); + delete m_UndoItemStack.GetAt(i); } m_nCurUndoPos = 0; m_UndoItemStack.RemoveAll(); @@ -495,10 +486,7 @@ CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() { for (int i=0,sz=m_Items.GetSize(); iRelease(); + delete m_Items[i]; } m_Items.RemoveAll(); @@ -558,11 +546,6 @@ CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() return m_sTitle; } -void CFX_Edit_GroupUndoItem::Release() -{ - delete this; -} - /* ------------------------------------- CFX_Edit_UndoItem derived classes ------------------------------------- */ CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, -- cgit v1.2.3