summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa')
-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
9 files changed, 42 insertions, 32 deletions
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,