summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fgas/font/cfgas_gefont.h3
-rw-r--r--xfa/fgas/layout/cfx_breakpiece.h3
-rw-r--r--xfa/fwl/cfwl_caret.cpp2
-rw-r--r--xfa/fwl/cfwl_caret.h2
-rw-r--r--xfa/fwl/cfwl_scrollbar.cpp3
-rw-r--r--xfa/fwl/cfwl_spinbutton.cpp4
-rw-r--r--xfa/fwl/cfwl_timer.cpp4
-rw-r--r--xfa/fwl/cfwl_timer.h7
-rw-r--r--xfa/fwl/cfwl_timerinfo.cpp6
-rw-r--r--xfa/fwl/cfwl_timerinfo.h9
-rw-r--r--xfa/fwl/cfwl_widget.h8
-rw-r--r--xfa/fxfa/cxfa_ffapp.cpp8
-rw-r--r--xfa/fxfa/cxfa_ffapp.h8
-rw-r--r--xfa/fxfa/cxfa_ffdoc.cpp11
-rw-r--r--xfa/fxfa/cxfa_ffdoc.h2
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp46
-rw-r--r--xfa/fxfa/cxfa_ffdocview.h11
-rw-r--r--xfa/fxfa/cxfa_widgetacciterator.cpp2
-rw-r--r--xfa/fxfa/cxfa_widgetacciterator.h3
-rw-r--r--xfa/fxfa/parser/cxfa_resolveprocessor.cpp2
20 files changed, 81 insertions, 63 deletions
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index ba2e6e69a5..5fe73bbb40 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -12,6 +12,7 @@
#include <vector>
#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_memory.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
@@ -101,7 +102,7 @@ class CFGAS_GEFont : public CFX_Retainable {
std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding;
std::map<wchar_t, int32_t> m_CharWidthMap;
std::map<wchar_t, CFX_Rect> m_BBoxMap;
- CXFA_PDFFontMgr* m_pProvider; // not owned.
+ CFX_UnownedPtr<CXFA_PDFFontMgr> m_pProvider;
std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_SubstFonts;
std::map<wchar_t, CFX_RetainPtr<CFGAS_GEFont>> m_FontMapper;
};
diff --git a/xfa/fgas/layout/cfx_breakpiece.h b/xfa/fgas/layout/cfx_breakpiece.h
index 1c51b1e42a..807b5f769f 100644
--- a/xfa/fgas/layout/cfx_breakpiece.h
+++ b/xfa/fgas/layout/cfx_breakpiece.h
@@ -11,6 +11,7 @@
#include "core/fxcrt/cfx_char.h"
#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/app/cxfa_textuserdata.h"
@@ -39,7 +40,7 @@ class CFX_BreakPiece {
int32_t m_iVerticalScale;
uint32_t m_dwIdentity;
uint32_t m_dwCharStyles;
- std::vector<CFX_Char>* m_pChars; // not owned.
+ CFX_UnownedPtr<std::vector<CFX_Char>> m_pChars;
CFX_RetainPtr<CXFA_TextUserData> m_pUserData;
};
diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp
index a6ea9ddb56..21387a47f9 100644
--- a/xfa/fwl/cfwl_caret.cpp
+++ b/xfa/fwl/cfwl_caret.cpp
@@ -97,7 +97,7 @@ void CFWL_Caret::OnDrawWidget(CFX_Graphics* pGraphics,
CFWL_Caret::Timer::Timer(CFWL_Caret* pCaret) : CFWL_Timer(pCaret) {}
void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) {
- CFWL_Caret* pCaret = static_cast<CFWL_Caret*>(m_pWidget);
+ CFWL_Caret* pCaret = static_cast<CFWL_Caret*>(m_pWidget.Get());
if (!(pCaret->GetStates() & FWL_STATE_CAT_HightLight))
pCaret->SetStates(FWL_STATE_CAT_HightLight);
else
diff --git a/xfa/fwl/cfwl_caret.h b/xfa/fwl/cfwl_caret.h
index e0c07d301a..da0548c2bf 100644
--- a/xfa/fwl/cfwl_caret.h
+++ b/xfa/fwl/cfwl_caret.h
@@ -51,7 +51,7 @@ class CFWL_Caret : public CFWL_Widget {
const CFX_Matrix* pMatrix);
std::unique_ptr<CFWL_Caret::Timer> m_pTimer;
- CFWL_TimerInfo* m_pTimerInfo; // not owned.
+ CFX_UnownedPtr<CFWL_TimerInfo> m_pTimerInfo;
};
#endif // XFA_FWL_CFWL_CARET_H_
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp
index 72797ed315..79e8b48115 100644
--- a/xfa/fwl/cfwl_scrollbar.cpp
+++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -485,8 +485,7 @@ void CFWL_ScrollBar::DoMouseHover(int32_t iItem,
CFWL_ScrollBar::Timer::Timer(CFWL_ScrollBar* pToolTip) : CFWL_Timer(pToolTip) {}
void CFWL_ScrollBar::Timer::Run(CFWL_TimerInfo* pTimerInfo) {
- CFWL_ScrollBar* pButton = static_cast<CFWL_ScrollBar*>(m_pWidget);
-
+ CFWL_ScrollBar* pButton = static_cast<CFWL_ScrollBar*>(m_pWidget.Get());
if (pButton->m_pTimerInfo)
pButton->m_pTimerInfo->StopTimer();
diff --git a/xfa/fwl/cfwl_spinbutton.cpp b/xfa/fwl/cfwl_spinbutton.cpp
index 6e58b69baf..65bd6cdd3a 100644
--- a/xfa/fwl/cfwl_spinbutton.cpp
+++ b/xfa/fwl/cfwl_spinbutton.cpp
@@ -336,7 +336,6 @@ void CFWL_SpinButton::OnKeyDown(CFWL_MessageKey* pMsg) {
CFWL_Event wmPosChanged(CFWL_Event::Type::Click, this);
DispatchEvent(&wmPosChanged);
-
RepaintRect(bUpEnable ? m_rtUpButton : m_rtDnButton);
}
@@ -344,8 +343,7 @@ CFWL_SpinButton::Timer::Timer(CFWL_SpinButton* pToolTip)
: CFWL_Timer(pToolTip) {}
void CFWL_SpinButton::Timer::Run(CFWL_TimerInfo* pTimerInfo) {
- CFWL_SpinButton* pButton = static_cast<CFWL_SpinButton*>(m_pWidget);
-
+ CFWL_SpinButton* pButton = static_cast<CFWL_SpinButton*>(m_pWidget.Get());
if (!pButton->m_pTimerInfo)
return;
diff --git a/xfa/fwl/cfwl_timer.cpp b/xfa/fwl/cfwl_timer.cpp
index 0cd3b2b768..2734e49d78 100644
--- a/xfa/fwl/cfwl_timer.cpp
+++ b/xfa/fwl/cfwl_timer.cpp
@@ -12,6 +12,10 @@
#include "xfa/fwl/ifwl_adaptertimermgr.h"
#include "xfa/fxfa/cxfa_ffapp.h"
+CFWL_Timer::CFWL_Timer(CFWL_Widget* parent) : m_pWidget(parent) {}
+
+CFWL_Timer::~CFWL_Timer() {}
+
CFWL_TimerInfo* CFWL_Timer::StartTimer(uint32_t dwElapse, bool bImmediately) {
const CFWL_App* pApp = m_pWidget->GetOwnerApp();
if (!pApp)
diff --git a/xfa/fwl/cfwl_timer.h b/xfa/fwl/cfwl_timer.h
index 6c9079acfe..93de009ed1 100644
--- a/xfa/fwl/cfwl_timer.h
+++ b/xfa/fwl/cfwl_timer.h
@@ -7,6 +7,7 @@
#ifndef XFA_FWL_CFWL_TIMER_H_
#define XFA_FWL_CFWL_TIMER_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_system.h"
class CFWL_TimerInfo;
@@ -14,14 +15,14 @@ class CFWL_Widget;
class CFWL_Timer {
public:
- explicit CFWL_Timer(CFWL_Widget* parent) : m_pWidget(parent) {}
- virtual ~CFWL_Timer() {}
+ explicit CFWL_Timer(CFWL_Widget* parent);
+ virtual ~CFWL_Timer();
virtual void Run(CFWL_TimerInfo* hTimer) = 0;
CFWL_TimerInfo* StartTimer(uint32_t dwElapse, bool bImmediately);
protected:
- CFWL_Widget* m_pWidget; // Not owned.
+ CFX_UnownedPtr<CFWL_Widget> m_pWidget;
};
#endif // XFA_FWL_CFWL_TIMER_H_
diff --git a/xfa/fwl/cfwl_timerinfo.cpp b/xfa/fwl/cfwl_timerinfo.cpp
index 8c7aaebbbb..ee4746af3f 100644
--- a/xfa/fwl/cfwl_timerinfo.cpp
+++ b/xfa/fwl/cfwl_timerinfo.cpp
@@ -8,6 +8,12 @@
#include "xfa/fwl/ifwl_adaptertimermgr.h"
+CFWL_TimerInfo::CFWL_TimerInfo(IFWL_AdapterTimerMgr* mgr) : m_pMgr(mgr) {
+ ASSERT(mgr);
+}
+
+CFWL_TimerInfo::~CFWL_TimerInfo() {}
+
void CFWL_TimerInfo::StopTimer() {
m_pMgr->Stop(this);
}
diff --git a/xfa/fwl/cfwl_timerinfo.h b/xfa/fwl/cfwl_timerinfo.h
index a47fede60f..ae77ef5d59 100644
--- a/xfa/fwl/cfwl_timerinfo.h
+++ b/xfa/fwl/cfwl_timerinfo.h
@@ -7,21 +7,20 @@
#ifndef XFA_FWL_CFWL_TIMERINFO_H_
#define XFA_FWL_CFWL_TIMERINFO_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_system.h"
class IFWL_AdapterTimerMgr;
class CFWL_TimerInfo {
public:
- explicit CFWL_TimerInfo(IFWL_AdapterTimerMgr* mgr) : m_pMgr(mgr) {
- ASSERT(mgr);
- }
- virtual ~CFWL_TimerInfo() {}
+ explicit CFWL_TimerInfo(IFWL_AdapterTimerMgr* mgr);
+ virtual ~CFWL_TimerInfo();
void StopTimer();
private:
- IFWL_AdapterTimerMgr* m_pMgr; // Not owned.
+ CFX_UnownedPtr<IFWL_AdapterTimerMgr> m_pMgr;
};
#endif // XFA_FWL_CFWL_TIMERINFO_H_
diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h
index b556e7a424..dd8fb5654b 100644
--- a/xfa/fwl/cfwl_widget.h
+++ b/xfa/fwl/cfwl_widget.h
@@ -6,8 +6,10 @@
#ifndef XFA_FWL_CFWL_WIDGET_H_
#define XFA_FWL_CFWL_WIDGET_H_
+
#include <memory>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
#include "xfa/fwl/cfwl_event.h"
@@ -96,10 +98,10 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; }
IFWL_WidgetDelegate* GetDelegate() {
- return m_pDelegate ? m_pDelegate : this;
+ return m_pDelegate ? m_pDelegate.Get() : this;
}
const IFWL_WidgetDelegate* GetDelegate() const {
- return m_pDelegate ? m_pDelegate : this;
+ return m_pDelegate ? m_pDelegate.Get() : this;
}
const CFWL_App* GetOwnerApp() const { return m_pOwnerApp; }
@@ -182,7 +184,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
CXFA_FFWidget* m_pLayoutItem;
uint32_t m_nEventKey;
- IFWL_WidgetDelegate* m_pDelegate; // Not owned.
+ CFX_UnownedPtr<IFWL_WidgetDelegate> m_pDelegate;
};
#endif // XFA_FWL_CFWL_WIDGET_H_
diff --git a/xfa/fxfa/cxfa_ffapp.cpp b/xfa/fxfa/cxfa_ffapp.cpp
index 742cd14c30..7b97116c7a 100644
--- a/xfa/fxfa/cxfa_ffapp.cpp
+++ b/xfa/fxfa/cxfa_ffapp.cpp
@@ -23,10 +23,10 @@
#include "xfa/fxfa/cxfa_ffwidgethandler.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
-CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider)
- : m_pProvider(pProvider),
- m_pWidgetMgrDelegate(nullptr),
- m_pFWLApp(pdfium::MakeUnique<CFWL_App>(this)) {}
+CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) : m_pProvider(pProvider) {
+ // Ensure fully initialized before making an app based on |this|.
+ m_pFWLApp = pdfium::MakeUnique<CFWL_App>(this);
+}
CXFA_FFApp::~CXFA_FFApp() {}
diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h
index 0a6409d3d1..1ae2073d82 100644
--- a/xfa/fxfa/cxfa_ffapp.h
+++ b/xfa/fxfa/cxfa_ffapp.h
@@ -13,6 +13,7 @@
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fxfa/fxfa.h"
@@ -44,7 +45,7 @@ class CXFA_FFApp {
IFWL_AdapterTimerMgr* GetTimerMgr() const;
CXFA_FontMgr* GetXFAFontMgr() const;
CFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() const {
- return m_pWidgetMgrDelegate;
+ return m_pWidgetMgrDelegate.Get();
}
void ClearEventTargets();
@@ -70,12 +71,15 @@ class CXFA_FFApp {
std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource;
#endif
std::unique_ptr<CXFA_FWLAdapterWidgetMgr> m_pAdapterWidgetMgr;
- CFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; // not owned.
// |m_pFWLApp| has to be released first, then |m_pFWLTheme| since the former
// may refers to theme manager and the latter refers to font manager.
std::unique_ptr<CXFA_FWLTheme> m_pFWLTheme;
std::unique_ptr<CFWL_App> m_pFWLApp;
+
+ // |m_pWidgetMgrDelegate| has to be released before |m_pFWLApp|, since
+ // |m_pFWLApp| is its owner.
+ CFX_UnownedPtr<CFWL_WidgetMgrDelegate> m_pWidgetMgrDelegate;
};
#endif // XFA_FXFA_CXFA_FFAPP_H_
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index bddc02a9ce..f7bad38934 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -321,21 +321,20 @@ bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) {
return true;
}
-bool CXFA_FFDoc::CloseDoc() {
- if (m_DocView)
+void CXFA_FFDoc::CloseDoc() {
+ if (m_DocView) {
m_DocView->RunDocClose();
-
+ m_DocView.reset();
+ }
CXFA_Document* doc =
m_pDocumentParser ? m_pDocumentParser->GetDocument() : nullptr;
if (doc)
doc->ClearLayoutData();
- m_DocView.reset();
- m_pNotify.reset(nullptr);
+ m_pNotify.reset();
m_pApp->GetXFAFontMgr()->ReleaseDocFonts(this);
m_HashToDibDpiMap.clear();
m_pApp->ClearEventTargets();
- return true;
}
CPDF_Document* CXFA_FFDoc::GetPDFDoc() {
diff --git a/xfa/fxfa/cxfa_ffdoc.h b/xfa/fxfa/cxfa_ffdoc.h
index 1cfbb50a2c..d40e7ba0c8 100644
--- a/xfa/fxfa/cxfa_ffdoc.h
+++ b/xfa/fxfa/cxfa_ffdoc.h
@@ -60,7 +60,7 @@ class CXFA_FFDoc {
bool OpenDoc(const CFX_RetainPtr<IFX_SeekableStream>& pStream);
bool OpenDoc(CPDF_Document* pPDFDoc);
- bool CloseDoc();
+ void CloseDoc();
CXFA_Document* GetXFADoc() { return m_pDocumentParser->GetDocument(); }
CXFA_FFApp* GetApp() { return m_pApp; }
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 058116be72..c1a8a67336 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -61,9 +61,6 @@ CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* pDoc)
m_bInLayoutStatus(false),
m_pDoc(pDoc),
m_pXFADocLayout(nullptr),
- m_pFocusAcc(nullptr),
- m_pFocusWidget(nullptr),
- m_pOldFocusWidget(nullptr),
m_iStatus(XFA_DOCVIEW_LAYOUTSTATUS_None),
m_iLock(0) {}
@@ -143,14 +140,16 @@ void CXFA_FFDocView::StopLayout() {
nullptr);
}
m_CalculateAccs.clear();
- if (m_pFocusAcc && !m_pFocusWidget) {
- SetFocusWidgetAcc(m_pFocusAcc);
- }
+ if (m_pFocusAcc && !m_pFocusWidget)
+ SetFocusWidgetAcc(m_pFocusAcc.Get());
+
m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_End;
}
+
int32_t CXFA_FFDocView::GetLayoutStatus() {
return m_iStatus;
}
+
void CXFA_FFDocView::ShowNullTestMsg() {
int32_t iCount = pdfium::CollectionSize<int32_t>(m_arrNullTestMsg);
CXFA_FFApp* pApp = m_pDoc->GetApp();
@@ -316,8 +315,8 @@ CXFA_FFDocView::CreateWidgetAccIterator() {
return pdfium::MakeUnique<CXFA_WidgetAccIterator>(pFormRoot);
}
-CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() {
- return m_pFocusWidget;
+CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() const {
+ return m_pFocusWidget.Get();
}
void CXFA_FFDocView::KillFocus() {
@@ -329,12 +328,13 @@ void CXFA_FFDocView::KillFocus() {
m_pFocusWidget = nullptr;
m_pOldFocusWidget = nullptr;
}
+
bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) {
CXFA_FFWidget* pNewFocus = hWidget;
- if (m_pOldFocusWidget == pNewFocus) {
+ if (m_pOldFocusWidget == pNewFocus)
return false;
- }
- CXFA_FFWidget* pOldFocus = m_pOldFocusWidget;
+
+ CXFA_FFWidget* pOldFocus = m_pOldFocusWidget.Get();
m_pOldFocusWidget = pNewFocus;
if (pOldFocus) {
if (m_pFocusWidget != m_pOldFocusWidget &&
@@ -345,15 +345,15 @@ bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) {
if (!pOldFocus->IsLoaded()) {
pOldFocus->LoadWidget();
}
- pOldFocus->OnSetFocus(m_pFocusWidget);
+ pOldFocus->OnSetFocus(m_pFocusWidget.Get());
m_pFocusWidget = pOldFocus;
pOldFocus->OnKillFocus(pNewFocus);
}
}
- if (m_pFocusWidget == m_pOldFocusWidget) {
+ if (m_pFocusWidget == m_pOldFocusWidget)
return false;
- }
- pNewFocus = m_pOldFocusWidget;
+
+ pNewFocus = m_pOldFocusWidget.Get();
if (m_pListFocusWidget && pNewFocus == m_pListFocusWidget) {
m_pFocusAcc = nullptr;
m_pFocusWidget = nullptr;
@@ -362,29 +362,30 @@ bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) {
return false;
}
if (pNewFocus && (pNewFocus->GetStatus() & XFA_WidgetStatus_Visible)) {
- if (!pNewFocus->IsLoaded()) {
+ if (!pNewFocus->IsLoaded())
pNewFocus->LoadWidget();
- }
- pNewFocus->OnSetFocus(m_pFocusWidget);
+ pNewFocus->OnSetFocus(m_pFocusWidget.Get());
}
m_pFocusAcc = pNewFocus ? pNewFocus->GetDataAcc() : nullptr;
m_pFocusWidget = pNewFocus;
m_pOldFocusWidget = m_pFocusWidget;
return true;
}
+
CXFA_WidgetAcc* CXFA_FFDocView::GetFocusWidgetAcc() {
- return m_pFocusAcc;
+ return m_pFocusAcc.Get();
}
+
void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
CXFA_FFWidget* pNewFocus =
pWidgetAcc ? pWidgetAcc->GetNextWidget(nullptr) : nullptr;
if (SetFocus(pNewFocus)) {
m_pFocusAcc = pWidgetAcc;
- if (m_iStatus == XFA_DOCVIEW_LAYOUTSTATUS_End) {
- m_pDoc->GetDocEnvironment()->SetFocusWidget(m_pDoc, m_pFocusWidget);
- }
+ if (m_iStatus == XFA_DOCVIEW_LAYOUTSTATUS_End)
+ m_pDoc->GetDocEnvironment()->SetFocusWidget(m_pDoc, m_pFocusWidget.Get());
}
}
+
void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) {
if (m_pFocusAcc == pWidget->GetDataAcc()) {
m_pFocusAcc = nullptr;
@@ -392,6 +393,7 @@ void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) {
m_pOldFocusWidget = nullptr;
}
}
+
static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
CXFA_WidgetAcc* pWidgetAcc,
CXFA_EventParam* pParam) {
diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h
index 761397c4b0..83d077b548 100644
--- a/xfa/fxfa/cxfa_ffdocview.h
+++ b/xfa/fxfa/cxfa_ffdocview.h
@@ -11,6 +11,7 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
@@ -56,7 +57,7 @@ class CXFA_FFDocView {
CXFA_WidgetAcc* pWidgetAcc);
CXFA_FFWidgetHandler* GetWidgetHandler();
std::unique_ptr<CXFA_WidgetAccIterator> CreateWidgetAccIterator();
- CXFA_FFWidget* GetFocusWidget();
+ CXFA_FFWidget* GetFocusWidget() const;
void KillFocus();
bool SetFocus(CXFA_FFWidget* hWidget);
CXFA_FFWidget* GetWidgetByName(const CFX_WideString& wsName,
@@ -117,10 +118,10 @@ class CXFA_FFDocView {
CXFA_FFDoc* const m_pDoc;
std::unique_ptr<CXFA_FFWidgetHandler> m_pWidgetHandler;
- CXFA_LayoutProcessor* m_pXFADocLayout; // not owned.
- CXFA_WidgetAcc* m_pFocusAcc; // not owned.
- CXFA_FFWidget* m_pFocusWidget; // not owned.
- CXFA_FFWidget* m_pOldFocusWidget; // not owned.
+ CXFA_LayoutProcessor* m_pXFADocLayout; // Not owned.
+ CFX_UnownedPtr<CXFA_WidgetAcc> m_pFocusAcc;
+ CFX_UnownedPtr<CXFA_FFWidget> m_pFocusWidget;
+ CFX_UnownedPtr<CXFA_FFWidget> m_pOldFocusWidget;
std::map<CXFA_FFPageView*, std::unique_ptr<CFX_RectF>> m_mapPageInvalidate;
std::vector<CXFA_WidgetAcc*> m_ValidateAccs;
std::vector<CXFA_WidgetAcc*> m_CalculateAccs;
diff --git a/xfa/fxfa/cxfa_widgetacciterator.cpp b/xfa/fxfa/cxfa_widgetacciterator.cpp
index 373fba99dc..ed780853df 100644
--- a/xfa/fxfa/cxfa_widgetacciterator.cpp
+++ b/xfa/fxfa/cxfa_widgetacciterator.cpp
@@ -19,7 +19,7 @@ CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToNext() {
while (pItem) {
m_pCurWidgetAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData());
if (m_pCurWidgetAcc)
- return m_pCurWidgetAcc;
+ return m_pCurWidgetAcc.Get();
pItem = m_ContentIterator.MoveToNext();
}
return nullptr;
diff --git a/xfa/fxfa/cxfa_widgetacciterator.h b/xfa/fxfa/cxfa_widgetacciterator.h
index ab18e833c2..0ad94260f3 100644
--- a/xfa/fxfa/cxfa_widgetacciterator.h
+++ b/xfa/fxfa/cxfa_widgetacciterator.h
@@ -7,6 +7,7 @@
#ifndef XFA_FXFA_CXFA_WIDGETACCITERATOR_H_
#define XFA_FXFA_CXFA_WIDGETACCITERATOR_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h"
class CXFA_Node;
@@ -22,7 +23,7 @@ class CXFA_WidgetAccIterator {
private:
CXFA_ContainerIterator m_ContentIterator;
- CXFA_WidgetAcc* m_pCurWidgetAcc; // not owned.
+ CFX_UnownedPtr<CXFA_WidgetAcc> m_pCurWidgetAcc;
};
#endif // XFA_FXFA_CXFA_WIDGETACCITERATOR_H_
diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
index d17a1bab50..add8cb8fcb 100644
--- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
@@ -103,7 +103,7 @@ int32_t CXFA_ResolveProcessor::ResolveAnyChild(CXFA_ResolveNodesData& rnd) {
return pdfium::CollectionSize<int32_t>(rnd.m_Objects);
}
std::vector<CXFA_Node*> tempNodes;
- for (CXFA_Object* pObject : rnd.m_Objects)
+ for (auto* pObject : rnd.m_Objects)
tempNodes.push_back(pObject->AsNode());
m_pNodeHelper->CountSiblings(findNode, XFA_LOGIC_Transparent, &tempNodes,
bClassName);