diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-08-21 15:21:05 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-23 15:46:39 +0000 |
commit | 6b0287d245995d04a2a9a44213b22fce9ca8c237 (patch) | |
tree | 0c278f27eaca99adc72cfad210a879649a55753e /xfa/fde/cfde_txtedtengine.cpp | |
parent | 12db7515f17228798d1aa38fce0fee3e7d2d36b6 (diff) | |
download | pdfium-6b0287d245995d04a2a9a44213b22fce9ca8c237.tar.xz |
Move m_pTextBreak to be a member of CFDE_TxtEdtEngine
Previously text break was a unique_ptr inside the CFDE_TxtEdtEngine.
This CL converts it to be a member instead of a unique_ptr. We never
replace the pointer after it's created.
Change-Id: I89ab73e81c63c24abfacd38a1141db6473d77640
Reviewed-on: https://pdfium-review.googlesource.com/11530
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/cfde_txtedtengine.cpp')
-rw-r--r-- | xfa/fde/cfde_txtedtengine.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index 469ec87cf7..be0270960d 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -15,7 +15,6 @@ #include "xfa/fde/cfde_txtedtbuf.h" #include "xfa/fde/cfde_txtedtpage.h" #include "xfa/fde/cfde_txtedtparag.h" -#include "xfa/fgas/layout/cfx_txtbreak.h" #include "xfa/fwl/cfwl_edit.h" namespace { @@ -145,9 +144,6 @@ CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() { } void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) { - if (!m_pTextBreak) - m_pTextBreak = pdfium::MakeUnique<CFX_TxtBreak>(); - m_Param = params; m_bAutoLineEnd = true; UpdateTxtBreak(); @@ -807,7 +803,7 @@ void CFDE_TxtEdtEngine::UpdatePages() { } void CFDE_TxtEdtEngine::UpdateTxtBreak() { - uint32_t dwStyle = m_pTextBreak->GetLayoutStyles(); + uint32_t dwStyle = m_TextBreak.GetLayoutStyles(); if (m_Param.dwMode & FDE_TEXTEDITMODE_MultiLines) dwStyle &= ~FX_LAYOUTSTYLE_SingleLine; else @@ -818,7 +814,7 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() { else dwStyle &= ~FX_LAYOUTSTYLE_CombText; - m_pTextBreak->SetLayoutStyles(dwStyle); + m_TextBreak.SetLayoutStyles(dwStyle); uint32_t dwAligment = 0; if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Justified) dwAligment |= CFX_TxtLineAlignment_Justified; @@ -828,12 +824,12 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() { else if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Right) dwAligment |= CFX_TxtLineAlignment_Right; - m_pTextBreak->SetAlignment(dwAligment); + m_TextBreak.SetAlignment(dwAligment); if (m_Param.dwMode & FDE_TEXTEDITMODE_AutoLineWrap) - m_pTextBreak->SetLineWidth(m_Param.fPlateWidth); + m_TextBreak.SetLineWidth(m_Param.fPlateWidth); else - m_pTextBreak->SetLineWidth(kPageWidthMax); + m_TextBreak.SetLineWidth(kPageWidthMax); m_nPageLineCount = m_Param.nLineCount; if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText) { @@ -841,16 +837,16 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() { if (m_nLimit > 0) fCombWidth /= m_nLimit; - m_pTextBreak->SetCombWidth(fCombWidth); + m_TextBreak.SetCombWidth(fCombWidth); } - m_pTextBreak->SetFont(m_Param.pFont); - m_pTextBreak->SetFontSize(m_Param.fFontSize); - m_pTextBreak->SetTabWidth(m_Param.fTabWidth); - m_pTextBreak->SetDefaultChar(0xFEFF); - m_pTextBreak->SetParagraphBreakChar(L'\n'); - m_pTextBreak->SetLineBreakTolerance(m_Param.fFontSize * 0.2f); - m_pTextBreak->SetHorizontalScale(100); - m_pTextBreak->SetCharSpace(0); + m_TextBreak.SetFont(m_Param.pFont); + m_TextBreak.SetFontSize(m_Param.fFontSize); + m_TextBreak.SetTabWidth(m_Param.fTabWidth); + m_TextBreak.SetDefaultChar(0xFEFF); + m_TextBreak.SetParagraphBreakChar(L'\n'); + m_TextBreak.SetLineBreakTolerance(m_Param.fFontSize * 0.2f); + m_TextBreak.SetHorizontalScale(100); + m_TextBreak.SetCharSpace(0); } bool CFDE_TxtEdtEngine::ReplaceParagEnd(wchar_t*& lpText, |