summaryrefslogtreecommitdiff
path: root/xfa/fwl/basewidget/fwl_editimp.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-08-04 16:37:48 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-04 16:37:48 -0700
commit1b4f6b36b3ed8d1f6cea96bc32c1b376f4a499bc (patch)
treeaa3ba6730495096411f2a3555c74e83f5d1fca11 /xfa/fwl/basewidget/fwl_editimp.cpp
parent52a5005c453a9e08384e375ae51c5f1ad628fe86 (diff)
downloadpdfium-1b4f6b36b3ed8d1f6cea96bc32c1b376f4a499bc.tar.xz
Use smart pointers for class owned pointers
For classes under xfa/fgas, xfa/fwl/basewidget, and xfa/fwl/core, use smart pointers instead of raw pointer to make memory management easier. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2207093005
Diffstat (limited to 'xfa/fwl/basewidget/fwl_editimp.cpp')
-rw-r--r--xfa/fwl/basewidget/fwl_editimp.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp
index ae0b7bcc9f..104054f4e1 100644
--- a/xfa/fwl/basewidget/fwl_editimp.cpp
+++ b/xfa/fwl/basewidget/fwl_editimp.cpp
@@ -203,7 +203,6 @@ CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties,
m_fVAlignOffset(0.0f),
m_fScrollOffsetX(0.0f),
m_fScrollOffsetY(0.0f),
- m_pEdtEngine(nullptr),
m_bLButtonDown(FALSE),
m_nSelStart(0),
m_nLimit(-1),
@@ -223,7 +222,6 @@ CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties,
}
CFWL_EditImp::~CFWL_EditImp() {
- delete m_pEdtEngine;
ClearRecord();
}
@@ -898,26 +896,27 @@ void CFWL_EditImp::On_TextChanged(CFDE_TxtEdtEngine* pEdit,
LayoutScrollBar();
Repaint(&rtTemp);
}
+
void CFWL_EditImp::On_SelChanged(CFDE_TxtEdtEngine* pEdit) {
CFX_RectF rtTemp;
GetClientRect(rtTemp);
Repaint(&rtTemp);
}
+
FX_BOOL CFWL_EditImp::On_PageLoad(CFDE_TxtEdtEngine* pEdit,
int32_t nPageIndex,
int32_t nPurpose) {
- CFDE_TxtEdtEngine* pEdtEngine = m_pEdtEngine;
- IFDE_TxtEdtPage* pPage = pEdtEngine->GetPage(nPageIndex);
+ IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(nPageIndex);
if (!pPage)
return FALSE;
pPage->LoadPage(nullptr, nullptr);
return TRUE;
}
+
FX_BOOL CFWL_EditImp::On_PageUnload(CFDE_TxtEdtEngine* pEdit,
int32_t nPageIndex,
int32_t nPurpose) {
- CFDE_TxtEdtEngine* pEdtEngine = m_pEdtEngine;
- IFDE_TxtEdtPage* pPage = pEdtEngine->GetPage(nPageIndex);
+ IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(nPageIndex);
if (!pPage)
return FALSE;
pPage->UnloadPage(nullptr);
@@ -1630,7 +1629,7 @@ void CFWL_EditImp::InitScrollBar(FX_BOOL bVert) {
void CFWL_EditImp::InitEngine() {
if (!m_pEdtEngine)
- m_pEdtEngine = new CFDE_TxtEdtEngine;
+ m_pEdtEngine.reset(new CFDE_TxtEdtEngine);
}
FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget,