summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_textlayout.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-14 05:57:10 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-14 05:57:10 -0800
commita9caab94c1f16929e5acf2676117224617d80f53 (patch)
treed71ff9a82fae6e6080deb76375f43056127b3ee2 /xfa/fxfa/app/xfa_textlayout.cpp
parent992ecf7c189e5cabf43e5ad862511cf63d030966 (diff)
downloadpdfium-a9caab94c1f16929e5acf2676117224617d80f53.tar.xz
Avoid the ptr.reset(new XXX()) anti-pattern
Be suspicious of |new|. This removes some of the easy cases. Review-Url: https://codereview.chromium.org/2571913002
Diffstat (limited to 'xfa/fxfa/app/xfa_textlayout.cpp')
-rw-r--r--xfa/fxfa/app/xfa_textlayout.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp
index 2a7161333e..69b53eedb4 100644
--- a/xfa/fxfa/app/xfa_textlayout.cpp
+++ b/xfa/fxfa/app/xfa_textlayout.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_path.h"
#include "xfa/fde/css/fde_csscache.h"
@@ -97,7 +98,7 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
CXFA_FFDoc* pDoc = pTextProvider->GetDocNode();
CFGAS_FontMgr* pFontMgr = pDoc->GetApp()->GetFDEFontMgr();
ASSERT(pFontMgr);
- m_pSelector.reset(new CFDE_CSSStyleSelector(pFontMgr));
+ m_pSelector = pdfium::MakeUnique<CFDE_CSSStyleSelector>(pFontMgr);
FX_FLOAT fFontSize = 10;
CXFA_Font font = pTextProvider->GetFontNode();
if (font) {
@@ -896,7 +897,7 @@ void CXFA_TextLayout::InitBreak(IFDE_CSSComputedStyle* pStyle,
m_pBreak->SetLineStartPos(fStart);
m_pBreak->SetTabWidth(m_textParser.GetTabInterval(pStyle));
if (!m_pTabstopContext)
- m_pTabstopContext.reset(new CXFA_TextTabstopsContext);
+ m_pTabstopContext = pdfium::MakeUnique<CXFA_TextTabstopsContext>();
m_textParser.GetTabstops(pStyle, m_pTabstopContext.get());
for (int32_t i = 0; i < m_pTabstopContext->m_iTabCount; i++) {
XFA_TABSTOPS* pTab = m_pTabstopContext->m_tabstops.GetDataPtr(i);
@@ -946,7 +947,7 @@ FX_FLOAT CXFA_TextLayout::GetLayoutHeight() {
}
FX_FLOAT CXFA_TextLayout::StartLayout(FX_FLOAT fWidth) {
if (!m_pLoader)
- m_pLoader.reset(new CXFA_LoaderContext);
+ m_pLoader = pdfium::MakeUnique<CXFA_LoaderContext>();
if (fWidth < 0 || (m_pLoader->m_fWidth > -1 &&
FXSYS_fabs(fWidth - m_pLoader->m_fWidth) > 0)) {