aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2019-05-30 00:06:33 +0000
committerChromium commit bot <commit-bot@chromium.org>2019-05-30 00:06:33 +0000
commit12899533d341436e381caa09f6063d09e6426ebe (patch)
tree22abc1e3bda2c8069d83d1fea2d3f9b3e6431599
parenta9f9e1e2ade657145fca7833b089177951521f4d (diff)
downloadpdfium-12899533d341436e381caa09f6063d09e6426ebe.tar.gz
Remove some more xfa/fwl circular includes into xfa/fxfa
Both CFWL_App and CFWL_WidgetMgr need to declare a virtual interface for the higher levels to implement to prevent direct calls. Change-Id: Ifbf8c8467ce7a5b9716048d64d1539db0a8f817d Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55110 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r--xfa/fwl/cfwl_app.cpp6
-rw-r--r--xfa/fwl/cfwl_app.h17
-rw-r--r--xfa/fwl/cfwl_timer.cpp4
-rw-r--r--xfa/fwl/cfwl_widget.cpp1
-rw-r--r--xfa/fwl/cfwl_widgetmgr.cpp6
-rw-r--r--xfa/fwl/cfwl_widgetmgr.h17
-rw-r--r--xfa/fxfa/cxfa_ffapp.cpp4
-rw-r--r--xfa/fxfa/cxfa_ffapp.h11
-rw-r--r--xfa/fxfa/cxfa_fwladapterwidgetmgr.h9
9 files changed, 45 insertions, 30 deletions
diff --git a/xfa/fwl/cfwl_app.cpp b/xfa/fwl/cfwl_app.cpp
index 666a91d20..c3a06e36d 100644
--- a/xfa/fwl/cfwl_app.cpp
+++ b/xfa/fwl/cfwl_app.cpp
@@ -10,11 +10,11 @@
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
-#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
-CFWL_App::CFWL_App(CXFA_FFApp* pAdapter)
+CFWL_App::CFWL_App(AdapterIface* pAdapter)
: m_pAdapterNative(pAdapter),
- m_pWidgetMgr(pdfium::MakeUnique<CFWL_WidgetMgr>(pAdapter)),
+ m_pWidgetMgr(
+ pdfium::MakeUnique<CFWL_WidgetMgr>(pAdapter->GetWidgetMgrAdapter())),
m_pNoteDriver(pdfium::MakeUnique<CFWL_NoteDriver>()) {
ASSERT(m_pAdapterNative);
}
diff --git a/xfa/fwl/cfwl_app.h b/xfa/fwl/cfwl_app.h
index ed47149a5..3bac5bd4b 100644
--- a/xfa/fwl/cfwl_app.h
+++ b/xfa/fwl/cfwl_app.h
@@ -10,12 +10,12 @@
#include <memory>
#include "core/fxcrt/fx_string.h"
+#include "xfa/fwl/cfwl_widgetmgr.h"
class CFWL_NoteDriver;
class CFWL_WidgetMgr;
-class CXFA_FFApp;
-class CXFA_FWLAdapterWidgetMgr;
class CFWL_Widget;
+class IFWL_AdapterTimerMgr;
enum FWL_KeyFlag {
FWL_KEYFLAG_Ctrl = 1 << 0,
@@ -29,15 +29,22 @@ enum FWL_KeyFlag {
class CFWL_App {
public:
- explicit CFWL_App(CXFA_FFApp* pAdapter);
+ class AdapterIface {
+ public:
+ virtual ~AdapterIface() {}
+ virtual CFWL_WidgetMgr::AdapterIface* GetWidgetMgrAdapter() = 0;
+ virtual std::unique_ptr<IFWL_AdapterTimerMgr> NewTimerMgr() = 0;
+ };
+
+ explicit CFWL_App(AdapterIface* pAdapter);
~CFWL_App();
- CXFA_FFApp* GetAdapterNative() const { return m_pAdapterNative.Get(); }
+ AdapterIface* GetAdapterNative() const { return m_pAdapterNative.Get(); }
CFWL_WidgetMgr* GetWidgetMgr() const { return m_pWidgetMgr.get(); }
CFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver.get(); }
private:
- UnownedPtr<CXFA_FFApp> const m_pAdapterNative;
+ UnownedPtr<AdapterIface> const m_pAdapterNative;
std::unique_ptr<CFWL_WidgetMgr> m_pWidgetMgr;
std::unique_ptr<CFWL_NoteDriver> m_pNoteDriver;
};
diff --git a/xfa/fwl/cfwl_timer.cpp b/xfa/fwl/cfwl_timer.cpp
index c332555b6..8e828344e 100644
--- a/xfa/fwl/cfwl_timer.cpp
+++ b/xfa/fwl/cfwl_timer.cpp
@@ -10,14 +10,14 @@
#include "xfa/fwl/cfwl_timerinfo.h"
#include "xfa/fwl/cfwl_widget.h"
#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) {
- CXFA_FFApp* pAdapterNative = m_pWidget->GetOwnerApp()->GetAdapterNative();
+ CFWL_App::AdapterIface* pAdapterNative =
+ m_pWidget->GetOwnerApp()->GetAdapterNative();
if (!pAdapterNative)
return nullptr;
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 0150bbb53..a6ab96592 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -27,7 +27,6 @@
#include "xfa/fwl/cfwl_themetext.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
#include "xfa/fwl/ifwl_themeprovider.h"
-#include "xfa/fxfa/cxfa_ffapp.h"
#define FWL_WGT_CalcHeight 2048
#define FWL_WGT_CalcWidth 2048
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index 3531bf28b..a95386fd6 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -12,11 +12,9 @@
#include "third_party/base/ptr_util.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_notedriver.h"
-#include "xfa/fxfa/cxfa_ffapp.h"
-#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
-CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative)
- : m_pAdapter(pAdapterNative->GetFWLAdapterWidgetMgr()) {
+CFWL_WidgetMgr::CFWL_WidgetMgr(AdapterIface* pAdapterNative)
+ : m_pAdapter(pAdapterNative) {
m_mapWidgetItem[nullptr] = pdfium::MakeUnique<Item>();
}
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index 796b37eab..cb2b1ca82 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -15,15 +15,24 @@
#include "xfa/fxgraphics/cxfa_graphics.h"
class CFWL_Message;
-class CXFA_FFApp;
-class CXFA_FWLAdapterWidgetMgr;
class CXFA_Graphics;
class CFX_Matrix;
class CFWL_Widget;
class CFWL_WidgetMgr {
public:
- explicit CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative);
+ class AdapterIface {
+ public:
+ virtual ~AdapterIface() {}
+ virtual void RepaintWidget(CFWL_Widget* pWidget) = 0;
+ virtual bool GetPopupPos(CFWL_Widget* pWidget,
+ float fMinHeight,
+ float fMaxHeight,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF* pPopupRect) = 0;
+ };
+
+ explicit CFWL_WidgetMgr(AdapterIface* pAdapterNative);
~CFWL_WidgetMgr();
void OnProcessMessageToForm(CFWL_Message* pMessage);
@@ -89,7 +98,7 @@ class CFWL_WidgetMgr {
bool IsAbleNative(CFWL_Widget* pWidget) const;
std::map<const CFWL_Widget*, std::unique_ptr<Item>> m_mapWidgetItem;
- UnownedPtr<CXFA_FWLAdapterWidgetMgr> const m_pAdapter;
+ UnownedPtr<AdapterIface> const m_pAdapter;
};
#endif // XFA_FWL_CFWL_WIDGETMGR_H_
diff --git a/xfa/fxfa/cxfa_ffapp.cpp b/xfa/fxfa/cxfa_ffapp.cpp
index 7b849f310..a70de91e1 100644
--- a/xfa/fxfa/cxfa_ffapp.cpp
+++ b/xfa/fxfa/cxfa_ffapp.cpp
@@ -60,13 +60,13 @@ CXFA_FWLTheme* CXFA_FFApp::GetFWLTheme(CXFA_FFDoc* doc) {
return m_pFWLTheme.get();
}
-CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetFWLAdapterWidgetMgr() {
+CFWL_WidgetMgr::AdapterIface* CXFA_FFApp::GetWidgetMgrAdapter() {
if (!m_pAdapterWidgetMgr)
m_pAdapterWidgetMgr = pdfium::MakeUnique<CXFA_FWLAdapterWidgetMgr>();
return m_pAdapterWidgetMgr.get();
}
-std::unique_ptr<IFWL_AdapterTimerMgr> CXFA_FFApp::NewTimerMgr() const {
+std::unique_ptr<IFWL_AdapterTimerMgr> CXFA_FFApp::NewTimerMgr() {
return m_pProvider->NewTimerMgr();
}
diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h
index 724c57197..3bf0a9300 100644
--- a/xfa/fxfa/cxfa_ffapp.h
+++ b/xfa/fxfa/cxfa_ffapp.h
@@ -20,23 +20,24 @@ class CXFA_FWLAdapterWidgetMgr;
class CXFA_FWLTheme;
class IFWL_AdapterTimerMgr;
-class CXFA_FFApp {
+class CXFA_FFApp : public CFWL_App::AdapterIface {
public:
static void SkipFontLoadForTesting(bool skip);
explicit CXFA_FFApp(IXFA_AppProvider* pProvider);
- ~CXFA_FFApp();
+ ~CXFA_FFApp() override;
- CXFA_FWLAdapterWidgetMgr* GetFWLAdapterWidgetMgr();
- CFWL_WidgetMgr* GetFWLWidgetMgr() const { return m_pFWLApp->GetWidgetMgr(); }
+ // CFWL_App::AdapterIface:
+ CFWL_WidgetMgr::AdapterIface* GetWidgetMgrAdapter() override;
+ std::unique_ptr<IFWL_AdapterTimerMgr> NewTimerMgr() override;
+ CFWL_WidgetMgr* GetFWLWidgetMgr() const { return m_pFWLApp->GetWidgetMgr(); }
CFGAS_FontMgr* GetFDEFontMgr();
CXFA_FWLTheme* GetFWLTheme(CXFA_FFDoc* doc);
IXFA_AppProvider* GetAppProvider() const { return m_pProvider.Get(); }
const CFWL_App* GetFWLApp() const { return m_pFWLApp.get(); }
CXFA_FontMgr* GetXFAFontMgr() { return &m_pFontMgr; }
- std::unique_ptr<IFWL_AdapterTimerMgr> NewTimerMgr() const;
void ClearEventTargets();
diff --git a/xfa/fxfa/cxfa_fwladapterwidgetmgr.h b/xfa/fxfa/cxfa_fwladapterwidgetmgr.h
index f0cc373b6..4a50c280a 100644
--- a/xfa/fxfa/cxfa_fwladapterwidgetmgr.h
+++ b/xfa/fxfa/cxfa_fwladapterwidgetmgr.h
@@ -9,20 +9,21 @@
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
+#include "xfa/fwl/cfwl_widgetmgr.h"
class CFWL_Widget;
-class CXFA_FWLAdapterWidgetMgr {
+class CXFA_FWLAdapterWidgetMgr : public CFWL_WidgetMgr::AdapterIface {
public:
CXFA_FWLAdapterWidgetMgr();
- ~CXFA_FWLAdapterWidgetMgr();
+ ~CXFA_FWLAdapterWidgetMgr() override;
- void RepaintWidget(CFWL_Widget* pWidget);
+ void RepaintWidget(CFWL_Widget* pWidget) override;
bool GetPopupPos(CFWL_Widget* pWidget,
float fMinHeight,
float fMaxHeight,
const CFX_RectF& rtAnchor,
- CFX_RectF* pPopupRect);
+ CFX_RectF* pPopupRect) override;
};
#endif // XFA_FXFA_CXFA_FWLADAPTERWIDGETMGR_H_