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

Side by Side Diff: xfa/fde/cfde_txtedtengine.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/fpdfdoc_unittest.cpp ('k') | xfa/fde/cfde_txtedtpage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fde/cfde_txtedtengine.h" 7 #include "xfa/fde/cfde_txtedtengine.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() { 76 CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() {
77 RemoveAllParags(); 77 RemoveAllParags();
78 RemoveAllPages(); 78 RemoveAllPages();
79 m_Param.pEventSink = nullptr; 79 m_Param.pEventSink = nullptr;
80 ClearSelection(); 80 ClearSelection();
81 } 81 }
82 82
83 void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) { 83 void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) {
84 if (!m_pTextBreak) 84 if (!m_pTextBreak)
85 m_pTextBreak.reset(new CFX_TxtBreak(FX_TXTBREAKPOLICY_None)); 85 m_pTextBreak = pdfium::MakeUnique<CFX_TxtBreak>(FX_TXTBREAKPOLICY_None);
86 86
87 FXSYS_memcpy(&m_Param, &params, sizeof(FDE_TXTEDTPARAMS)); 87 FXSYS_memcpy(&m_Param, &params, sizeof(FDE_TXTEDTPARAMS));
88 m_wLineEnd = params.wLineBreakChar; 88 m_wLineEnd = params.wLineBreakChar;
89 m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto); 89 m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto);
90 UpdateTxtBreak(); 90 UpdateTxtBreak();
91 } 91 }
92 92
93 FDE_TXTEDTPARAMS* CFDE_TxtEdtEngine::GetEditParams() { 93 FDE_TXTEDTPARAMS* CFDE_TxtEdtEngine::GetEditParams() {
94 return &m_Param; 94 return &m_Param;
95 } 95 }
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 m_SelRangePtrArr.RemoveAt(nCountRange); 1610 m_SelRangePtrArr.RemoveAt(nCountRange);
1611 DeleteRange_DoRecord(nSelStart, nSelCount, true); 1611 DeleteRange_DoRecord(nSelStart, nSelCount, true);
1612 } 1612 }
1613 ClearSelection(); 1613 ClearSelection();
1614 m_Param.pEventSink->OnTextChanged(m_ChangeInfo); 1614 m_Param.pEventSink->OnTextChanged(m_ChangeInfo);
1615 m_Param.pEventSink->OnSelChanged(); 1615 m_Param.pEventSink->OnSelChanged();
1616 SetCaretPos(nSelStart, true); 1616 SetCaretPos(nSelStart, true);
1617 return; 1617 return;
1618 } 1618 }
1619 } 1619 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfdoc_unittest.cpp ('k') | xfa/fde/cfde_txtedtpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698