summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-09-21 15:43:56 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-21 19:57:09 +0000
commita5eb9f05b7c3f82630784e043ccf75c4e019b18f (patch)
tree5c4adb283ed60a04661b28c6bcbda59aabf2f8fd /xfa
parent65ecca4bc9c8e043b355c459486870ac1518095d (diff)
downloadpdfium-a5eb9f05b7c3f82630784e043ccf75c4e019b18f.tar.xz
Cleanup WidgetMgr ownership
The CXFA_FFApp can get the FWLWidgetMgr from the CFWL_App and does not need to store a copy. This removes the need to pass the delegate into the GetFWLAdapterWidgetMgr() method and we can set the capabilities directy. Change-Id: If4794d07fa0fb5dd32b816a21f04e6d7710886ca Reviewed-on: https://pdfium-review.googlesource.com/14611 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fwl/cfwl_widgetmgr.cpp8
-rw-r--r--xfa/fwl/cfwl_widgetmgr.h1
-rw-r--r--xfa/fxfa/cxfa_ffapp.cpp8
-rw-r--r--xfa/fxfa/cxfa_ffapp.h8
4 files changed, 6 insertions, 19 deletions
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index 4f697361c5..a0f6e3a18c 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -29,8 +29,8 @@ struct FWL_NEEDREPAINTHITDATA {
} // namespace
CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative)
- : m_dwCapability(0),
- m_pAdapter(pAdapterNative->GetFWLAdapterWidgetMgr(this)) {
+ : m_dwCapability(FWL_WGTMGR_DisableForm),
+ m_pAdapter(pAdapterNative->GetFWLAdapterWidgetMgr()) {
ASSERT(m_pAdapter);
m_mapWidgetItem[nullptr] = pdfium::MakeUnique<Item>();
#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
@@ -386,10 +386,6 @@ void CFWL_WidgetMgr::GetAdapterPopupPos(CFWL_Widget* pWidget,
m_pAdapter->GetPopupPos(pWidget, fMinHeight, fMaxHeight, rtAnchor, rtPopup);
}
-void CFWL_WidgetMgr::OnSetCapability(uint32_t dwCapability) {
- m_dwCapability = dwCapability;
-}
-
void CFWL_WidgetMgr::OnProcessMessageToForm(CFWL_Message* pMessage) {
if (!pMessage)
return;
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index f633ba8706..c7e48a1f60 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -28,7 +28,6 @@ class CFWL_WidgetMgr {
explicit CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative);
~CFWL_WidgetMgr();
- void OnSetCapability(uint32_t dwCapability);
void OnProcessMessageToForm(CFWL_Message* pMessage);
void OnDrawWidget(CFWL_Widget* pWidget,
CXFA_Graphics* pGraphics,
diff --git a/xfa/fxfa/cxfa_ffapp.cpp b/xfa/fxfa/cxfa_ffapp.cpp
index 7ef266b1e5..8ec23e19c4 100644
--- a/xfa/fxfa/cxfa_ffapp.cpp
+++ b/xfa/fxfa/cxfa_ffapp.cpp
@@ -78,13 +78,9 @@ CXFA_FWLTheme* CXFA_FFApp::GetFWLTheme() {
return m_pFWLTheme.get();
}
-CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetFWLAdapterWidgetMgr(
- CFWL_WidgetMgr* pDelegate) {
- if (!m_pAdapterWidgetMgr) {
+CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetFWLAdapterWidgetMgr() {
+ if (!m_pAdapterWidgetMgr)
m_pAdapterWidgetMgr = pdfium::MakeUnique<CXFA_FWLAdapterWidgetMgr>();
- pDelegate->OnSetCapability(FWL_WGTMGR_DisableForm);
- m_pWidgetMgr = pDelegate;
- }
return m_pAdapterWidgetMgr.get();
}
diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h
index 4f2a06db0a..6ee9e45a13 100644
--- a/xfa/fxfa/cxfa_ffapp.h
+++ b/xfa/fxfa/cxfa_ffapp.h
@@ -37,8 +37,8 @@ class CXFA_FFApp {
CXFA_FFDocHandler* GetDocHandler();
- CXFA_FWLAdapterWidgetMgr* GetFWLAdapterWidgetMgr(CFWL_WidgetMgr* pDelegate);
- CFWL_WidgetMgr* GetFWLWidgetMgr() const { return m_pWidgetMgr.Get(); }
+ CXFA_FWLAdapterWidgetMgr* GetFWLAdapterWidgetMgr();
+ CFWL_WidgetMgr* GetFWLWidgetMgr() const { return m_pFWLApp->GetWidgetMgr(); }
CFGAS_FontMgr* GetFDEFontMgr();
CXFA_FWLTheme* GetFWLTheme();
@@ -76,10 +76,6 @@ class CXFA_FFApp {
// 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_pWidgetMgr| has to be released before |m_pFWLApp|, since
- // |m_pFWLApp| is its owner.
- CFX_UnownedPtr<CFWL_WidgetMgr> m_pWidgetMgr;
};
#endif // XFA_FXFA_CXFA_FFAPP_H_