diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-01 15:58:32 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-01 21:30:26 +0000 |
commit | b0d3160afa3ee0190b497d0eced5f5de1fdc8fbb (patch) | |
tree | 3edb89098b80b8c2dd5f0d08f9b0ac9710a34b9f /xfa | |
parent | bef73893d919514110cf3b724fad88965d9399e7 (diff) | |
download | pdfium-b0d3160afa3ee0190b497d0eced5f5de1fdc8fbb.tar.xz |
Change CreateBreak to return a unique_ptr
The value is always set into a unique_ptr, so return one and assign.
Change-Id: Ieda649c8f86caf1344ca2ce342a141c3ab70aa0f
Reviewed-on: https://pdfium-review.googlesource.com/2883
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/app/cxfa_textlayout.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/app/cxfa_textlayout.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index 715dbb32dd..06cbfe0c70 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -89,12 +89,12 @@ CFDE_XMLNode* CXFA_TextLayout::GetXMLContainerNode() { return pXMLContainer; } -CFX_RTFBreak* CXFA_TextLayout::CreateBreak(bool bDefault) { +std::unique_ptr<CFX_RTFBreak> CXFA_TextLayout::CreateBreak(bool bDefault) { uint32_t dwStyle = FX_RTFLAYOUTSTYLE_ExpandTab; if (!bDefault) dwStyle |= FX_RTFLAYOUTSTYLE_Pagination; - CFX_RTFBreak* pBreak = new CFX_RTFBreak(dwStyle); + auto pBreak = pdfium::MakeUnique<CFX_RTFBreak>(dwStyle); pBreak->SetLineBreakTolerance(1); pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, nullptr)); pBreak->SetFontSize(m_textParser.GetFontSize(m_pTextProvider, nullptr)); @@ -391,7 +391,7 @@ bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize, if (defaultSize.width < 1) defaultSize.width = 0xFFFF; - m_pBreak.reset(CreateBreak(false)); + m_pBreak = CreateBreak(false); FX_FLOAT fLinePos = 0; m_iLines = 0; m_fMaxWidth = 0; @@ -409,7 +409,7 @@ bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { return false; Unload(); - m_pBreak.reset(CreateBreak(true)); + m_pBreak = CreateBreak(true); if (m_pLoader) { m_pLoader->m_iTotalLines = -1; m_pLoader->m_iChar = 0; @@ -444,7 +444,7 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) { return true; if (iBlock == iBlocksHeightCount) { Unload(); - m_pBreak.reset(CreateBreak(true)); + m_pBreak = CreateBreak(true); fLinePos = m_pLoader->m_fStartLineOffset; for (int32_t i = 0; i < iBlocksHeightCount; i++) fLinePos -= m_pLoader->m_BlocksHeight[i * 2 + 1]; diff --git a/xfa/fxfa/app/cxfa_textlayout.h b/xfa/fxfa/app/cxfa_textlayout.h index cbc7160c28..d4d60cf81e 100644 --- a/xfa/fxfa/app/cxfa_textlayout.h +++ b/xfa/fxfa/app/cxfa_textlayout.h @@ -65,7 +65,7 @@ class CXFA_TextLayout { private: void GetTextDataNode(); CFDE_XMLNode* GetXMLContainerNode(); - CFX_RTFBreak* CreateBreak(bool bDefault); + std::unique_ptr<CFX_RTFBreak> CreateBreak(bool bDefault); void InitBreak(FX_FLOAT fLineWidth); void InitBreak(CFDE_CSSComputedStyle* pStyle, FDE_CSSDisplay eDisplay, |