summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp2
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp3
-rw-r--r--xfa/fde/cfx_wordbreak.cpp3
-rw-r--r--xfa/fde/css/fde_cssstyleselector.cpp3
-rw-r--r--xfa/fde/fde_render.cpp5
-rw-r--r--xfa/fde/tto/fde_textout.cpp5
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp5
-rw-r--r--xfa/fwl/cfwl_combobox.cpp4
-rw-r--r--xfa/fwl/cfwl_datetimepicker.cpp3
-rw-r--r--xfa/fwl/cfwl_widgetmgr.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.cpp3
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.cpp5
-rw-r--r--xfa/fxbarcode/BC_TwoDimWriter.cpp3
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp6
-rw-r--r--xfa/fxbarcode/oned/BC_OneDimWriter.cpp3
-rw-r--r--xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp3
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffapp.cpp11
-rw-r--r--xfa/fxfa/app/xfa_ffdoc.cpp10
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp7
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp24
-rw-r--r--xfa/fxfa/app/xfa_fontmgr.cpp3
-rw-r--r--xfa/fxfa/app/xfa_textlayout.cpp7
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp5
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.cpp4
-rw-r--r--xfa/fxgraphics/cfx_graphics.cpp3
-rw-r--r--xfa/fxgraphics/cfx_path.cpp3
28 files changed, 85 insertions, 57 deletions
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index ced5bdca52..7df4e0fb96 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -82,7 +82,7 @@ CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() {
void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) {
if (!m_pTextBreak)
- m_pTextBreak.reset(new CFX_TxtBreak(FX_TXTBREAKPOLICY_None));
+ m_pTextBreak = pdfium::MakeUnique<CFX_TxtBreak>(FX_TXTBREAKPOLICY_None);
FXSYS_memcpy(&m_Param, &params, sizeof(FDE_TXTEDTPARAMS));
m_wLineEnd = params.wLineBreakChar;
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp
index 0abb1d69f3..51621dae1c 100644
--- a/xfa/fde/cfde_txtedtpage.cpp
+++ b/xfa/fde/cfde_txtedtpage.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
+#include "third_party/base/ptr_util.h"
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtbufiter.h"
#include "xfa/fde/cfde_txtedtengine.h"
@@ -303,7 +304,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
(bVertial && bLineReserve) ? (-pParams->fLineSpace) : pParams->fLineSpace;
FX_FLOAT fLinePos = fLineStart;
if (!m_pTextSet)
- m_pTextSet.reset(new CFDE_TxtEdtTextSet(this));
+ m_pTextSet = pdfium::MakeUnique<CFDE_TxtEdtTextSet>(this);
m_PieceMassArr.RemoveAll(true);
uint32_t dwBreakStatus = FX_TXTBREAK_None;
diff --git a/xfa/fde/cfx_wordbreak.cpp b/xfa/fde/cfx_wordbreak.cpp
index 48b45a4e82..2d37ba1707 100644
--- a/xfa/fde/cfx_wordbreak.cpp
+++ b/xfa/fde/cfx_wordbreak.cpp
@@ -8,6 +8,7 @@
#include <utility>
+#include "third_party/base/ptr_util.h"
#include "xfa/fde/cfx_chariter.h"
namespace {
@@ -2788,7 +2789,7 @@ void CFX_WordBreak::Attach(IFX_CharIter* pIter) {
}
void CFX_WordBreak::Attach(const CFX_WideString& wsText) {
- m_pCurIter.reset(new CFX_CharIter(wsText));
+ m_pCurIter = pdfium::MakeUnique<CFX_CharIter>(wsText);
}
bool CFX_WordBreak::Next(bool bPrev) {
diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp
index 117afcc7ab..72e5ffc12b 100644
--- a/xfa/fde/css/fde_cssstyleselector.cpp
+++ b/xfa/fde/css/fde_cssstyleselector.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include <memory>
+#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/css/fde_csscache.h"
#include "xfa/fde/css/fde_cssdeclaration.h"
@@ -126,7 +127,7 @@ void CFDE_CSSStyleSelector::SetDefFontSize(FX_FLOAT fFontSize) {
CFDE_CSSAccelerator* CFDE_CSSStyleSelector::InitAccelerator() {
if (!m_pAccelerator)
- m_pAccelerator.reset(new CFDE_CSSAccelerator);
+ m_pAccelerator = pdfium::MakeUnique<CFDE_CSSAccelerator>();
m_pAccelerator->Clear();
return m_pAccelerator.get();
}
diff --git a/xfa/fde/fde_render.cpp b/xfa/fde/fde_render.cpp
index e1d46f55f9..9528219b45 100644
--- a/xfa/fde/fde_render.cpp
+++ b/xfa/fde/fde_render.cpp
@@ -6,6 +6,7 @@
#include "xfa/fde/fde_render.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fde/fde_gedevice.h"
#include "xfa/fde/fde_object.h"
#include "xfa/fgas/crt/fgas_memory.h"
@@ -38,7 +39,7 @@ bool CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice,
m_pRenderDevice = pRenderDevice;
m_Transform = tmDoc2Device;
if (!m_pIterator)
- m_pIterator.reset(new CFDE_VisualSetIterator);
+ m_pIterator = pdfium::MakeUnique<CFDE_VisualSetIterator>();
return m_pIterator->AttachCanvas(pCanvasSet) && m_pIterator->FilterObjects();
}
@@ -116,7 +117,7 @@ void CFDE_RenderContext::RenderText(IFDE_TextSet* pTextSet,
return;
if (!m_pBrush)
- m_pBrush.reset(new CFDE_Brush);
+ m_pBrush = pdfium::MakeUnique<CFDE_Brush>();
if (m_CharPos.size() < static_cast<size_t>(iCount))
m_CharPos.resize(iCount, FXTEXT_CHARPOS());
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp
index 68a68565d1..d7155b7107 100644
--- a/xfa/fde/tto/fde_textout.cpp
+++ b/xfa/fde/tto/fde_textout.cpp
@@ -10,6 +10,7 @@
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fde/cfde_path.h"
#include "xfa/fde/fde_gedevice.h"
#include "xfa/fde/fde_object.h"
@@ -132,12 +133,12 @@ void CFDE_TextOut::SetDIBitmap(CFX_DIBitmap* pDIB) {
m_pRenderDevice.reset();
CFX_FxgeDevice* device = new CFX_FxgeDevice;
device->Attach(pDIB, false, nullptr, false);
- m_pRenderDevice.reset(new CFDE_RenderDevice(device, false));
+ m_pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(device, false);
}
void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) {
ASSERT(pDevice);
- m_pRenderDevice.reset(new CFDE_RenderDevice(pDevice, false));
+ m_pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pDevice, false);
}
void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) {
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index 4b6e22593d..a3f8e9841d 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -11,6 +11,7 @@
#include "core/fxcrt/fx_arabic.h"
#include "core/fxcrt/fx_arb.h"
#include "core/fxcrt/fx_memory.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/layout/fgas_linebreak.h"
#include "xfa/fgas/layout/fgas_unicode.h"
@@ -70,8 +71,8 @@ CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies)
m_iCharSpace(0) {
m_bPagination = (m_dwPolicies & FX_TXTBREAKPOLICY_Pagination) != 0;
int32_t iSize = m_bPagination ? sizeof(CFX_Char) : sizeof(CFX_TxtChar);
- m_pTxtLine1.reset(new CFX_TxtLine(iSize));
- m_pTxtLine2.reset(new CFX_TxtLine(iSize));
+ m_pTxtLine1 = pdfium::MakeUnique<CFX_TxtLine>(iSize);
+ m_pTxtLine2 = pdfium::MakeUnique<CFX_TxtLine>(iSize);
m_pCurLine = m_pTxtLine1.get();
ResetArabicContext();
}
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index eb6bb632cd..7e5d1b8d74 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -56,8 +56,8 @@ CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app)
pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp, std::move(prop), this);
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) {
- m_pEdit.reset(new CFWL_ComboEdit(
- m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this));
+ m_pEdit = pdfium::MakeUnique<CFWL_ComboEdit>(
+ m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this);
m_pEdit->SetOuter(this);
}
if (m_pEdit)
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index fe7b90307b..10e26b4891 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -53,7 +53,8 @@ CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app)
editProp->m_pParent = this;
editProp->m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit.reset(new CFWL_DateTimeEdit(m_pOwnerApp, std::move(editProp), this));
+ m_pEdit = pdfium::MakeUnique<CFWL_DateTimeEdit>(m_pOwnerApp,
+ std::move(editProp), this);
RegisterEventTarget(m_pMonthCal.get());
RegisterEventTarget(m_pEdit.get());
}
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index e7eca100cc..7df7fb234d 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -563,7 +563,7 @@ CFX_Graphics* CFWL_WidgetMgr::DrawWidgetBefore(CFWL_Widget* pWidget,
Item* pItem = GetWidgetMgrItem(pWidget);
if (!pItem->pOffscreen) {
- pItem->pOffscreen.reset(new CFX_Graphics);
+ pItem->pOffscreen = pdfium::MakeUnique<CFX_Graphics>();
CFX_RectF rect = pWidget->GetWidgetRect();
pItem->pOffscreen->Create((int32_t)rect.width, (int32_t)rect.height,
FXDIB_Argb);
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index 4ff2ccd2a6..9109cb61c4 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -7,6 +7,7 @@
#include "xfa/fwl/theme/cfwl_checkboxtp.h"
#include "core/fxge/cfx_pathdata.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fwl/cfwl_checkbox.h"
#include "xfa/fwl/cfwl_themebackground.h"
@@ -219,7 +220,7 @@ void CFWL_CheckBoxTP::SetThemeData() {
void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) {
if (!m_pCheckPath) {
- m_pCheckPath.reset(new CFX_Path);
+ m_pCheckPath = pdfium::MakeUnique<CFX_Path>();
m_pCheckPath->Create();
FX_FLOAT fWidth = kSignPath;
FX_FLOAT fHeight = -kSignPath;
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index efc1e96335..3b436d8302 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include <utility>
+#include "third_party/base/ptr_util.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fgas/font/cfgas_gefont.h"
@@ -173,7 +174,7 @@ void CFWL_WidgetTP::InitTTO() {
m_pFDEFont =
CFWL_FontManager::GetInstance()->FindFont(FX_WSTRC(L"Helvetica"), 0, 0);
- m_pTextOut.reset(new CFDE_TextOut);
+ m_pTextOut = pdfium::MakeUnique<CFDE_TextOut>();
m_pTextOut->SetFont(m_pFDEFont);
m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
@@ -641,7 +642,7 @@ bool CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily,
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
m_pFontMgr = CFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
#else
- m_pFontSource.reset(new CFX_FontSourceEnum_File);
+ m_pFontSource = pdfium::MakeUnique<CFX_FontSourceEnum_File>();
m_pFontMgr = CFGAS_FontMgr::Create(m_pFontSource.get());
#endif
}
diff --git a/xfa/fxbarcode/BC_TwoDimWriter.cpp b/xfa/fxbarcode/BC_TwoDimWriter.cpp
index ec6c3626b2..84678a81da 100644
--- a/xfa/fxbarcode/BC_TwoDimWriter.cpp
+++ b/xfa/fxbarcode/BC_TwoDimWriter.cpp
@@ -10,6 +10,7 @@
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
#include "third_party/base/numerics/safe_math.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fxbarcode/BC_TwoDimWriter.h"
#include "xfa/fxbarcode/BC_Writer.h"
#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
@@ -134,7 +135,7 @@ void CBC_TwoDimWriter::RenderResult(uint8_t* code,
if (topPadding < 0) {
topPadding = 0;
}
- m_output.reset(new CBC_CommonBitMatrix);
+ m_output = pdfium::MakeUnique<CBC_CommonBitMatrix>();
m_output->Init(outputWidth, outputHeight);
for (int32_t inputY = 0, outputY = topPadding;
(inputY < inputHeight) && (outputY < outputHeight - multiY);
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
index c9425dfa19..33b828cc1e 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
@@ -21,6 +21,8 @@
*/
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
+
+#include "third_party/base/ptr_util.h"
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeField = nullptr;
@@ -56,8 +58,8 @@ CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(int32_t primitive) {
}
void CBC_ReedSolomonGF256::Init() {
- m_zero.reset(new CBC_ReedSolomonGF256Poly(this, 0));
- m_one.reset(new CBC_ReedSolomonGF256Poly(this, 1));
+ m_zero = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>(this, 0);
+ m_one = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>(this, 1);
}
CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256() {}
diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
index 09f7aea9db..24d257a630 100644
--- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -31,6 +31,7 @@
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/cfx_unicodeencodingex.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fxbarcode/BC_Writer.h"
#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
@@ -442,7 +443,7 @@ void CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents,
if (!isDevice) {
m_barWidth = codeLength * m_multiple;
}
- m_output.reset(new CBC_CommonBitMatrix);
+ m_output = pdfium::MakeUnique<CBC_CommonBitMatrix>();
m_output->Init(outputWidth, outputHeight);
int32_t outputX = leftPadding * m_multiple;
for (int32_t inputX = 0; inputX < codeOldLength; inputX++) {
diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index db1b67beef..42e84b7117 100644
--- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -22,6 +22,7 @@
#include "core/fxge/cfx_fxgedevice.h"
#include "core/fxge/cfx_gemodule.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fxbarcode/BC_Writer.h"
#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
#include "xfa/fxbarcode/oned/BC_OnedEAN13Writer.h"
@@ -33,7 +34,7 @@ CBC_OnedUPCAWriter::CBC_OnedUPCAWriter() {
}
void CBC_OnedUPCAWriter::Init() {
- m_subWriter.reset(new CBC_OnedEAN13Writer);
+ m_subWriter = pdfium::MakeUnique<CBC_OnedEAN13Writer>();
}
CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() {}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/fxbarcode/pdf417/BC_PDF417.cpp
index 9d827acff6..9b8d0c149c 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417.cpp
@@ -21,6 +21,8 @@
*/
#include "xfa/fxbarcode/pdf417/BC_PDF417.h"
+
+#include "third_party/base/ptr_util.h"
#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h"
#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
#include "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h"
@@ -432,7 +434,7 @@ void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg,
dataCodewords, errorCorrectionLevel, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
CFX_WideString fullCodewords = dataCodewords + ec;
- m_barcodeMatrix.reset(new CBC_BarcodeMatrix(rows, cols));
+ m_barcodeMatrix = pdfium::MakeUnique<CBC_BarcodeMatrix>(rows, cols);
encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel,
m_barcodeMatrix.get());
}
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp
index c264e03ec8..273b9f5b36 100644
--- a/xfa/fxfa/app/xfa_ffapp.cpp
+++ b/xfa/fxfa/app/xfa_ffapp.cpp
@@ -11,6 +11,7 @@
#include <utility>
#include <vector>
+#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fwl/cfwl_notedriver.h"
@@ -97,7 +98,7 @@ CXFA_FFApp::~CXFA_FFApp() {}
CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() {
if (!m_pDocHandler)
- m_pDocHandler.reset(new CXFA_FFDocHandler);
+ m_pDocHandler = pdfium::MakeUnique<CXFA_FFDocHandler>();
return m_pDocHandler.get();
}
@@ -120,7 +121,7 @@ CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocEnvironment* pDocEnvironment,
void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
if (!m_pFontMgr)
- m_pFontMgr.reset(new CXFA_FontMgr());
+ m_pFontMgr = pdfium::MakeUnique<CXFA_FontMgr>();
m_pFontMgr->SetDefFontMgr(std::move(pFontMgr));
}
@@ -133,7 +134,7 @@ CFGAS_FontMgr* CXFA_FFApp::GetFDEFontMgr() {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
m_pFDEFontMgr = CFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
#else
- m_pFontSource.reset(new CFX_FontSourceEnum_File);
+ m_pFontSource = pdfium::MakeUnique<CFX_FontSourceEnum_File>();
m_pFDEFontMgr = CFGAS_FontMgr::Create(m_pFontSource.get());
#endif
}
@@ -142,14 +143,14 @@ CFGAS_FontMgr* CXFA_FFApp::GetFDEFontMgr() {
CXFA_FWLTheme* CXFA_FFApp::GetFWLTheme() {
if (!m_pFWLTheme)
- m_pFWLTheme.reset(new CXFA_FWLTheme(this));
+ m_pFWLTheme = pdfium::MakeUnique<CXFA_FWLTheme>(this);
return m_pFWLTheme.get();
}
CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetWidgetMgr(
CFWL_WidgetMgrDelegate* pDelegate) {
if (!m_pAdapterWidgetMgr) {
- m_pAdapterWidgetMgr.reset(new CXFA_FWLAdapterWidgetMgr);
+ m_pAdapterWidgetMgr = pdfium::MakeUnique<CXFA_FWLAdapterWidgetMgr>();
pDelegate->OnSetCapability(FWL_WGTMGR_DisableForm);
m_pWidgetMgrDelegate = pDelegate;
}
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index 516f3d7fa0..c34213c17e 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -16,6 +16,7 @@
#include "core/fpdfdoc/cpdf_nametree.h"
#include "core/fxcrt/fx_ext.h"
#include "core/fxcrt/fx_memory.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
@@ -166,10 +167,9 @@ uint32_t CXFA_FFDoc::GetDocType() {
}
int32_t CXFA_FFDoc::StartLoad() {
- m_pNotify.reset(new CXFA_FFNotify(this));
- m_pDocumentParser.reset(new CXFA_DocumentParser(m_pNotify.get()));
- int32_t iStatus = m_pDocumentParser->StartParse(m_pStream, XFA_XDPPACKET_XDP);
- return iStatus;
+ m_pNotify = pdfium::MakeUnique<CXFA_FFNotify>(this);
+ m_pDocumentParser = pdfium::MakeUnique<CXFA_DocumentParser>(m_pNotify.get());
+ return m_pDocumentParser->StartParse(m_pStream, XFA_XDPPACKET_XDP);
}
bool XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement,
@@ -272,7 +272,7 @@ void CXFA_FFDoc::StopLoad() {
CXFA_FFDocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) {
if (!m_TypeToDocViewMap[dwView])
- m_TypeToDocViewMap[dwView].reset(new CXFA_FFDocView(this));
+ m_TypeToDocViewMap[dwView] = pdfium::MakeUnique<CXFA_FFDocView>(this);
return m_TypeToDocViewMap[dwView].get();
}
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index 78b690afc1..e88517c00c 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -7,6 +7,7 @@
#include "xfa/fxfa/xfa_ffdocview.h"
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fxfa/app/xfa_ffbarcode.h"
#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
@@ -313,9 +314,9 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam,
return XFA_EVENTERROR_Success;
}
CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() {
- if (!m_pWidgetHandler) {
- m_pWidgetHandler.reset(new CXFA_FFWidgetHandler(this));
- }
+ if (!m_pWidgetHandler)
+ m_pWidgetHandler = pdfium::MakeUnique<CXFA_FFWidgetHandler>(this);
+
return m_pWidgetHandler.get();
}
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index e95c04b331..c1c18ebbb3 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -11,6 +11,7 @@
#include <vector>
#include "fxjs/cfxjse_value.h"
+#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fde/xml/fde_xml_imp.h"
@@ -60,9 +61,9 @@ class CXFA_TextLayoutData : public CXFA_WidgetLayoutData {
if (m_pTextLayout)
return;
- m_pTextProvider.reset(
- new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Text));
- m_pTextLayout.reset(new CXFA_TextLayout(m_pTextProvider.get()));
+ m_pTextProvider =
+ pdfium::MakeUnique<CXFA_TextProvider>(pAcc, XFA_TEXTPROVIDERTYPE_Text);
+ m_pTextLayout = pdfium::MakeUnique<CXFA_TextLayout>(m_pTextProvider.get());
}
private:
@@ -120,7 +121,8 @@ class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData {
return false;
m_pCapTextProvider.reset(
new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Caption));
- m_pCapTextLayout.reset(new CXFA_TextLayout(m_pCapTextProvider.get()));
+ m_pCapTextLayout =
+ pdfium::MakeUnique<CXFA_TextLayout>(m_pCapTextProvider.get());
return true;
}
@@ -857,7 +859,7 @@ void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) {
CXFA_FieldLayoutData* layoutData =
static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get());
if (!layoutData->m_pTextOut) {
- layoutData->m_pTextOut.reset(new CFDE_TextOut);
+ layoutData->m_pTextOut = pdfium::MakeUnique<CFDE_TextOut>();
CFDE_TextOut* pTextOut = layoutData->m_pTextOut.get();
pTextOut->SetFont(GetFDEFont());
pTextOut->SetFontSize(fFontSize);
@@ -1388,25 +1390,25 @@ void CXFA_WidgetAcc::InitLayoutData() {
}
switch (GetUIType()) {
case XFA_Element::Text:
- m_pLayoutData.reset(new CXFA_TextLayoutData);
+ m_pLayoutData = pdfium::MakeUnique<CXFA_TextLayoutData>();
return;
case XFA_Element::TextEdit:
- m_pLayoutData.reset(new CXFA_TextEditData);
+ m_pLayoutData = pdfium::MakeUnique<CXFA_TextEditData>();
return;
case XFA_Element::Image:
- m_pLayoutData.reset(new CXFA_ImageLayoutData);
+ m_pLayoutData = pdfium::MakeUnique<CXFA_ImageLayoutData>();
return;
case XFA_Element::ImageEdit:
- m_pLayoutData.reset(new CXFA_ImageEditData);
+ m_pLayoutData = pdfium::MakeUnique<CXFA_ImageEditData>();
return;
default:
break;
}
if (GetElementType() == XFA_Element::Field) {
- m_pLayoutData.reset(new CXFA_FieldLayoutData);
+ m_pLayoutData = pdfium::MakeUnique<CXFA_FieldLayoutData>();
return;
}
- m_pLayoutData.reset(new CXFA_WidgetLayoutData);
+ m_pLayoutData = pdfium::MakeUnique<CXFA_WidgetLayoutData>();
}
void CXFA_WidgetAcc::StartTextLayout(FX_FLOAT& fCalcWidth,
diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp
index e83cf48eb8..636017d4e3 100644
--- a/xfa/fxfa/app/xfa_fontmgr.cpp
+++ b/xfa/fxfa/app/xfa_fontmgr.cpp
@@ -13,6 +13,7 @@
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_document.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fxfa/xfa_ffapp.h"
#include "xfa/fxfa/xfa_ffdoc.h"
@@ -2047,7 +2048,7 @@ CFGAS_GEFont* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc,
void CXFA_FontMgr::LoadDocFonts(CXFA_FFDoc* hDoc) {
if (!m_PDFFontMgrMap[hDoc])
- m_PDFFontMgrMap[hDoc].reset(new CXFA_PDFFontMgr(hDoc));
+ m_PDFFontMgrMap[hDoc] = pdfium::MakeUnique<CXFA_PDFFontMgr>(hDoc);
}
void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) {
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)) {
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index 1bf327d667..90be568785 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -6,6 +6,7 @@
#include "xfa/fxfa/parser/cxfa_document_parser.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -23,7 +24,7 @@ int32_t CXFA_DocumentParser::StartParse(
int32_t nRetStatus = m_nodeParser.StartParse(pStream, ePacketID);
if (nRetStatus == XFA_PARSESTATUS_Ready) {
- m_pDocument.reset(new CXFA_Document(this));
+ m_pDocument = pdfium::MakeUnique<CXFA_Document>(this);
m_nodeParser.SetFactory(m_pDocument.get());
}
return nRetStatus;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 1721cb7982..f385b11b69 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -13,6 +13,7 @@
#include "core/fxcrt/fx_ext.h"
#include "fxjs/cfxjse_value.h"
+#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fgas/crt/fgas_codepage.h"
@@ -118,11 +119,11 @@ CXFA_NodeSetPair* NodeSetPairForNode(CXFA_Node* pNode,
return nullptr;
if (!(*pMap)[pParentNode])
- (*pMap)[pParentNode].reset(new CXFA_NodeSetPairMap);
+ (*pMap)[pParentNode] = pdfium::MakeUnique<CXFA_NodeSetPairMap>();
CXFA_NodeSetPairMap* pNodeSetPairMap = (*pMap)[pParentNode].get();
if (!(*pNodeSetPairMap)[dwNameHash])
- (*pNodeSetPairMap)[dwNameHash].reset(new CXFA_NodeSetPair);
+ (*pNodeSetPairMap)[dwNameHash] = pdfium::MakeUnique<CXFA_NodeSetPair>();
return (*pNodeSetPairMap)[dwNameHash].get();
}
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index 8cad0e08c4..60ee722c91 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
@@ -9,6 +9,7 @@
#include <utility>
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
#include "fxjs/cfxjse_arguments.h"
#include "fxjs/cfxjse_class.h"
#include "fxjs/cfxjse_value.h"
@@ -142,8 +143,9 @@ void CXFA_ScriptContext::Initialize(v8::Isolate* pIsolate) {
m_pIsolate = pIsolate;
DefineJsContext();
DefineJsClass();
- m_ResolveProcessor.reset(new CXFA_ResolveProcessor);
+ m_ResolveProcessor = pdfium::MakeUnique<CXFA_ResolveProcessor>();
}
+
bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType,
const CFX_WideStringC& wsScript,
CFXJSE_Value* hRetValue,
diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp
index 824e7c68da..5b3bc8cb9d 100644
--- a/xfa/fxgraphics/cfx_graphics.cpp
+++ b/xfa/fxgraphics/cfx_graphics.cpp
@@ -12,6 +12,7 @@
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/cfx_unicodeencoding.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fxgraphics/cagg_graphics.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
@@ -597,7 +598,7 @@ FWL_Error CFX_Graphics::Create(int32_t width,
m_type = FX_CONTEXT_Device;
m_info.isAntialiasing = isAntialiasing;
- m_aggGraphics.reset(new CAGG_Graphics);
+ m_aggGraphics = pdfium::MakeUnique<CAGG_Graphics>();
return m_aggGraphics->Create(this, width, height, format);
}
diff --git a/xfa/fxgraphics/cfx_path.cpp b/xfa/fxgraphics/cfx_path.cpp
index d02b7a8e48..3288631f15 100644
--- a/xfa/fxgraphics/cfx_path.cpp
+++ b/xfa/fxgraphics/cfx_path.cpp
@@ -7,6 +7,7 @@
#include "xfa/fxgraphics/cfx_path.h"
#include "core/fxge/cfx_pathdata.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fxgraphics/cfx_path_generator.h"
CFX_Path::CFX_Path() {}
@@ -15,7 +16,7 @@ FWL_Error CFX_Path::Create() {
if (m_generator)
return FWL_Error::PropertyInvalid;
- m_generator.reset(new CFX_PathGenerator());
+ m_generator = pdfium::MakeUnique<CFX_PathGenerator>();
return FWL_Error::Succeeded;
}